monaco.d.ts 282 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020
  1. /*!-----------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Type definitions for monaco-editor
  4. * Released under the MIT license
  5. *-----------------------------------------------------------*/
  6. /*---------------------------------------------------------------------------------------------
  7. * Copyright (c) Microsoft Corporation. All rights reserved.
  8. * Licensed under the MIT License. See License.txt in the project root for license information.
  9. *--------------------------------------------------------------------------------------------*/
  10. declare let MonacoEnvironment: monaco.Environment | undefined;
  11. interface Window {
  12. MonacoEnvironment?: monaco.Environment | undefined;
  13. }
  14. declare namespace monaco {
  15. export type Thenable<T> = PromiseLike<T>;
  16. export interface Environment {
  17. globalAPI?: boolean;
  18. baseUrl?: string;
  19. getWorker?(workerId: string, label: string): Worker;
  20. getWorkerUrl?(workerId: string, label: string): string;
  21. }
  22. export interface IDisposable {
  23. dispose(): void;
  24. }
  25. export interface IEvent<T> {
  26. (listener: (e: T) => any, thisArg?: any): IDisposable;
  27. }
  28. /**
  29. * A helper that allows to emit and listen to typed events
  30. */
  31. export class Emitter<T> {
  32. constructor();
  33. readonly event: IEvent<T>;
  34. fire(event: T): void;
  35. dispose(): void;
  36. }
  37. export enum MarkerTag {
  38. Unnecessary = 1,
  39. Deprecated = 2
  40. }
  41. export enum MarkerSeverity {
  42. Hint = 1,
  43. Info = 2,
  44. Warning = 4,
  45. Error = 8
  46. }
  47. export class CancellationTokenSource {
  48. constructor(parent?: CancellationToken);
  49. get token(): CancellationToken;
  50. cancel(): void;
  51. dispose(cancel?: boolean): void;
  52. }
  53. export interface CancellationToken {
  54. /**
  55. * A flag signalling is cancellation has been requested.
  56. */
  57. readonly isCancellationRequested: boolean;
  58. /**
  59. * An event which fires when cancellation is requested. This event
  60. * only ever fires `once` as cancellation can only happen once. Listeners
  61. * that are registered after cancellation will be called (next event loop run),
  62. * but also only once.
  63. *
  64. * @event
  65. */
  66. readonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable;
  67. }
  68. /**
  69. * Uniform Resource Identifier (Uri) http://tools.ietf.org/html/rfc3986.
  70. * This class is a simple parser which creates the basic component parts
  71. * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
  72. * and encoding.
  73. *
  74. * ```txt
  75. * foo://example.com:8042/over/there?name=ferret#nose
  76. * \_/ \______________/\_________/ \_________/ \__/
  77. * | | | | |
  78. * scheme authority path query fragment
  79. * | _____________________|__
  80. * / \ / \
  81. * urn:example:animal:ferret:nose
  82. * ```
  83. */
  84. export class Uri implements UriComponents {
  85. static isUri(thing: any): thing is Uri;
  86. /**
  87. * scheme is the 'http' part of 'http://www.example.com/some/path?query#fragment'.
  88. * The part before the first colon.
  89. */
  90. readonly scheme: string;
  91. /**
  92. * authority is the 'www.example.com' part of 'http://www.example.com/some/path?query#fragment'.
  93. * The part between the first double slashes and the next slash.
  94. */
  95. readonly authority: string;
  96. /**
  97. * path is the '/some/path' part of 'http://www.example.com/some/path?query#fragment'.
  98. */
  99. readonly path: string;
  100. /**
  101. * query is the 'query' part of 'http://www.example.com/some/path?query#fragment'.
  102. */
  103. readonly query: string;
  104. /**
  105. * fragment is the 'fragment' part of 'http://www.example.com/some/path?query#fragment'.
  106. */
  107. readonly fragment: string;
  108. /**
  109. * Returns a string representing the corresponding file system path of this Uri.
  110. * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the
  111. * platform specific path separator.
  112. *
  113. * * Will *not* validate the path for invalid characters and semantics.
  114. * * Will *not* look at the scheme of this Uri.
  115. * * The result shall *not* be used for display purposes but for accessing a file on disk.
  116. *
  117. *
  118. * The *difference* to `Uri#path` is the use of the platform specific separator and the handling
  119. * of UNC paths. See the below sample of a file-uri with an authority (UNC path).
  120. *
  121. * ```ts
  122. const u = Uri.parse('file://server/c$/folder/file.txt')
  123. u.authority === 'server'
  124. u.path === '/shares/c$/file.txt'
  125. u.fsPath === '\\server\c$\folder\file.txt'
  126. ```
  127. *
  128. * Using `Uri#path` to read a file (using fs-apis) would not be enough because parts of the path,
  129. * namely the server name, would be missing. Therefore `Uri#fsPath` exists - it's sugar to ease working
  130. * with URIs that represent files on disk (`file` scheme).
  131. */
  132. get fsPath(): string;
  133. with(change: {
  134. scheme?: string;
  135. authority?: string | null;
  136. path?: string | null;
  137. query?: string | null;
  138. fragment?: string | null;
  139. }): Uri;
  140. /**
  141. * Creates a new Uri from a string, e.g. `http://www.example.com/some/path`,
  142. * `file:///usr/home`, or `scheme:with/path`.
  143. *
  144. * @param value A string which represents an Uri (see `Uri#toString`).
  145. */
  146. static parse(value: string, _strict?: boolean): Uri;
  147. /**
  148. * Creates a new Uri from a file system path, e.g. `c:\my\files`,
  149. * `/usr/home`, or `\\server\share\some\path`.
  150. *
  151. * The *difference* between `Uri#parse` and `Uri#file` is that the latter treats the argument
  152. * as path, not as stringified-uri. E.g. `Uri.file(path)` is **not the same as**
  153. * `Uri.parse('file://' + path)` because the path might contain characters that are
  154. * interpreted (# and ?). See the following sample:
  155. * ```ts
  156. const good = Uri.file('/coding/c#/project1');
  157. good.scheme === 'file';
  158. good.path === '/coding/c#/project1';
  159. good.fragment === '';
  160. const bad = Uri.parse('file://' + '/coding/c#/project1');
  161. bad.scheme === 'file';
  162. bad.path === '/coding/c'; // path is now broken
  163. bad.fragment === '/project1';
  164. ```
  165. *
  166. * @param path A file system path (see `Uri#fsPath`)
  167. */
  168. static file(path: string): Uri;
  169. static from(components: {
  170. scheme: string;
  171. authority?: string;
  172. path?: string;
  173. query?: string;
  174. fragment?: string;
  175. }): Uri;
  176. /**
  177. * Join a Uri path with path fragments and normalizes the resulting path.
  178. *
  179. * @param uri The input Uri.
  180. * @param pathFragment The path fragment to add to the Uri path.
  181. * @returns The resulting Uri.
  182. */
  183. static joinPath(uri: Uri, ...pathFragment: string[]): Uri;
  184. /**
  185. * Creates a string representation for this Uri. It's guaranteed that calling
  186. * `Uri.parse` with the result of this function creates an Uri which is equal
  187. * to this Uri.
  188. *
  189. * * The result shall *not* be used for display purposes but for externalization or transport.
  190. * * The result will be encoded using the percentage encoding and encoding happens mostly
  191. * ignore the scheme-specific encoding rules.
  192. *
  193. * @param skipEncoding Do not encode the result, default is `false`
  194. */
  195. toString(skipEncoding?: boolean): string;
  196. toJSON(): UriComponents;
  197. static revive(data: UriComponents | Uri): Uri;
  198. static revive(data: UriComponents | Uri | undefined): Uri | undefined;
  199. static revive(data: UriComponents | Uri | null): Uri | null;
  200. static revive(data: UriComponents | Uri | undefined | null): Uri | undefined | null;
  201. }
  202. export interface UriComponents {
  203. scheme: string;
  204. authority: string;
  205. path: string;
  206. query: string;
  207. fragment: string;
  208. }
  209. /**
  210. * Virtual Key Codes, the value does not hold any inherent meaning.
  211. * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
  212. * But these are "more general", as they should work across browsers & OS`s.
  213. */
  214. export enum KeyCode {
  215. DependsOnKbLayout = -1,
  216. /**
  217. * Placed first to cover the 0 value of the enum.
  218. */
  219. Unknown = 0,
  220. Backspace = 1,
  221. Tab = 2,
  222. Enter = 3,
  223. Shift = 4,
  224. Ctrl = 5,
  225. Alt = 6,
  226. PauseBreak = 7,
  227. CapsLock = 8,
  228. Escape = 9,
  229. Space = 10,
  230. PageUp = 11,
  231. PageDown = 12,
  232. End = 13,
  233. Home = 14,
  234. LeftArrow = 15,
  235. UpArrow = 16,
  236. RightArrow = 17,
  237. DownArrow = 18,
  238. Insert = 19,
  239. Delete = 20,
  240. Digit0 = 21,
  241. Digit1 = 22,
  242. Digit2 = 23,
  243. Digit3 = 24,
  244. Digit4 = 25,
  245. Digit5 = 26,
  246. Digit6 = 27,
  247. Digit7 = 28,
  248. Digit8 = 29,
  249. Digit9 = 30,
  250. KeyA = 31,
  251. KeyB = 32,
  252. KeyC = 33,
  253. KeyD = 34,
  254. KeyE = 35,
  255. KeyF = 36,
  256. KeyG = 37,
  257. KeyH = 38,
  258. KeyI = 39,
  259. KeyJ = 40,
  260. KeyK = 41,
  261. KeyL = 42,
  262. KeyM = 43,
  263. KeyN = 44,
  264. KeyO = 45,
  265. KeyP = 46,
  266. KeyQ = 47,
  267. KeyR = 48,
  268. KeyS = 49,
  269. KeyT = 50,
  270. KeyU = 51,
  271. KeyV = 52,
  272. KeyW = 53,
  273. KeyX = 54,
  274. KeyY = 55,
  275. KeyZ = 56,
  276. Meta = 57,
  277. ContextMenu = 58,
  278. F1 = 59,
  279. F2 = 60,
  280. F3 = 61,
  281. F4 = 62,
  282. F5 = 63,
  283. F6 = 64,
  284. F7 = 65,
  285. F8 = 66,
  286. F9 = 67,
  287. F10 = 68,
  288. F11 = 69,
  289. F12 = 70,
  290. F13 = 71,
  291. F14 = 72,
  292. F15 = 73,
  293. F16 = 74,
  294. F17 = 75,
  295. F18 = 76,
  296. F19 = 77,
  297. NumLock = 78,
  298. ScrollLock = 79,
  299. /**
  300. * Used for miscellaneous characters; it can vary by keyboard.
  301. * For the US standard keyboard, the ';:' key
  302. */
  303. Semicolon = 80,
  304. /**
  305. * For any country/region, the '+' key
  306. * For the US standard keyboard, the '=+' key
  307. */
  308. Equal = 81,
  309. /**
  310. * For any country/region, the ',' key
  311. * For the US standard keyboard, the ',<' key
  312. */
  313. Comma = 82,
  314. /**
  315. * For any country/region, the '-' key
  316. * For the US standard keyboard, the '-_' key
  317. */
  318. Minus = 83,
  319. /**
  320. * For any country/region, the '.' key
  321. * For the US standard keyboard, the '.>' key
  322. */
  323. Period = 84,
  324. /**
  325. * Used for miscellaneous characters; it can vary by keyboard.
  326. * For the US standard keyboard, the '/?' key
  327. */
  328. Slash = 85,
  329. /**
  330. * Used for miscellaneous characters; it can vary by keyboard.
  331. * For the US standard keyboard, the '`~' key
  332. */
  333. Backquote = 86,
  334. /**
  335. * Used for miscellaneous characters; it can vary by keyboard.
  336. * For the US standard keyboard, the '[{' key
  337. */
  338. BracketLeft = 87,
  339. /**
  340. * Used for miscellaneous characters; it can vary by keyboard.
  341. * For the US standard keyboard, the '\|' key
  342. */
  343. Backslash = 88,
  344. /**
  345. * Used for miscellaneous characters; it can vary by keyboard.
  346. * For the US standard keyboard, the ']}' key
  347. */
  348. BracketRight = 89,
  349. /**
  350. * Used for miscellaneous characters; it can vary by keyboard.
  351. * For the US standard keyboard, the ''"' key
  352. */
  353. Quote = 90,
  354. /**
  355. * Used for miscellaneous characters; it can vary by keyboard.
  356. */
  357. OEM_8 = 91,
  358. /**
  359. * Either the angle bracket key or the backslash key on the RT 102-key keyboard.
  360. */
  361. IntlBackslash = 92,
  362. Numpad0 = 93,
  363. Numpad1 = 94,
  364. Numpad2 = 95,
  365. Numpad3 = 96,
  366. Numpad4 = 97,
  367. Numpad5 = 98,
  368. Numpad6 = 99,
  369. Numpad7 = 100,
  370. Numpad8 = 101,
  371. Numpad9 = 102,
  372. NumpadMultiply = 103,
  373. NumpadAdd = 104,
  374. NUMPAD_SEPARATOR = 105,
  375. NumpadSubtract = 106,
  376. NumpadDecimal = 107,
  377. NumpadDivide = 108,
  378. /**
  379. * Cover all key codes when IME is processing input.
  380. */
  381. KEY_IN_COMPOSITION = 109,
  382. ABNT_C1 = 110,
  383. ABNT_C2 = 111,
  384. AudioVolumeMute = 112,
  385. AudioVolumeUp = 113,
  386. AudioVolumeDown = 114,
  387. BrowserSearch = 115,
  388. BrowserHome = 116,
  389. BrowserBack = 117,
  390. BrowserForward = 118,
  391. MediaTrackNext = 119,
  392. MediaTrackPrevious = 120,
  393. MediaStop = 121,
  394. MediaPlayPause = 122,
  395. LaunchMediaPlayer = 123,
  396. LaunchMail = 124,
  397. LaunchApp2 = 125,
  398. /**
  399. * Placed last to cover the length of the enum.
  400. * Please do not depend on this value!
  401. */
  402. MAX_VALUE = 126
  403. }
  404. export class KeyMod {
  405. static readonly CtrlCmd: number;
  406. static readonly Shift: number;
  407. static readonly Alt: number;
  408. static readonly WinCtrl: number;
  409. static chord(firstPart: number, secondPart: number): number;
  410. }
  411. export interface IMarkdownString {
  412. readonly value: string;
  413. readonly isTrusted?: boolean;
  414. readonly supportThemeIcons?: boolean;
  415. readonly supportHtml?: boolean;
  416. readonly baseUri?: UriComponents;
  417. uris?: {
  418. [href: string]: UriComponents;
  419. };
  420. }
  421. export interface IKeyboardEvent {
  422. readonly _standardKeyboardEventBrand: true;
  423. readonly browserEvent: KeyboardEvent;
  424. readonly target: HTMLElement;
  425. readonly ctrlKey: boolean;
  426. readonly shiftKey: boolean;
  427. readonly altKey: boolean;
  428. readonly metaKey: boolean;
  429. readonly keyCode: KeyCode;
  430. readonly code: string;
  431. equals(keybinding: number): boolean;
  432. preventDefault(): void;
  433. stopPropagation(): void;
  434. }
  435. export interface IMouseEvent {
  436. readonly browserEvent: MouseEvent;
  437. readonly leftButton: boolean;
  438. readonly middleButton: boolean;
  439. readonly rightButton: boolean;
  440. readonly buttons: number;
  441. readonly target: HTMLElement;
  442. readonly detail: number;
  443. readonly posx: number;
  444. readonly posy: number;
  445. readonly ctrlKey: boolean;
  446. readonly shiftKey: boolean;
  447. readonly altKey: boolean;
  448. readonly metaKey: boolean;
  449. readonly timestamp: number;
  450. preventDefault(): void;
  451. stopPropagation(): void;
  452. }
  453. export interface IScrollEvent {
  454. readonly scrollTop: number;
  455. readonly scrollLeft: number;
  456. readonly scrollWidth: number;
  457. readonly scrollHeight: number;
  458. readonly scrollTopChanged: boolean;
  459. readonly scrollLeftChanged: boolean;
  460. readonly scrollWidthChanged: boolean;
  461. readonly scrollHeightChanged: boolean;
  462. }
  463. /**
  464. * A position in the editor. This interface is suitable for serialization.
  465. */
  466. export interface IPosition {
  467. /**
  468. * line number (starts at 1)
  469. */
  470. readonly lineNumber: number;
  471. /**
  472. * column (the first character in a line is between column 1 and column 2)
  473. */
  474. readonly column: number;
  475. }
  476. /**
  477. * A position in the editor.
  478. */
  479. export class Position {
  480. /**
  481. * line number (starts at 1)
  482. */
  483. readonly lineNumber: number;
  484. /**
  485. * column (the first character in a line is between column 1 and column 2)
  486. */
  487. readonly column: number;
  488. constructor(lineNumber: number, column: number);
  489. /**
  490. * Create a new position from this position.
  491. *
  492. * @param newLineNumber new line number
  493. * @param newColumn new column
  494. */
  495. with(newLineNumber?: number, newColumn?: number): Position;
  496. /**
  497. * Derive a new position from this position.
  498. *
  499. * @param deltaLineNumber line number delta
  500. * @param deltaColumn column delta
  501. */
  502. delta(deltaLineNumber?: number, deltaColumn?: number): Position;
  503. /**
  504. * Test if this position equals other position
  505. */
  506. equals(other: IPosition): boolean;
  507. /**
  508. * Test if position `a` equals position `b`
  509. */
  510. static equals(a: IPosition | null, b: IPosition | null): boolean;
  511. /**
  512. * Test if this position is before other position.
  513. * If the two positions are equal, the result will be false.
  514. */
  515. isBefore(other: IPosition): boolean;
  516. /**
  517. * Test if position `a` is before position `b`.
  518. * If the two positions are equal, the result will be false.
  519. */
  520. static isBefore(a: IPosition, b: IPosition): boolean;
  521. /**
  522. * Test if this position is before other position.
  523. * If the two positions are equal, the result will be true.
  524. */
  525. isBeforeOrEqual(other: IPosition): boolean;
  526. /**
  527. * Test if position `a` is before position `b`.
  528. * If the two positions are equal, the result will be true.
  529. */
  530. static isBeforeOrEqual(a: IPosition, b: IPosition): boolean;
  531. /**
  532. * A function that compares positions, useful for sorting
  533. */
  534. static compare(a: IPosition, b: IPosition): number;
  535. /**
  536. * Clone this position.
  537. */
  538. clone(): Position;
  539. /**
  540. * Convert to a human-readable representation.
  541. */
  542. toString(): string;
  543. /**
  544. * Create a `Position` from an `IPosition`.
  545. */
  546. static lift(pos: IPosition): Position;
  547. /**
  548. * Test if `obj` is an `IPosition`.
  549. */
  550. static isIPosition(obj: any): obj is IPosition;
  551. }
  552. /**
  553. * A range in the editor. This interface is suitable for serialization.
  554. */
  555. export interface IRange {
  556. /**
  557. * Line number on which the range starts (starts at 1).
  558. */
  559. readonly startLineNumber: number;
  560. /**
  561. * Column on which the range starts in line `startLineNumber` (starts at 1).
  562. */
  563. readonly startColumn: number;
  564. /**
  565. * Line number on which the range ends.
  566. */
  567. readonly endLineNumber: number;
  568. /**
  569. * Column on which the range ends in line `endLineNumber`.
  570. */
  571. readonly endColumn: number;
  572. }
  573. /**
  574. * A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)
  575. */
  576. export class Range {
  577. /**
  578. * Line number on which the range starts (starts at 1).
  579. */
  580. readonly startLineNumber: number;
  581. /**
  582. * Column on which the range starts in line `startLineNumber` (starts at 1).
  583. */
  584. readonly startColumn: number;
  585. /**
  586. * Line number on which the range ends.
  587. */
  588. readonly endLineNumber: number;
  589. /**
  590. * Column on which the range ends in line `endLineNumber`.
  591. */
  592. readonly endColumn: number;
  593. constructor(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number);
  594. /**
  595. * Test if this range is empty.
  596. */
  597. isEmpty(): boolean;
  598. /**
  599. * Test if `range` is empty.
  600. */
  601. static isEmpty(range: IRange): boolean;
  602. /**
  603. * Test if position is in this range. If the position is at the edges, will return true.
  604. */
  605. containsPosition(position: IPosition): boolean;
  606. /**
  607. * Test if `position` is in `range`. If the position is at the edges, will return true.
  608. */
  609. static containsPosition(range: IRange, position: IPosition): boolean;
  610. /**
  611. * Test if range is in this range. If the range is equal to this range, will return true.
  612. */
  613. containsRange(range: IRange): boolean;
  614. /**
  615. * Test if `otherRange` is in `range`. If the ranges are equal, will return true.
  616. */
  617. static containsRange(range: IRange, otherRange: IRange): boolean;
  618. /**
  619. * Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.
  620. */
  621. strictContainsRange(range: IRange): boolean;
  622. /**
  623. * Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false.
  624. */
  625. static strictContainsRange(range: IRange, otherRange: IRange): boolean;
  626. /**
  627. * A reunion of the two ranges.
  628. * The smallest position will be used as the start point, and the largest one as the end point.
  629. */
  630. plusRange(range: IRange): Range;
  631. /**
  632. * A reunion of the two ranges.
  633. * The smallest position will be used as the start point, and the largest one as the end point.
  634. */
  635. static plusRange(a: IRange, b: IRange): Range;
  636. /**
  637. * A intersection of the two ranges.
  638. */
  639. intersectRanges(range: IRange): Range | null;
  640. /**
  641. * A intersection of the two ranges.
  642. */
  643. static intersectRanges(a: IRange, b: IRange): Range | null;
  644. /**
  645. * Test if this range equals other.
  646. */
  647. equalsRange(other: IRange | null): boolean;
  648. /**
  649. * Test if range `a` equals `b`.
  650. */
  651. static equalsRange(a: IRange | null, b: IRange | null): boolean;
  652. /**
  653. * Return the end position (which will be after or equal to the start position)
  654. */
  655. getEndPosition(): Position;
  656. /**
  657. * Return the end position (which will be after or equal to the start position)
  658. */
  659. static getEndPosition(range: IRange): Position;
  660. /**
  661. * Return the start position (which will be before or equal to the end position)
  662. */
  663. getStartPosition(): Position;
  664. /**
  665. * Return the start position (which will be before or equal to the end position)
  666. */
  667. static getStartPosition(range: IRange): Position;
  668. /**
  669. * Transform to a user presentable string representation.
  670. */
  671. toString(): string;
  672. /**
  673. * Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.
  674. */
  675. setEndPosition(endLineNumber: number, endColumn: number): Range;
  676. /**
  677. * Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.
  678. */
  679. setStartPosition(startLineNumber: number, startColumn: number): Range;
  680. /**
  681. * Create a new empty range using this range's start position.
  682. */
  683. collapseToStart(): Range;
  684. /**
  685. * Create a new empty range using this range's start position.
  686. */
  687. static collapseToStart(range: IRange): Range;
  688. static fromPositions(start: IPosition, end?: IPosition): Range;
  689. /**
  690. * Create a `Range` from an `IRange`.
  691. */
  692. static lift(range: undefined | null): null;
  693. static lift(range: IRange): Range;
  694. static lift(range: IRange | undefined | null): Range | null;
  695. /**
  696. * Test if `obj` is an `IRange`.
  697. */
  698. static isIRange(obj: any): obj is IRange;
  699. /**
  700. * Test if the two ranges are touching in any way.
  701. */
  702. static areIntersectingOrTouching(a: IRange, b: IRange): boolean;
  703. /**
  704. * Test if the two ranges are intersecting. If the ranges are touching it returns true.
  705. */
  706. static areIntersecting(a: IRange, b: IRange): boolean;
  707. /**
  708. * A function that compares ranges, useful for sorting ranges
  709. * It will first compare ranges on the startPosition and then on the endPosition
  710. */
  711. static compareRangesUsingStarts(a: IRange | null | undefined, b: IRange | null | undefined): number;
  712. /**
  713. * A function that compares ranges, useful for sorting ranges
  714. * It will first compare ranges on the endPosition and then on the startPosition
  715. */
  716. static compareRangesUsingEnds(a: IRange, b: IRange): number;
  717. /**
  718. * Test if the range spans multiple lines.
  719. */
  720. static spansMultipleLines(range: IRange): boolean;
  721. toJSON(): IRange;
  722. }
  723. /**
  724. * A selection in the editor.
  725. * The selection is a range that has an orientation.
  726. */
  727. export interface ISelection {
  728. /**
  729. * The line number on which the selection has started.
  730. */
  731. readonly selectionStartLineNumber: number;
  732. /**
  733. * The column on `selectionStartLineNumber` where the selection has started.
  734. */
  735. readonly selectionStartColumn: number;
  736. /**
  737. * The line number on which the selection has ended.
  738. */
  739. readonly positionLineNumber: number;
  740. /**
  741. * The column on `positionLineNumber` where the selection has ended.
  742. */
  743. readonly positionColumn: number;
  744. }
  745. /**
  746. * A selection in the editor.
  747. * The selection is a range that has an orientation.
  748. */
  749. export class Selection extends Range {
  750. /**
  751. * The line number on which the selection has started.
  752. */
  753. readonly selectionStartLineNumber: number;
  754. /**
  755. * The column on `selectionStartLineNumber` where the selection has started.
  756. */
  757. readonly selectionStartColumn: number;
  758. /**
  759. * The line number on which the selection has ended.
  760. */
  761. readonly positionLineNumber: number;
  762. /**
  763. * The column on `positionLineNumber` where the selection has ended.
  764. */
  765. readonly positionColumn: number;
  766. constructor(selectionStartLineNumber: number, selectionStartColumn: number, positionLineNumber: number, positionColumn: number);
  767. /**
  768. * Transform to a human-readable representation.
  769. */
  770. toString(): string;
  771. /**
  772. * Test if equals other selection.
  773. */
  774. equalsSelection(other: ISelection): boolean;
  775. /**
  776. * Test if the two selections are equal.
  777. */
  778. static selectionsEqual(a: ISelection, b: ISelection): boolean;
  779. /**
  780. * Get directions (LTR or RTL).
  781. */
  782. getDirection(): SelectionDirection;
  783. /**
  784. * Create a new selection with a different `positionLineNumber` and `positionColumn`.
  785. */
  786. setEndPosition(endLineNumber: number, endColumn: number): Selection;
  787. /**
  788. * Get the position at `positionLineNumber` and `positionColumn`.
  789. */
  790. getPosition(): Position;
  791. /**
  792. * Get the position at the start of the selection.
  793. */
  794. getSelectionStart(): Position;
  795. /**
  796. * Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`.
  797. */
  798. setStartPosition(startLineNumber: number, startColumn: number): Selection;
  799. /**
  800. * Create a `Selection` from one or two positions
  801. */
  802. static fromPositions(start: IPosition, end?: IPosition): Selection;
  803. /**
  804. * Creates a `Selection` from a range, given a direction.
  805. */
  806. static fromRange(range: Range, direction: SelectionDirection): Selection;
  807. /**
  808. * Create a `Selection` from an `ISelection`.
  809. */
  810. static liftSelection(sel: ISelection): Selection;
  811. /**
  812. * `a` equals `b`.
  813. */
  814. static selectionsArrEqual(a: ISelection[], b: ISelection[]): boolean;
  815. /**
  816. * Test if `obj` is an `ISelection`.
  817. */
  818. static isISelection(obj: any): obj is ISelection;
  819. /**
  820. * Create with a direction.
  821. */
  822. static createWithDirection(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number, direction: SelectionDirection): Selection;
  823. }
  824. /**
  825. * The direction of a selection.
  826. */
  827. export enum SelectionDirection {
  828. /**
  829. * The selection starts above where it ends.
  830. */
  831. LTR = 0,
  832. /**
  833. * The selection starts below where it ends.
  834. */
  835. RTL = 1
  836. }
  837. export class Token {
  838. _tokenBrand: void;
  839. readonly offset: number;
  840. readonly type: string;
  841. readonly language: string;
  842. constructor(offset: number, type: string, language: string);
  843. toString(): string;
  844. }
  845. }
  846. declare namespace monaco.editor {
  847. export interface IDiffNavigator {
  848. canNavigate(): boolean;
  849. next(): void;
  850. previous(): void;
  851. dispose(): void;
  852. }
  853. /**
  854. * Create a new editor under `domElement`.
  855. * `domElement` should be empty (not contain other dom nodes).
  856. * The editor will read the size of `domElement`.
  857. */
  858. export function create(domElement: HTMLElement, options?: IStandaloneEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneCodeEditor;
  859. /**
  860. * Emitted when an editor is created.
  861. * Creating a diff editor might cause this listener to be invoked with the two editors.
  862. * @event
  863. */
  864. export function onDidCreateEditor(listener: (codeEditor: ICodeEditor) => void): IDisposable;
  865. /**
  866. * Create a new diff editor under `domElement`.
  867. * `domElement` should be empty (not contain other dom nodes).
  868. * The editor will read the size of `domElement`.
  869. */
  870. export function createDiffEditor(domElement: HTMLElement, options?: IStandaloneDiffEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneDiffEditor;
  871. export interface IDiffNavigatorOptions {
  872. readonly followsCaret?: boolean;
  873. readonly ignoreCharChanges?: boolean;
  874. readonly alwaysRevealFirst?: boolean;
  875. }
  876. export function createDiffNavigator(diffEditor: IStandaloneDiffEditor, opts?: IDiffNavigatorOptions): IDiffNavigator;
  877. /**
  878. * Create a new editor model.
  879. * You can specify the language that should be set for this model or let the language be inferred from the `uri`.
  880. */
  881. export function createModel(value: string, language?: string, uri?: Uri): ITextModel;
  882. /**
  883. * Change the language for a model.
  884. */
  885. export function setModelLanguage(model: ITextModel, languageId: string): void;
  886. /**
  887. * Set the markers for a model.
  888. */
  889. export function setModelMarkers(model: ITextModel, owner: string, markers: IMarkerData[]): void;
  890. /**
  891. * Get markers for owner and/or resource
  892. *
  893. * @returns list of markers
  894. */
  895. export function getModelMarkers(filter: {
  896. owner?: string;
  897. resource?: Uri;
  898. take?: number;
  899. }): IMarker[];
  900. /**
  901. * Emitted when markers change for a model.
  902. * @event
  903. */
  904. export function onDidChangeMarkers(listener: (e: readonly Uri[]) => void): IDisposable;
  905. /**
  906. * Get the model that has `uri` if it exists.
  907. */
  908. export function getModel(uri: Uri): ITextModel | null;
  909. /**
  910. * Get all the created models.
  911. */
  912. export function getModels(): ITextModel[];
  913. /**
  914. * Emitted when a model is created.
  915. * @event
  916. */
  917. export function onDidCreateModel(listener: (model: ITextModel) => void): IDisposable;
  918. /**
  919. * Emitted right before a model is disposed.
  920. * @event
  921. */
  922. export function onWillDisposeModel(listener: (model: ITextModel) => void): IDisposable;
  923. /**
  924. * Emitted when a different language is set to a model.
  925. * @event
  926. */
  927. export function onDidChangeModelLanguage(listener: (e: {
  928. readonly model: ITextModel;
  929. readonly oldLanguage: string;
  930. }) => void): IDisposable;
  931. /**
  932. * Create a new web worker that has model syncing capabilities built in.
  933. * Specify an AMD module to load that will `create` an object that will be proxied.
  934. */
  935. export function createWebWorker<T>(opts: IWebWorkerOptions): MonacoWebWorker<T>;
  936. /**
  937. * Colorize the contents of `domNode` using attribute `data-lang`.
  938. */
  939. export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): Promise<void>;
  940. /**
  941. * Colorize `text` using language `languageId`.
  942. */
  943. export function colorize(text: string, languageId: string, options: IColorizerOptions): Promise<string>;
  944. /**
  945. * Colorize a line in a model.
  946. */
  947. export function colorizeModelLine(model: ITextModel, lineNumber: number, tabSize?: number): string;
  948. /**
  949. * Tokenize `text` using language `languageId`
  950. */
  951. export function tokenize(text: string, languageId: string): Token[][];
  952. /**
  953. * Define a new theme or update an existing theme.
  954. */
  955. export function defineTheme(themeName: string, themeData: IStandaloneThemeData): void;
  956. /**
  957. * Switches to a theme.
  958. */
  959. export function setTheme(themeName: string): void;
  960. /**
  961. * Clears all cached font measurements and triggers re-measurement.
  962. */
  963. export function remeasureFonts(): void;
  964. /**
  965. * Register a command.
  966. */
  967. export function registerCommand(id: string, handler: (accessor: any, ...args: any[]) => void): IDisposable;
  968. export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black';
  969. export interface IStandaloneThemeData {
  970. base: BuiltinTheme;
  971. inherit: boolean;
  972. rules: ITokenThemeRule[];
  973. encodedTokensColors?: string[];
  974. colors: IColors;
  975. }
  976. export type IColors = {
  977. [colorId: string]: string;
  978. };
  979. export interface ITokenThemeRule {
  980. token: string;
  981. foreground?: string;
  982. background?: string;
  983. fontStyle?: string;
  984. }
  985. /**
  986. * A web worker that can provide a proxy to an arbitrary file.
  987. */
  988. export interface MonacoWebWorker<T> {
  989. /**
  990. * Terminate the web worker, thus invalidating the returned proxy.
  991. */
  992. dispose(): void;
  993. /**
  994. * Get a proxy to the arbitrary loaded code.
  995. */
  996. getProxy(): Promise<T>;
  997. /**
  998. * Synchronize (send) the models at `resources` to the web worker,
  999. * making them available in the monaco.worker.getMirrorModels().
  1000. */
  1001. withSyncedResources(resources: Uri[]): Promise<T>;
  1002. }
  1003. export interface IWebWorkerOptions {
  1004. /**
  1005. * The AMD moduleId to load.
  1006. * It should export a function `create` that should return the exported proxy.
  1007. */
  1008. moduleId: string;
  1009. /**
  1010. * The data to send over when calling create on the module.
  1011. */
  1012. createData?: any;
  1013. /**
  1014. * A label to be used to identify the web worker for debugging purposes.
  1015. */
  1016. label?: string;
  1017. /**
  1018. * An object that can be used by the web worker to make calls back to the main thread.
  1019. */
  1020. host?: any;
  1021. /**
  1022. * Keep idle models.
  1023. * Defaults to false, which means that idle models will stop syncing after a while.
  1024. */
  1025. keepIdleModels?: boolean;
  1026. }
  1027. /**
  1028. * Description of an action contribution
  1029. */
  1030. export interface IActionDescriptor {
  1031. /**
  1032. * An unique identifier of the contributed action.
  1033. */
  1034. id: string;
  1035. /**
  1036. * A label of the action that will be presented to the user.
  1037. */
  1038. label: string;
  1039. /**
  1040. * Precondition rule.
  1041. */
  1042. precondition?: string;
  1043. /**
  1044. * An array of keybindings for the action.
  1045. */
  1046. keybindings?: number[];
  1047. /**
  1048. * The keybinding rule (condition on top of precondition).
  1049. */
  1050. keybindingContext?: string;
  1051. /**
  1052. * Control if the action should show up in the context menu and where.
  1053. * The context menu of the editor has these default:
  1054. * navigation - The navigation group comes first in all cases.
  1055. * 1_modification - This group comes next and contains commands that modify your code.
  1056. * 9_cutcopypaste - The last default group with the basic editing commands.
  1057. * You can also create your own group.
  1058. * Defaults to null (don't show in context menu).
  1059. */
  1060. contextMenuGroupId?: string;
  1061. /**
  1062. * Control the order in the context menu group.
  1063. */
  1064. contextMenuOrder?: number;
  1065. /**
  1066. * Method that will be executed when the action is triggered.
  1067. * @param editor The editor instance is passed in as a convenience
  1068. */
  1069. run(editor: ICodeEditor, ...args: any[]): void | Promise<void>;
  1070. }
  1071. /**
  1072. * Options which apply for all editors.
  1073. */
  1074. export interface IGlobalEditorOptions {
  1075. /**
  1076. * The number of spaces a tab is equal to.
  1077. * This setting is overridden based on the file contents when `detectIndentation` is on.
  1078. * Defaults to 4.
  1079. */
  1080. tabSize?: number;
  1081. /**
  1082. * Insert spaces when pressing `Tab`.
  1083. * This setting is overridden based on the file contents when `detectIndentation` is on.
  1084. * Defaults to true.
  1085. */
  1086. insertSpaces?: boolean;
  1087. /**
  1088. * Controls whether `tabSize` and `insertSpaces` will be automatically detected when a file is opened based on the file contents.
  1089. * Defaults to true.
  1090. */
  1091. detectIndentation?: boolean;
  1092. /**
  1093. * Remove trailing auto inserted whitespace.
  1094. * Defaults to true.
  1095. */
  1096. trimAutoWhitespace?: boolean;
  1097. /**
  1098. * Special handling for large files to disable certain memory intensive features.
  1099. * Defaults to true.
  1100. */
  1101. largeFileOptimizations?: boolean;
  1102. /**
  1103. * Controls whether completions should be computed based on words in the document.
  1104. * Defaults to true.
  1105. */
  1106. wordBasedSuggestions?: boolean;
  1107. /**
  1108. * Controls whether word based completions should be included from opened documents of the same language or any language.
  1109. */
  1110. wordBasedSuggestionsOnlySameLanguage?: boolean;
  1111. /**
  1112. * Controls whether the semanticHighlighting is shown for the languages that support it.
  1113. * true: semanticHighlighting is enabled for all themes
  1114. * false: semanticHighlighting is disabled for all themes
  1115. * 'configuredByTheme': semanticHighlighting is controlled by the current color theme's semanticHighlighting setting.
  1116. * Defaults to 'byTheme'.
  1117. */
  1118. 'semanticHighlighting.enabled'?: true | false | 'configuredByTheme';
  1119. /**
  1120. * Keep peek editors open even when double clicking their content or when hitting `Escape`.
  1121. * Defaults to false.
  1122. */
  1123. stablePeek?: boolean;
  1124. /**
  1125. * Lines above this length will not be tokenized for performance reasons.
  1126. * Defaults to 20000.
  1127. */
  1128. maxTokenizationLineLength?: number;
  1129. /**
  1130. * Theme to be used for rendering.
  1131. * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
  1132. * You can create custom themes via `monaco.editor.defineTheme`.
  1133. * To switch a theme, use `monaco.editor.setTheme`.
  1134. * **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false.
  1135. */
  1136. theme?: string;
  1137. /**
  1138. * If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme.
  1139. * Defaults to true.
  1140. */
  1141. autoDetectHighContrast?: boolean;
  1142. }
  1143. /**
  1144. * The options to create an editor.
  1145. */
  1146. export interface IStandaloneEditorConstructionOptions extends IEditorConstructionOptions, IGlobalEditorOptions {
  1147. /**
  1148. * The initial model associated with this code editor.
  1149. */
  1150. model?: ITextModel | null;
  1151. /**
  1152. * The initial value of the auto created model in the editor.
  1153. * To not automatically create a model, use `model: null`.
  1154. */
  1155. value?: string;
  1156. /**
  1157. * The initial language of the auto created model in the editor.
  1158. * To not automatically create a model, use `model: null`.
  1159. */
  1160. language?: string;
  1161. /**
  1162. * Initial theme to be used for rendering.
  1163. * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
  1164. * You can create custom themes via `monaco.editor.defineTheme`.
  1165. * To switch a theme, use `monaco.editor.setTheme`.
  1166. * **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false.
  1167. */
  1168. theme?: string;
  1169. /**
  1170. * If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme.
  1171. * Defaults to true.
  1172. */
  1173. autoDetectHighContrast?: boolean;
  1174. /**
  1175. * An URL to open when Ctrl+H (Windows and Linux) or Cmd+H (OSX) is pressed in
  1176. * the accessibility help dialog in the editor.
  1177. *
  1178. * Defaults to "https://go.microsoft.com/fwlink/?linkid=852450"
  1179. */
  1180. accessibilityHelpUrl?: string;
  1181. /**
  1182. * Container element to use for ARIA messages.
  1183. * Defaults to document.body.
  1184. */
  1185. ariaContainerElement?: HTMLElement;
  1186. }
  1187. /**
  1188. * The options to create a diff editor.
  1189. */
  1190. export interface IStandaloneDiffEditorConstructionOptions extends IDiffEditorConstructionOptions {
  1191. /**
  1192. * Initial theme to be used for rendering.
  1193. * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
  1194. * You can create custom themes via `monaco.editor.defineTheme`.
  1195. * To switch a theme, use `monaco.editor.setTheme`.
  1196. * **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false.
  1197. */
  1198. theme?: string;
  1199. /**
  1200. * If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme.
  1201. * Defaults to true.
  1202. */
  1203. autoDetectHighContrast?: boolean;
  1204. }
  1205. export interface IStandaloneCodeEditor extends ICodeEditor {
  1206. updateOptions(newOptions: IEditorOptions & IGlobalEditorOptions): void;
  1207. addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null;
  1208. createContextKey<T>(key: string, defaultValue: T): IContextKey<T>;
  1209. addAction(descriptor: IActionDescriptor): IDisposable;
  1210. }
  1211. export interface IStandaloneDiffEditor extends IDiffEditor {
  1212. addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null;
  1213. createContextKey<T>(key: string, defaultValue: T): IContextKey<T>;
  1214. addAction(descriptor: IActionDescriptor): IDisposable;
  1215. getOriginalEditor(): IStandaloneCodeEditor;
  1216. getModifiedEditor(): IStandaloneCodeEditor;
  1217. }
  1218. export interface ICommandHandler {
  1219. (...args: any[]): void;
  1220. }
  1221. export interface IContextKey<T> {
  1222. set(value: T): void;
  1223. reset(): void;
  1224. get(): T | undefined;
  1225. }
  1226. export interface IEditorOverrideServices {
  1227. [index: string]: any;
  1228. }
  1229. export interface IMarker {
  1230. owner: string;
  1231. resource: Uri;
  1232. severity: MarkerSeverity;
  1233. code?: string | {
  1234. value: string;
  1235. target: Uri;
  1236. };
  1237. message: string;
  1238. source?: string;
  1239. startLineNumber: number;
  1240. startColumn: number;
  1241. endLineNumber: number;
  1242. endColumn: number;
  1243. relatedInformation?: IRelatedInformation[];
  1244. tags?: MarkerTag[];
  1245. }
  1246. /**
  1247. * A structure defining a problem/warning/etc.
  1248. */
  1249. export interface IMarkerData {
  1250. code?: string | {
  1251. value: string;
  1252. target: Uri;
  1253. };
  1254. severity: MarkerSeverity;
  1255. message: string;
  1256. source?: string;
  1257. startLineNumber: number;
  1258. startColumn: number;
  1259. endLineNumber: number;
  1260. endColumn: number;
  1261. relatedInformation?: IRelatedInformation[];
  1262. tags?: MarkerTag[];
  1263. }
  1264. /**
  1265. *
  1266. */
  1267. export interface IRelatedInformation {
  1268. resource: Uri;
  1269. message: string;
  1270. startLineNumber: number;
  1271. startColumn: number;
  1272. endLineNumber: number;
  1273. endColumn: number;
  1274. }
  1275. export interface IColorizerOptions {
  1276. tabSize?: number;
  1277. }
  1278. export interface IColorizerElementOptions extends IColorizerOptions {
  1279. theme?: string;
  1280. mimeType?: string;
  1281. }
  1282. export enum ScrollbarVisibility {
  1283. Auto = 1,
  1284. Hidden = 2,
  1285. Visible = 3
  1286. }
  1287. export interface ThemeColor {
  1288. id: string;
  1289. }
  1290. /**
  1291. * A single edit operation, that acts as a simple replace.
  1292. * i.e. Replace text at `range` with `text` in model.
  1293. */
  1294. export interface ISingleEditOperation {
  1295. /**
  1296. * The range to replace. This can be empty to emulate a simple insert.
  1297. */
  1298. range: IRange;
  1299. /**
  1300. * The text to replace with. This can be null to emulate a simple delete.
  1301. */
  1302. text: string | null;
  1303. /**
  1304. * This indicates that this operation has "insert" semantics.
  1305. * i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved.
  1306. */
  1307. forceMoveMarkers?: boolean;
  1308. }
  1309. /**
  1310. * Word inside a model.
  1311. */
  1312. export interface IWordAtPosition {
  1313. /**
  1314. * The word.
  1315. */
  1316. readonly word: string;
  1317. /**
  1318. * The column where the word starts.
  1319. */
  1320. readonly startColumn: number;
  1321. /**
  1322. * The column where the word ends.
  1323. */
  1324. readonly endColumn: number;
  1325. }
  1326. /**
  1327. * Vertical Lane in the overview ruler of the editor.
  1328. */
  1329. export enum OverviewRulerLane {
  1330. Left = 1,
  1331. Center = 2,
  1332. Right = 4,
  1333. Full = 7
  1334. }
  1335. /**
  1336. * Position in the minimap to render the decoration.
  1337. */
  1338. export enum MinimapPosition {
  1339. Inline = 1,
  1340. Gutter = 2
  1341. }
  1342. export interface IDecorationOptions {
  1343. /**
  1344. * CSS color to render.
  1345. * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
  1346. */
  1347. color: string | ThemeColor | undefined;
  1348. /**
  1349. * CSS color to render.
  1350. * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
  1351. */
  1352. darkColor?: string | ThemeColor;
  1353. }
  1354. /**
  1355. * Options for rendering a model decoration in the overview ruler.
  1356. */
  1357. export interface IModelDecorationOverviewRulerOptions extends IDecorationOptions {
  1358. /**
  1359. * The position in the overview ruler.
  1360. */
  1361. position: OverviewRulerLane;
  1362. }
  1363. /**
  1364. * Options for rendering a model decoration in the overview ruler.
  1365. */
  1366. export interface IModelDecorationMinimapOptions extends IDecorationOptions {
  1367. /**
  1368. * The position in the overview ruler.
  1369. */
  1370. position: MinimapPosition;
  1371. }
  1372. /**
  1373. * Options for a model decoration.
  1374. */
  1375. export interface IModelDecorationOptions {
  1376. /**
  1377. * Customize the growing behavior of the decoration when typing at the edges of the decoration.
  1378. * Defaults to TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges
  1379. */
  1380. stickiness?: TrackedRangeStickiness;
  1381. /**
  1382. * CSS class name describing the decoration.
  1383. */
  1384. className?: string | null;
  1385. /**
  1386. * Message to be rendered when hovering over the glyph margin decoration.
  1387. */
  1388. glyphMarginHoverMessage?: IMarkdownString | IMarkdownString[] | null;
  1389. /**
  1390. * Array of MarkdownString to render as the decoration message.
  1391. */
  1392. hoverMessage?: IMarkdownString | IMarkdownString[] | null;
  1393. /**
  1394. * Should the decoration expand to encompass a whole line.
  1395. */
  1396. isWholeLine?: boolean;
  1397. /**
  1398. * Specifies the stack order of a decoration.
  1399. * A decoration with greater stack order is always in front of a decoration with
  1400. * a lower stack order when the decorations are on the same line.
  1401. */
  1402. zIndex?: number;
  1403. /**
  1404. * If set, render this decoration in the overview ruler.
  1405. */
  1406. overviewRuler?: IModelDecorationOverviewRulerOptions | null;
  1407. /**
  1408. * If set, render this decoration in the minimap.
  1409. */
  1410. minimap?: IModelDecorationMinimapOptions | null;
  1411. /**
  1412. * If set, the decoration will be rendered in the glyph margin with this CSS class name.
  1413. */
  1414. glyphMarginClassName?: string | null;
  1415. /**
  1416. * If set, the decoration will be rendered in the lines decorations with this CSS class name.
  1417. */
  1418. linesDecorationsClassName?: string | null;
  1419. /**
  1420. * If set, the decoration will be rendered in the lines decorations with this CSS class name, but only for the first line in case of line wrapping.
  1421. */
  1422. firstLineDecorationClassName?: string | null;
  1423. /**
  1424. * If set, the decoration will be rendered in the margin (covering its full width) with this CSS class name.
  1425. */
  1426. marginClassName?: string | null;
  1427. /**
  1428. * If set, the decoration will be rendered inline with the text with this CSS class name.
  1429. * Please use this only for CSS rules that must impact the text. For example, use `className`
  1430. * to have a background color decoration.
  1431. */
  1432. inlineClassName?: string | null;
  1433. /**
  1434. * If there is an `inlineClassName` which affects letter spacing.
  1435. */
  1436. inlineClassNameAffectsLetterSpacing?: boolean;
  1437. /**
  1438. * If set, the decoration will be rendered before the text with this CSS class name.
  1439. */
  1440. beforeContentClassName?: string | null;
  1441. /**
  1442. * If set, the decoration will be rendered after the text with this CSS class name.
  1443. */
  1444. afterContentClassName?: string | null;
  1445. /**
  1446. * If set, text will be injected in the view after the range.
  1447. */
  1448. after?: InjectedTextOptions | null;
  1449. /**
  1450. * If set, text will be injected in the view before the range.
  1451. */
  1452. before?: InjectedTextOptions | null;
  1453. }
  1454. /**
  1455. * Configures text that is injected into the view without changing the underlying document.
  1456. */
  1457. export interface InjectedTextOptions {
  1458. /**
  1459. * Sets the text to inject. Must be a single line.
  1460. */
  1461. readonly content: string;
  1462. /**
  1463. * If set, the decoration will be rendered inline with the text with this CSS class name.
  1464. */
  1465. readonly inlineClassName?: string | null;
  1466. /**
  1467. * If there is an `inlineClassName` which affects letter spacing.
  1468. */
  1469. readonly inlineClassNameAffectsLetterSpacing?: boolean;
  1470. /**
  1471. * This field allows to attach data to this injected text.
  1472. * The data can be read when injected texts at a given position are queried.
  1473. */
  1474. readonly attachedData?: unknown;
  1475. /**
  1476. * Configures cursor stops around injected text.
  1477. * Defaults to {@link InjectedTextCursorStops.Both}.
  1478. */
  1479. readonly cursorStops?: InjectedTextCursorStops | null;
  1480. }
  1481. export enum InjectedTextCursorStops {
  1482. Both = 0,
  1483. Right = 1,
  1484. Left = 2,
  1485. None = 3
  1486. }
  1487. /**
  1488. * New model decorations.
  1489. */
  1490. export interface IModelDeltaDecoration {
  1491. /**
  1492. * Range that this decoration covers.
  1493. */
  1494. range: IRange;
  1495. /**
  1496. * Options associated with this decoration.
  1497. */
  1498. options: IModelDecorationOptions;
  1499. }
  1500. /**
  1501. * A decoration in the model.
  1502. */
  1503. export interface IModelDecoration {
  1504. /**
  1505. * Identifier for a decoration.
  1506. */
  1507. readonly id: string;
  1508. /**
  1509. * Identifier for a decoration's owner.
  1510. */
  1511. readonly ownerId: number;
  1512. /**
  1513. * Range that this decoration covers.
  1514. */
  1515. readonly range: Range;
  1516. /**
  1517. * Options associated with this decoration.
  1518. */
  1519. readonly options: IModelDecorationOptions;
  1520. }
  1521. /**
  1522. * End of line character preference.
  1523. */
  1524. export enum EndOfLinePreference {
  1525. /**
  1526. * Use the end of line character identified in the text buffer.
  1527. */
  1528. TextDefined = 0,
  1529. /**
  1530. * Use line feed (\n) as the end of line character.
  1531. */
  1532. LF = 1,
  1533. /**
  1534. * Use carriage return and line feed (\r\n) as the end of line character.
  1535. */
  1536. CRLF = 2
  1537. }
  1538. /**
  1539. * The default end of line to use when instantiating models.
  1540. */
  1541. export enum DefaultEndOfLine {
  1542. /**
  1543. * Use line feed (\n) as the end of line character.
  1544. */
  1545. LF = 1,
  1546. /**
  1547. * Use carriage return and line feed (\r\n) as the end of line character.
  1548. */
  1549. CRLF = 2
  1550. }
  1551. /**
  1552. * End of line character preference.
  1553. */
  1554. export enum EndOfLineSequence {
  1555. /**
  1556. * Use line feed (\n) as the end of line character.
  1557. */
  1558. LF = 0,
  1559. /**
  1560. * Use carriage return and line feed (\r\n) as the end of line character.
  1561. */
  1562. CRLF = 1
  1563. }
  1564. /**
  1565. * A single edit operation, that has an identifier.
  1566. */
  1567. export interface IIdentifiedSingleEditOperation extends ISingleEditOperation {
  1568. }
  1569. export interface IValidEditOperation {
  1570. /**
  1571. * The range to replace. This can be empty to emulate a simple insert.
  1572. */
  1573. range: Range;
  1574. /**
  1575. * The text to replace with. This can be empty to emulate a simple delete.
  1576. */
  1577. text: string;
  1578. }
  1579. /**
  1580. * A callback that can compute the cursor state after applying a series of edit operations.
  1581. */
  1582. export interface ICursorStateComputer {
  1583. /**
  1584. * A callback that can compute the resulting cursors state after some edit operations have been executed.
  1585. */
  1586. (inverseEditOperations: IValidEditOperation[]): Selection[] | null;
  1587. }
  1588. export class TextModelResolvedOptions {
  1589. _textModelResolvedOptionsBrand: void;
  1590. readonly tabSize: number;
  1591. readonly indentSize: number;
  1592. readonly insertSpaces: boolean;
  1593. readonly defaultEOL: DefaultEndOfLine;
  1594. readonly trimAutoWhitespace: boolean;
  1595. readonly bracketPairColorizationOptions: BracketPairColorizationOptions;
  1596. }
  1597. export interface BracketPairColorizationOptions {
  1598. enabled: boolean;
  1599. }
  1600. export interface ITextModelUpdateOptions {
  1601. tabSize?: number;
  1602. indentSize?: number;
  1603. insertSpaces?: boolean;
  1604. trimAutoWhitespace?: boolean;
  1605. bracketColorizationOptions?: BracketPairColorizationOptions;
  1606. }
  1607. export class FindMatch {
  1608. _findMatchBrand: void;
  1609. readonly range: Range;
  1610. readonly matches: string[] | null;
  1611. }
  1612. /**
  1613. * Describes the behavior of decorations when typing/editing near their edges.
  1614. * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
  1615. */
  1616. export enum TrackedRangeStickiness {
  1617. AlwaysGrowsWhenTypingAtEdges = 0,
  1618. NeverGrowsWhenTypingAtEdges = 1,
  1619. GrowsOnlyWhenTypingBefore = 2,
  1620. GrowsOnlyWhenTypingAfter = 3
  1621. }
  1622. /**
  1623. * A model.
  1624. */
  1625. export interface ITextModel {
  1626. /**
  1627. * Gets the resource associated with this editor model.
  1628. */
  1629. readonly uri: Uri;
  1630. /**
  1631. * A unique identifier associated with this model.
  1632. */
  1633. readonly id: string;
  1634. /**
  1635. * Get the resolved options for this model.
  1636. */
  1637. getOptions(): TextModelResolvedOptions;
  1638. /**
  1639. * Get the current version id of the model.
  1640. * Anytime a change happens to the model (even undo/redo),
  1641. * the version id is incremented.
  1642. */
  1643. getVersionId(): number;
  1644. /**
  1645. * Get the alternative version id of the model.
  1646. * This alternative version id is not always incremented,
  1647. * it will return the same values in the case of undo-redo.
  1648. */
  1649. getAlternativeVersionId(): number;
  1650. /**
  1651. * Replace the entire text buffer value contained in this model.
  1652. */
  1653. setValue(newValue: string): void;
  1654. /**
  1655. * Get the text stored in this model.
  1656. * @param eol The end of line character preference. Defaults to `EndOfLinePreference.TextDefined`.
  1657. * @param preserverBOM Preserve a BOM character if it was detected when the model was constructed.
  1658. * @return The text.
  1659. */
  1660. getValue(eol?: EndOfLinePreference, preserveBOM?: boolean): string;
  1661. /**
  1662. * Get the length of the text stored in this model.
  1663. */
  1664. getValueLength(eol?: EndOfLinePreference, preserveBOM?: boolean): number;
  1665. /**
  1666. * Get the text in a certain range.
  1667. * @param range The range describing what text to get.
  1668. * @param eol The end of line character preference. This will only be used for multiline ranges. Defaults to `EndOfLinePreference.TextDefined`.
  1669. * @return The text.
  1670. */
  1671. getValueInRange(range: IRange, eol?: EndOfLinePreference): string;
  1672. /**
  1673. * Get the length of text in a certain range.
  1674. * @param range The range describing what text length to get.
  1675. * @return The text length.
  1676. */
  1677. getValueLengthInRange(range: IRange): number;
  1678. /**
  1679. * Get the character count of text in a certain range.
  1680. * @param range The range describing what text length to get.
  1681. */
  1682. getCharacterCountInRange(range: IRange): number;
  1683. /**
  1684. * Get the number of lines in the model.
  1685. */
  1686. getLineCount(): number;
  1687. /**
  1688. * Get the text for a certain line.
  1689. */
  1690. getLineContent(lineNumber: number): string;
  1691. /**
  1692. * Get the text length for a certain line.
  1693. */
  1694. getLineLength(lineNumber: number): number;
  1695. /**
  1696. * Get the text for all lines.
  1697. */
  1698. getLinesContent(): string[];
  1699. /**
  1700. * Get the end of line sequence predominantly used in the text buffer.
  1701. * @return EOL char sequence (e.g.: '\n' or '\r\n').
  1702. */
  1703. getEOL(): string;
  1704. /**
  1705. * Get the end of line sequence predominantly used in the text buffer.
  1706. */
  1707. getEndOfLineSequence(): EndOfLineSequence;
  1708. /**
  1709. * Get the minimum legal column for line at `lineNumber`
  1710. */
  1711. getLineMinColumn(lineNumber: number): number;
  1712. /**
  1713. * Get the maximum legal column for line at `lineNumber`
  1714. */
  1715. getLineMaxColumn(lineNumber: number): number;
  1716. /**
  1717. * Returns the column before the first non whitespace character for line at `lineNumber`.
  1718. * Returns 0 if line is empty or contains only whitespace.
  1719. */
  1720. getLineFirstNonWhitespaceColumn(lineNumber: number): number;
  1721. /**
  1722. * Returns the column after the last non whitespace character for line at `lineNumber`.
  1723. * Returns 0 if line is empty or contains only whitespace.
  1724. */
  1725. getLineLastNonWhitespaceColumn(lineNumber: number): number;
  1726. /**
  1727. * Create a valid position.
  1728. */
  1729. validatePosition(position: IPosition): Position;
  1730. /**
  1731. * Advances the given position by the given offset (negative offsets are also accepted)
  1732. * and returns it as a new valid position.
  1733. *
  1734. * If the offset and position are such that their combination goes beyond the beginning or
  1735. * end of the model, throws an exception.
  1736. *
  1737. * If the offset is such that the new position would be in the middle of a multi-byte
  1738. * line terminator, throws an exception.
  1739. */
  1740. modifyPosition(position: IPosition, offset: number): Position;
  1741. /**
  1742. * Create a valid range.
  1743. */
  1744. validateRange(range: IRange): Range;
  1745. /**
  1746. * Converts the position to a zero-based offset.
  1747. *
  1748. * The position will be [adjusted](#TextDocument.validatePosition).
  1749. *
  1750. * @param position A position.
  1751. * @return A valid zero-based offset.
  1752. */
  1753. getOffsetAt(position: IPosition): number;
  1754. /**
  1755. * Converts a zero-based offset to a position.
  1756. *
  1757. * @param offset A zero-based offset.
  1758. * @return A valid [position](#Position).
  1759. */
  1760. getPositionAt(offset: number): Position;
  1761. /**
  1762. * Get a range covering the entire model.
  1763. */
  1764. getFullModelRange(): Range;
  1765. /**
  1766. * Returns if the model was disposed or not.
  1767. */
  1768. isDisposed(): boolean;
  1769. /**
  1770. * Search the model.
  1771. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
  1772. * @param searchOnlyEditableRange Limit the searching to only search inside the editable range of the model.
  1773. * @param isRegex Used to indicate that `searchString` is a regular expression.
  1774. * @param matchCase Force the matching to match lower/upper case exactly.
  1775. * @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
  1776. * @param captureMatches The result will contain the captured groups.
  1777. * @param limitResultCount Limit the number of results
  1778. * @return The ranges where the matches are. It is empty if not matches have been found.
  1779. */
  1780. findMatches(searchString: string, searchOnlyEditableRange: boolean, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount?: number): FindMatch[];
  1781. /**
  1782. * Search the model.
  1783. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
  1784. * @param searchScope Limit the searching to only search inside these ranges.
  1785. * @param isRegex Used to indicate that `searchString` is a regular expression.
  1786. * @param matchCase Force the matching to match lower/upper case exactly.
  1787. * @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
  1788. * @param captureMatches The result will contain the captured groups.
  1789. * @param limitResultCount Limit the number of results
  1790. * @return The ranges where the matches are. It is empty if no matches have been found.
  1791. */
  1792. findMatches(searchString: string, searchScope: IRange | IRange[], isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount?: number): FindMatch[];
  1793. /**
  1794. * Search the model for the next match. Loops to the beginning of the model if needed.
  1795. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
  1796. * @param searchStart Start the searching at the specified position.
  1797. * @param isRegex Used to indicate that `searchString` is a regular expression.
  1798. * @param matchCase Force the matching to match lower/upper case exactly.
  1799. * @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
  1800. * @param captureMatches The result will contain the captured groups.
  1801. * @return The range where the next match is. It is null if no next match has been found.
  1802. */
  1803. findNextMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch | null;
  1804. /**
  1805. * Search the model for the previous match. Loops to the end of the model if needed.
  1806. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
  1807. * @param searchStart Start the searching at the specified position.
  1808. * @param isRegex Used to indicate that `searchString` is a regular expression.
  1809. * @param matchCase Force the matching to match lower/upper case exactly.
  1810. * @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
  1811. * @param captureMatches The result will contain the captured groups.
  1812. * @return The range where the previous match is. It is null if no previous match has been found.
  1813. */
  1814. findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch | null;
  1815. /**
  1816. * Get the language associated with this model.
  1817. */
  1818. getLanguageId(): string;
  1819. /**
  1820. * Get the word under or besides `position`.
  1821. * @param position The position to look for a word.
  1822. * @return The word under or besides `position`. Might be null.
  1823. */
  1824. getWordAtPosition(position: IPosition): IWordAtPosition | null;
  1825. /**
  1826. * Get the word under or besides `position` trimmed to `position`.column
  1827. * @param position The position to look for a word.
  1828. * @return The word under or besides `position`. Will never be null.
  1829. */
  1830. getWordUntilPosition(position: IPosition): IWordAtPosition;
  1831. /**
  1832. * Perform a minimum amount of operations, in order to transform the decorations
  1833. * identified by `oldDecorations` to the decorations described by `newDecorations`
  1834. * and returns the new identifiers associated with the resulting decorations.
  1835. *
  1836. * @param oldDecorations Array containing previous decorations identifiers.
  1837. * @param newDecorations Array describing what decorations should result after the call.
  1838. * @param ownerId Identifies the editor id in which these decorations should appear. If no `ownerId` is provided, the decorations will appear in all editors that attach this model.
  1839. * @return An array containing the new decorations identifiers.
  1840. */
  1841. deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[], ownerId?: number): string[];
  1842. /**
  1843. * Get the options associated with a decoration.
  1844. * @param id The decoration id.
  1845. * @return The decoration options or null if the decoration was not found.
  1846. */
  1847. getDecorationOptions(id: string): IModelDecorationOptions | null;
  1848. /**
  1849. * Get the range associated with a decoration.
  1850. * @param id The decoration id.
  1851. * @return The decoration range or null if the decoration was not found.
  1852. */
  1853. getDecorationRange(id: string): Range | null;
  1854. /**
  1855. * Gets all the decorations for the line `lineNumber` as an array.
  1856. * @param lineNumber The line number
  1857. * @param ownerId If set, it will ignore decorations belonging to other owners.
  1858. * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
  1859. * @return An array with the decorations
  1860. */
  1861. getLineDecorations(lineNumber: number, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
  1862. /**
  1863. * Gets all the decorations for the lines between `startLineNumber` and `endLineNumber` as an array.
  1864. * @param startLineNumber The start line number
  1865. * @param endLineNumber The end line number
  1866. * @param ownerId If set, it will ignore decorations belonging to other owners.
  1867. * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
  1868. * @return An array with the decorations
  1869. */
  1870. getLinesDecorations(startLineNumber: number, endLineNumber: number, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
  1871. /**
  1872. * Gets all the decorations in a range as an array. Only `startLineNumber` and `endLineNumber` from `range` are used for filtering.
  1873. * So for now it returns all the decorations on the same line as `range`.
  1874. * @param range The range to search in
  1875. * @param ownerId If set, it will ignore decorations belonging to other owners.
  1876. * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
  1877. * @return An array with the decorations
  1878. */
  1879. getDecorationsInRange(range: IRange, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
  1880. /**
  1881. * Gets all the decorations as an array.
  1882. * @param ownerId If set, it will ignore decorations belonging to other owners.
  1883. * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
  1884. */
  1885. getAllDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
  1886. /**
  1887. * Gets all the decorations that should be rendered in the overview ruler as an array.
  1888. * @param ownerId If set, it will ignore decorations belonging to other owners.
  1889. * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
  1890. */
  1891. getOverviewRulerDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
  1892. /**
  1893. * Gets all the decorations that contain injected text.
  1894. * @param ownerId If set, it will ignore decorations belonging to other owners.
  1895. */
  1896. getInjectedTextDecorations(ownerId?: number): IModelDecoration[];
  1897. /**
  1898. * Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs).
  1899. */
  1900. normalizeIndentation(str: string): string;
  1901. /**
  1902. * Change the options of this model.
  1903. */
  1904. updateOptions(newOpts: ITextModelUpdateOptions): void;
  1905. /**
  1906. * Detect the indentation options for this model from its content.
  1907. */
  1908. detectIndentation(defaultInsertSpaces: boolean, defaultTabSize: number): void;
  1909. /**
  1910. * Close the current undo-redo element.
  1911. * This offers a way to create an undo/redo stop point.
  1912. */
  1913. pushStackElement(): void;
  1914. /**
  1915. * Open the current undo-redo element.
  1916. * This offers a way to remove the current undo/redo stop point.
  1917. */
  1918. popStackElement(): void;
  1919. /**
  1920. * Push edit operations, basically editing the model. This is the preferred way
  1921. * of editing the model. The edit operations will land on the undo stack.
  1922. * @param beforeCursorState The cursor state before the edit operations. This cursor state will be returned when `undo` or `redo` are invoked.
  1923. * @param editOperations The edit operations.
  1924. * @param cursorStateComputer A callback that can compute the resulting cursors state after the edit operations have been executed.
  1925. * @return The cursor state returned by the `cursorStateComputer`.
  1926. */
  1927. pushEditOperations(beforeCursorState: Selection[] | null, editOperations: IIdentifiedSingleEditOperation[], cursorStateComputer: ICursorStateComputer): Selection[] | null;
  1928. /**
  1929. * Change the end of line sequence. This is the preferred way of
  1930. * changing the eol sequence. This will land on the undo stack.
  1931. */
  1932. pushEOL(eol: EndOfLineSequence): void;
  1933. /**
  1934. * Edit the model without adding the edits to the undo stack.
  1935. * This can have dire consequences on the undo stack! See @pushEditOperations for the preferred way.
  1936. * @param operations The edit operations.
  1937. * @return If desired, the inverse edit operations, that, when applied, will bring the model back to the previous state.
  1938. */
  1939. applyEdits(operations: IIdentifiedSingleEditOperation[]): void;
  1940. applyEdits(operations: IIdentifiedSingleEditOperation[], computeUndoEdits: false): void;
  1941. applyEdits(operations: IIdentifiedSingleEditOperation[], computeUndoEdits: true): IValidEditOperation[];
  1942. /**
  1943. * Change the end of line sequence without recording in the undo stack.
  1944. * This can have dire consequences on the undo stack! See @pushEOL for the preferred way.
  1945. */
  1946. setEOL(eol: EndOfLineSequence): void;
  1947. /**
  1948. * An event emitted when the contents of the model have changed.
  1949. * @event
  1950. */
  1951. onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable;
  1952. /**
  1953. * An event emitted when decorations of the model have changed.
  1954. * @event
  1955. */
  1956. readonly onDidChangeDecorations: IEvent<IModelDecorationsChangedEvent>;
  1957. /**
  1958. * An event emitted when the model options have changed.
  1959. * @event
  1960. */
  1961. readonly onDidChangeOptions: IEvent<IModelOptionsChangedEvent>;
  1962. /**
  1963. * An event emitted when the language associated with the model has changed.
  1964. * @event
  1965. */
  1966. readonly onDidChangeLanguage: IEvent<IModelLanguageChangedEvent>;
  1967. /**
  1968. * An event emitted when the language configuration associated with the model has changed.
  1969. * @event
  1970. */
  1971. readonly onDidChangeLanguageConfiguration: IEvent<IModelLanguageConfigurationChangedEvent>;
  1972. /**
  1973. * An event emitted when the model has been attached to the first editor or detached from the last editor.
  1974. * @event
  1975. */
  1976. readonly onDidChangeAttached: IEvent<void>;
  1977. /**
  1978. * An event emitted right before disposing the model.
  1979. * @event
  1980. */
  1981. readonly onWillDispose: IEvent<void>;
  1982. /**
  1983. * Destroy this model.
  1984. */
  1985. dispose(): void;
  1986. /**
  1987. * Returns if this model is attached to an editor or not.
  1988. */
  1989. isAttachedToEditor(): boolean;
  1990. }
  1991. export enum PositionAffinity {
  1992. /**
  1993. * Prefers the left most position.
  1994. */
  1995. Left = 0,
  1996. /**
  1997. * Prefers the right most position.
  1998. */
  1999. Right = 1,
  2000. /**
  2001. * No preference.
  2002. */
  2003. None = 2
  2004. }
  2005. /**
  2006. * A change
  2007. */
  2008. export interface IChange {
  2009. readonly originalStartLineNumber: number;
  2010. readonly originalEndLineNumber: number;
  2011. readonly modifiedStartLineNumber: number;
  2012. readonly modifiedEndLineNumber: number;
  2013. }
  2014. /**
  2015. * A character level change.
  2016. */
  2017. export interface ICharChange extends IChange {
  2018. readonly originalStartColumn: number;
  2019. readonly originalEndColumn: number;
  2020. readonly modifiedStartColumn: number;
  2021. readonly modifiedEndColumn: number;
  2022. }
  2023. /**
  2024. * A line change
  2025. */
  2026. export interface ILineChange extends IChange {
  2027. readonly charChanges: ICharChange[] | undefined;
  2028. }
  2029. export interface IDimension {
  2030. width: number;
  2031. height: number;
  2032. }
  2033. /**
  2034. * A builder and helper for edit operations for a command.
  2035. */
  2036. export interface IEditOperationBuilder {
  2037. /**
  2038. * Add a new edit operation (a replace operation).
  2039. * @param range The range to replace (delete). May be empty to represent a simple insert.
  2040. * @param text The text to replace with. May be null to represent a simple delete.
  2041. */
  2042. addEditOperation(range: IRange, text: string | null, forceMoveMarkers?: boolean): void;
  2043. /**
  2044. * Add a new edit operation (a replace operation).
  2045. * The inverse edits will be accessible in `ICursorStateComputerData.getInverseEditOperations()`
  2046. * @param range The range to replace (delete). May be empty to represent a simple insert.
  2047. * @param text The text to replace with. May be null to represent a simple delete.
  2048. */
  2049. addTrackedEditOperation(range: IRange, text: string | null, forceMoveMarkers?: boolean): void;
  2050. /**
  2051. * Track `selection` when applying edit operations.
  2052. * A best effort will be made to not grow/expand the selection.
  2053. * An empty selection will clamp to a nearby character.
  2054. * @param selection The selection to track.
  2055. * @param trackPreviousOnEmpty If set, and the selection is empty, indicates whether the selection
  2056. * should clamp to the previous or the next character.
  2057. * @return A unique identifier.
  2058. */
  2059. trackSelection(selection: Selection, trackPreviousOnEmpty?: boolean): string;
  2060. }
  2061. /**
  2062. * A helper for computing cursor state after a command.
  2063. */
  2064. export interface ICursorStateComputerData {
  2065. /**
  2066. * Get the inverse edit operations of the added edit operations.
  2067. */
  2068. getInverseEditOperations(): IValidEditOperation[];
  2069. /**
  2070. * Get a previously tracked selection.
  2071. * @param id The unique identifier returned by `trackSelection`.
  2072. * @return The selection.
  2073. */
  2074. getTrackedSelection(id: string): Selection;
  2075. }
  2076. /**
  2077. * A command that modifies text / cursor state on a model.
  2078. */
  2079. export interface ICommand {
  2080. /**
  2081. * Get the edit operations needed to execute this command.
  2082. * @param model The model the command will execute on.
  2083. * @param builder A helper to collect the needed edit operations and to track selections.
  2084. */
  2085. getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void;
  2086. /**
  2087. * Compute the cursor state after the edit operations were applied.
  2088. * @param model The model the command has executed on.
  2089. * @param helper A helper to get inverse edit operations and to get previously tracked selections.
  2090. * @return The cursor state after the command executed.
  2091. */
  2092. computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection;
  2093. }
  2094. /**
  2095. * A model for the diff editor.
  2096. */
  2097. export interface IDiffEditorModel {
  2098. /**
  2099. * Original model.
  2100. */
  2101. original: ITextModel;
  2102. /**
  2103. * Modified model.
  2104. */
  2105. modified: ITextModel;
  2106. }
  2107. /**
  2108. * An event describing that an editor has had its model reset (i.e. `editor.setModel()`).
  2109. */
  2110. export interface IModelChangedEvent {
  2111. /**
  2112. * The `uri` of the previous model or null.
  2113. */
  2114. readonly oldModelUrl: Uri | null;
  2115. /**
  2116. * The `uri` of the new model or null.
  2117. */
  2118. readonly newModelUrl: Uri | null;
  2119. }
  2120. export interface IContentSizeChangedEvent {
  2121. readonly contentWidth: number;
  2122. readonly contentHeight: number;
  2123. readonly contentWidthChanged: boolean;
  2124. readonly contentHeightChanged: boolean;
  2125. }
  2126. export interface INewScrollPosition {
  2127. scrollLeft?: number;
  2128. scrollTop?: number;
  2129. }
  2130. export interface IEditorAction {
  2131. readonly id: string;
  2132. readonly label: string;
  2133. readonly alias: string;
  2134. isSupported(): boolean;
  2135. run(): Promise<void>;
  2136. }
  2137. export type IEditorModel = ITextModel | IDiffEditorModel;
  2138. /**
  2139. * A (serializable) state of the cursors.
  2140. */
  2141. export interface ICursorState {
  2142. inSelectionMode: boolean;
  2143. selectionStart: IPosition;
  2144. position: IPosition;
  2145. }
  2146. /**
  2147. * A (serializable) state of the view.
  2148. */
  2149. export interface IViewState {
  2150. /** written by previous versions */
  2151. scrollTop?: number;
  2152. /** written by previous versions */
  2153. scrollTopWithoutViewZones?: number;
  2154. scrollLeft: number;
  2155. firstPosition: IPosition;
  2156. firstPositionDeltaTop: number;
  2157. }
  2158. /**
  2159. * A (serializable) state of the code editor.
  2160. */
  2161. export interface ICodeEditorViewState {
  2162. cursorState: ICursorState[];
  2163. viewState: IViewState;
  2164. contributionsState: {
  2165. [id: string]: any;
  2166. };
  2167. }
  2168. /**
  2169. * (Serializable) View state for the diff editor.
  2170. */
  2171. export interface IDiffEditorViewState {
  2172. original: ICodeEditorViewState | null;
  2173. modified: ICodeEditorViewState | null;
  2174. }
  2175. /**
  2176. * An editor view state.
  2177. */
  2178. export type IEditorViewState = ICodeEditorViewState | IDiffEditorViewState;
  2179. export enum ScrollType {
  2180. Smooth = 0,
  2181. Immediate = 1
  2182. }
  2183. /**
  2184. * An editor.
  2185. */
  2186. export interface IEditor {
  2187. /**
  2188. * An event emitted when the editor has been disposed.
  2189. * @event
  2190. */
  2191. onDidDispose(listener: () => void): IDisposable;
  2192. /**
  2193. * Dispose the editor.
  2194. */
  2195. dispose(): void;
  2196. /**
  2197. * Get a unique id for this editor instance.
  2198. */
  2199. getId(): string;
  2200. /**
  2201. * Get the editor type. Please see `EditorType`.
  2202. * This is to avoid an instanceof check
  2203. */
  2204. getEditorType(): string;
  2205. /**
  2206. * Update the editor's options after the editor has been created.
  2207. */
  2208. updateOptions(newOptions: IEditorOptions): void;
  2209. /**
  2210. * Instructs the editor to remeasure its container. This method should
  2211. * be called when the container of the editor gets resized.
  2212. *
  2213. * If a dimension is passed in, the passed in value will be used.
  2214. */
  2215. layout(dimension?: IDimension): void;
  2216. /**
  2217. * Brings browser focus to the editor text
  2218. */
  2219. focus(): void;
  2220. /**
  2221. * Returns true if the text inside this editor is focused (i.e. cursor is blinking).
  2222. */
  2223. hasTextFocus(): boolean;
  2224. /**
  2225. * Returns all actions associated with this editor.
  2226. */
  2227. getSupportedActions(): IEditorAction[];
  2228. /**
  2229. * Saves current view state of the editor in a serializable object.
  2230. */
  2231. saveViewState(): IEditorViewState | null;
  2232. /**
  2233. * Restores the view state of the editor from a serializable object generated by `saveViewState`.
  2234. */
  2235. restoreViewState(state: IEditorViewState): void;
  2236. /**
  2237. * Given a position, returns a column number that takes tab-widths into account.
  2238. */
  2239. getVisibleColumnFromPosition(position: IPosition): number;
  2240. /**
  2241. * Returns the primary position of the cursor.
  2242. */
  2243. getPosition(): Position | null;
  2244. /**
  2245. * Set the primary position of the cursor. This will remove any secondary cursors.
  2246. * @param position New primary cursor's position
  2247. * @param source Source of the call that caused the position
  2248. */
  2249. setPosition(position: IPosition, source?: string): void;
  2250. /**
  2251. * Scroll vertically as necessary and reveal a line.
  2252. */
  2253. revealLine(lineNumber: number, scrollType?: ScrollType): void;
  2254. /**
  2255. * Scroll vertically as necessary and reveal a line centered vertically.
  2256. */
  2257. revealLineInCenter(lineNumber: number, scrollType?: ScrollType): void;
  2258. /**
  2259. * Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport.
  2260. */
  2261. revealLineInCenterIfOutsideViewport(lineNumber: number, scrollType?: ScrollType): void;
  2262. /**
  2263. * Scroll vertically as necessary and reveal a line close to the top of the viewport,
  2264. * optimized for viewing a code definition.
  2265. */
  2266. revealLineNearTop(lineNumber: number, scrollType?: ScrollType): void;
  2267. /**
  2268. * Scroll vertically or horizontally as necessary and reveal a position.
  2269. */
  2270. revealPosition(position: IPosition, scrollType?: ScrollType): void;
  2271. /**
  2272. * Scroll vertically or horizontally as necessary and reveal a position centered vertically.
  2273. */
  2274. revealPositionInCenter(position: IPosition, scrollType?: ScrollType): void;
  2275. /**
  2276. * Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport.
  2277. */
  2278. revealPositionInCenterIfOutsideViewport(position: IPosition, scrollType?: ScrollType): void;
  2279. /**
  2280. * Scroll vertically or horizontally as necessary and reveal a position close to the top of the viewport,
  2281. * optimized for viewing a code definition.
  2282. */
  2283. revealPositionNearTop(position: IPosition, scrollType?: ScrollType): void;
  2284. /**
  2285. * Returns the primary selection of the editor.
  2286. */
  2287. getSelection(): Selection | null;
  2288. /**
  2289. * Returns all the selections of the editor.
  2290. */
  2291. getSelections(): Selection[] | null;
  2292. /**
  2293. * Set the primary selection of the editor. This will remove any secondary cursors.
  2294. * @param selection The new selection
  2295. * @param source Source of the call that caused the selection
  2296. */
  2297. setSelection(selection: IRange, source?: string): void;
  2298. /**
  2299. * Set the primary selection of the editor. This will remove any secondary cursors.
  2300. * @param selection The new selection
  2301. * @param source Source of the call that caused the selection
  2302. */
  2303. setSelection(selection: Range, source?: string): void;
  2304. /**
  2305. * Set the primary selection of the editor. This will remove any secondary cursors.
  2306. * @param selection The new selection
  2307. * @param source Source of the call that caused the selection
  2308. */
  2309. setSelection(selection: ISelection, source?: string): void;
  2310. /**
  2311. * Set the primary selection of the editor. This will remove any secondary cursors.
  2312. * @param selection The new selection
  2313. * @param source Source of the call that caused the selection
  2314. */
  2315. setSelection(selection: Selection, source?: string): void;
  2316. /**
  2317. * Set the selections for all the cursors of the editor.
  2318. * Cursors will be removed or added, as necessary.
  2319. * @param selections The new selection
  2320. * @param source Source of the call that caused the selection
  2321. */
  2322. setSelections(selections: readonly ISelection[], source?: string): void;
  2323. /**
  2324. * Scroll vertically as necessary and reveal lines.
  2325. */
  2326. revealLines(startLineNumber: number, endLineNumber: number, scrollType?: ScrollType): void;
  2327. /**
  2328. * Scroll vertically as necessary and reveal lines centered vertically.
  2329. */
  2330. revealLinesInCenter(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void;
  2331. /**
  2332. * Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport.
  2333. */
  2334. revealLinesInCenterIfOutsideViewport(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void;
  2335. /**
  2336. * Scroll vertically as necessary and reveal lines close to the top of the viewport,
  2337. * optimized for viewing a code definition.
  2338. */
  2339. revealLinesNearTop(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void;
  2340. /**
  2341. * Scroll vertically or horizontally as necessary and reveal a range.
  2342. */
  2343. revealRange(range: IRange, scrollType?: ScrollType): void;
  2344. /**
  2345. * Scroll vertically or horizontally as necessary and reveal a range centered vertically.
  2346. */
  2347. revealRangeInCenter(range: IRange, scrollType?: ScrollType): void;
  2348. /**
  2349. * Scroll vertically or horizontally as necessary and reveal a range at the top of the viewport.
  2350. */
  2351. revealRangeAtTop(range: IRange, scrollType?: ScrollType): void;
  2352. /**
  2353. * Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.
  2354. */
  2355. revealRangeInCenterIfOutsideViewport(range: IRange, scrollType?: ScrollType): void;
  2356. /**
  2357. * Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport,
  2358. * optimized for viewing a code definition.
  2359. */
  2360. revealRangeNearTop(range: IRange, scrollType?: ScrollType): void;
  2361. /**
  2362. * Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport,
  2363. * optimized for viewing a code definition. Only if it lies outside the viewport.
  2364. */
  2365. revealRangeNearTopIfOutsideViewport(range: IRange, scrollType?: ScrollType): void;
  2366. /**
  2367. * Directly trigger a handler or an editor action.
  2368. * @param source The source of the call.
  2369. * @param handlerId The id of the handler or the id of a contribution.
  2370. * @param payload Extra data to be sent to the handler.
  2371. */
  2372. trigger(source: string | null | undefined, handlerId: string, payload: any): void;
  2373. /**
  2374. * Gets the current model attached to this editor.
  2375. */
  2376. getModel(): IEditorModel | null;
  2377. /**
  2378. * Sets the current model attached to this editor.
  2379. * If the previous model was created by the editor via the value key in the options
  2380. * literal object, it will be destroyed. Otherwise, if the previous model was set
  2381. * via setModel, or the model key in the options literal object, the previous model
  2382. * will not be destroyed.
  2383. * It is safe to call setModel(null) to simply detach the current model from the editor.
  2384. */
  2385. setModel(model: IEditorModel | null): void;
  2386. }
  2387. /**
  2388. * An editor contribution that gets created every time a new editor gets created and gets disposed when the editor gets disposed.
  2389. */
  2390. export interface IEditorContribution {
  2391. /**
  2392. * Dispose this contribution.
  2393. */
  2394. dispose(): void;
  2395. /**
  2396. * Store view state.
  2397. */
  2398. saveViewState?(): any;
  2399. /**
  2400. * Restore view state.
  2401. */
  2402. restoreViewState?(state: any): void;
  2403. }
  2404. /**
  2405. * The type of the `IEditor`.
  2406. */
  2407. export const EditorType: {
  2408. ICodeEditor: string;
  2409. IDiffEditor: string;
  2410. };
  2411. /**
  2412. * An event describing that the current language associated with a model has changed.
  2413. */
  2414. export interface IModelLanguageChangedEvent {
  2415. /**
  2416. * Previous language
  2417. */
  2418. readonly oldLanguage: string;
  2419. /**
  2420. * New language
  2421. */
  2422. readonly newLanguage: string;
  2423. }
  2424. /**
  2425. * An event describing that the language configuration associated with a model has changed.
  2426. */
  2427. export interface IModelLanguageConfigurationChangedEvent {
  2428. }
  2429. export interface IModelContentChange {
  2430. /**
  2431. * The range that got replaced.
  2432. */
  2433. readonly range: IRange;
  2434. /**
  2435. * The offset of the range that got replaced.
  2436. */
  2437. readonly rangeOffset: number;
  2438. /**
  2439. * The length of the range that got replaced.
  2440. */
  2441. readonly rangeLength: number;
  2442. /**
  2443. * The new text for the range.
  2444. */
  2445. readonly text: string;
  2446. }
  2447. /**
  2448. * An event describing a change in the text of a model.
  2449. */
  2450. export interface IModelContentChangedEvent {
  2451. readonly changes: IModelContentChange[];
  2452. /**
  2453. * The (new) end-of-line character.
  2454. */
  2455. readonly eol: string;
  2456. /**
  2457. * The new version id the model has transitioned to.
  2458. */
  2459. readonly versionId: number;
  2460. /**
  2461. * Flag that indicates that this event was generated while undoing.
  2462. */
  2463. readonly isUndoing: boolean;
  2464. /**
  2465. * Flag that indicates that this event was generated while redoing.
  2466. */
  2467. readonly isRedoing: boolean;
  2468. /**
  2469. * Flag that indicates that all decorations were lost with this edit.
  2470. * The model has been reset to a new value.
  2471. */
  2472. readonly isFlush: boolean;
  2473. }
  2474. /**
  2475. * An event describing that model decorations have changed.
  2476. */
  2477. export interface IModelDecorationsChangedEvent {
  2478. readonly affectsMinimap: boolean;
  2479. readonly affectsOverviewRuler: boolean;
  2480. }
  2481. export interface IModelOptionsChangedEvent {
  2482. readonly tabSize: boolean;
  2483. readonly indentSize: boolean;
  2484. readonly insertSpaces: boolean;
  2485. readonly trimAutoWhitespace: boolean;
  2486. }
  2487. /**
  2488. * Describes the reason the cursor has changed its position.
  2489. */
  2490. export enum CursorChangeReason {
  2491. /**
  2492. * Unknown or not set.
  2493. */
  2494. NotSet = 0,
  2495. /**
  2496. * A `model.setValue()` was called.
  2497. */
  2498. ContentFlush = 1,
  2499. /**
  2500. * The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers.
  2501. */
  2502. RecoverFromMarkers = 2,
  2503. /**
  2504. * There was an explicit user gesture.
  2505. */
  2506. Explicit = 3,
  2507. /**
  2508. * There was a Paste.
  2509. */
  2510. Paste = 4,
  2511. /**
  2512. * There was an Undo.
  2513. */
  2514. Undo = 5,
  2515. /**
  2516. * There was a Redo.
  2517. */
  2518. Redo = 6
  2519. }
  2520. /**
  2521. * An event describing that the cursor position has changed.
  2522. */
  2523. export interface ICursorPositionChangedEvent {
  2524. /**
  2525. * Primary cursor's position.
  2526. */
  2527. readonly position: Position;
  2528. /**
  2529. * Secondary cursors' position.
  2530. */
  2531. readonly secondaryPositions: Position[];
  2532. /**
  2533. * Reason.
  2534. */
  2535. readonly reason: CursorChangeReason;
  2536. /**
  2537. * Source of the call that caused the event.
  2538. */
  2539. readonly source: string;
  2540. }
  2541. /**
  2542. * An event describing that the cursor selection has changed.
  2543. */
  2544. export interface ICursorSelectionChangedEvent {
  2545. /**
  2546. * The primary selection.
  2547. */
  2548. readonly selection: Selection;
  2549. /**
  2550. * The secondary selections.
  2551. */
  2552. readonly secondarySelections: Selection[];
  2553. /**
  2554. * The model version id.
  2555. */
  2556. readonly modelVersionId: number;
  2557. /**
  2558. * The old selections.
  2559. */
  2560. readonly oldSelections: Selection[] | null;
  2561. /**
  2562. * The model version id the that `oldSelections` refer to.
  2563. */
  2564. readonly oldModelVersionId: number;
  2565. /**
  2566. * Source of the call that caused the event.
  2567. */
  2568. readonly source: string;
  2569. /**
  2570. * Reason.
  2571. */
  2572. readonly reason: CursorChangeReason;
  2573. }
  2574. export enum AccessibilitySupport {
  2575. /**
  2576. * This should be the browser case where it is not known if a screen reader is attached or no.
  2577. */
  2578. Unknown = 0,
  2579. Disabled = 1,
  2580. Enabled = 2
  2581. }
  2582. /**
  2583. * Configuration options for auto closing quotes and brackets
  2584. */
  2585. export type EditorAutoClosingStrategy = 'always' | 'languageDefined' | 'beforeWhitespace' | 'never';
  2586. /**
  2587. * Configuration options for auto wrapping quotes and brackets
  2588. */
  2589. export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never';
  2590. /**
  2591. * Configuration options for typing over closing quotes or brackets
  2592. */
  2593. export type EditorAutoClosingEditStrategy = 'always' | 'auto' | 'never';
  2594. /**
  2595. * Configuration options for auto indentation in the editor
  2596. */
  2597. export enum EditorAutoIndentStrategy {
  2598. None = 0,
  2599. Keep = 1,
  2600. Brackets = 2,
  2601. Advanced = 3,
  2602. Full = 4
  2603. }
  2604. /**
  2605. * Configuration options for the editor.
  2606. */
  2607. export interface IEditorOptions {
  2608. /**
  2609. * This editor is used inside a diff editor.
  2610. */
  2611. inDiffEditor?: boolean;
  2612. /**
  2613. * The aria label for the editor's textarea (when it is focused).
  2614. */
  2615. ariaLabel?: string;
  2616. /**
  2617. * The `tabindex` property of the editor's textarea
  2618. */
  2619. tabIndex?: number;
  2620. /**
  2621. * Render vertical lines at the specified columns.
  2622. * Defaults to empty array.
  2623. */
  2624. rulers?: (number | IRulerOption)[];
  2625. /**
  2626. * A string containing the word separators used when doing word navigation.
  2627. * Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?
  2628. */
  2629. wordSeparators?: string;
  2630. /**
  2631. * Enable Linux primary clipboard.
  2632. * Defaults to true.
  2633. */
  2634. selectionClipboard?: boolean;
  2635. /**
  2636. * Control the rendering of line numbers.
  2637. * If it is a function, it will be invoked when rendering a line number and the return value will be rendered.
  2638. * Otherwise, if it is a truthy, line numbers will be rendered normally (equivalent of using an identity function).
  2639. * Otherwise, line numbers will not be rendered.
  2640. * Defaults to `on`.
  2641. */
  2642. lineNumbers?: LineNumbersType;
  2643. /**
  2644. * Controls the minimal number of visible leading and trailing lines surrounding the cursor.
  2645. * Defaults to 0.
  2646. */
  2647. cursorSurroundingLines?: number;
  2648. /**
  2649. * Controls when `cursorSurroundingLines` should be enforced
  2650. * Defaults to `default`, `cursorSurroundingLines` is not enforced when cursor position is changed
  2651. * by mouse.
  2652. */
  2653. cursorSurroundingLinesStyle?: 'default' | 'all';
  2654. /**
  2655. * Render last line number when the file ends with a newline.
  2656. * Defaults to true.
  2657. */
  2658. renderFinalNewline?: boolean;
  2659. /**
  2660. * Remove unusual line terminators like LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS).
  2661. * Defaults to 'prompt'.
  2662. */
  2663. unusualLineTerminators?: 'auto' | 'off' | 'prompt';
  2664. /**
  2665. * Should the corresponding line be selected when clicking on the line number?
  2666. * Defaults to true.
  2667. */
  2668. selectOnLineNumbers?: boolean;
  2669. /**
  2670. * Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits.
  2671. * Defaults to 5.
  2672. */
  2673. lineNumbersMinChars?: number;
  2674. /**
  2675. * Enable the rendering of the glyph margin.
  2676. * Defaults to true in vscode and to false in monaco-editor.
  2677. */
  2678. glyphMargin?: boolean;
  2679. /**
  2680. * The width reserved for line decorations (in px).
  2681. * Line decorations are placed between line numbers and the editor content.
  2682. * You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch.
  2683. * Defaults to 10.
  2684. */
  2685. lineDecorationsWidth?: number | string;
  2686. /**
  2687. * When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle.
  2688. * This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport.
  2689. * Defaults to 30 (px).
  2690. */
  2691. revealHorizontalRightPadding?: number;
  2692. /**
  2693. * Render the editor selection with rounded borders.
  2694. * Defaults to true.
  2695. */
  2696. roundedSelection?: boolean;
  2697. /**
  2698. * Class name to be added to the editor.
  2699. */
  2700. extraEditorClassName?: string;
  2701. /**
  2702. * Should the editor be read only. See also `domReadOnly`.
  2703. * Defaults to false.
  2704. */
  2705. readOnly?: boolean;
  2706. /**
  2707. * Should the textarea used for input use the DOM `readonly` attribute.
  2708. * Defaults to false.
  2709. */
  2710. domReadOnly?: boolean;
  2711. /**
  2712. * Enable linked editing.
  2713. * Defaults to false.
  2714. */
  2715. linkedEditing?: boolean;
  2716. /**
  2717. * deprecated, use linkedEditing instead
  2718. */
  2719. renameOnType?: boolean;
  2720. /**
  2721. * Should the editor render validation decorations.
  2722. * Defaults to editable.
  2723. */
  2724. renderValidationDecorations?: 'editable' | 'on' | 'off';
  2725. /**
  2726. * Control the behavior and rendering of the scrollbars.
  2727. */
  2728. scrollbar?: IEditorScrollbarOptions;
  2729. /**
  2730. * Control the behavior and rendering of the minimap.
  2731. */
  2732. minimap?: IEditorMinimapOptions;
  2733. /**
  2734. * Control the behavior of the find widget.
  2735. */
  2736. find?: IEditorFindOptions;
  2737. /**
  2738. * Display overflow widgets as `fixed`.
  2739. * Defaults to `false`.
  2740. */
  2741. fixedOverflowWidgets?: boolean;
  2742. /**
  2743. * The number of vertical lanes the overview ruler should render.
  2744. * Defaults to 3.
  2745. */
  2746. overviewRulerLanes?: number;
  2747. /**
  2748. * Controls if a border should be drawn around the overview ruler.
  2749. * Defaults to `true`.
  2750. */
  2751. overviewRulerBorder?: boolean;
  2752. /**
  2753. * Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'.
  2754. * Defaults to 'blink'.
  2755. */
  2756. cursorBlinking?: 'blink' | 'smooth' | 'phase' | 'expand' | 'solid';
  2757. /**
  2758. * Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl.
  2759. * Defaults to false.
  2760. */
  2761. mouseWheelZoom?: boolean;
  2762. /**
  2763. * Control the mouse pointer style, either 'text' or 'default' or 'copy'
  2764. * Defaults to 'text'
  2765. */
  2766. mouseStyle?: 'text' | 'default' | 'copy';
  2767. /**
  2768. * Enable smooth caret animation.
  2769. * Defaults to false.
  2770. */
  2771. cursorSmoothCaretAnimation?: boolean;
  2772. /**
  2773. * Control the cursor style, either 'block' or 'line'.
  2774. * Defaults to 'line'.
  2775. */
  2776. cursorStyle?: 'line' | 'block' | 'underline' | 'line-thin' | 'block-outline' | 'underline-thin';
  2777. /**
  2778. * Control the width of the cursor when cursorStyle is set to 'line'
  2779. */
  2780. cursorWidth?: number;
  2781. /**
  2782. * Enable font ligatures.
  2783. * Defaults to false.
  2784. */
  2785. fontLigatures?: boolean | string;
  2786. /**
  2787. * Disable the use of `transform: translate3d(0px, 0px, 0px)` for the editor margin and lines layers.
  2788. * The usage of `transform: translate3d(0px, 0px, 0px)` acts as a hint for browsers to create an extra layer.
  2789. * Defaults to false.
  2790. */
  2791. disableLayerHinting?: boolean;
  2792. /**
  2793. * Disable the optimizations for monospace fonts.
  2794. * Defaults to false.
  2795. */
  2796. disableMonospaceOptimizations?: boolean;
  2797. /**
  2798. * Should the cursor be hidden in the overview ruler.
  2799. * Defaults to false.
  2800. */
  2801. hideCursorInOverviewRuler?: boolean;
  2802. /**
  2803. * Enable that scrolling can go one screen size after the last line.
  2804. * Defaults to true.
  2805. */
  2806. scrollBeyondLastLine?: boolean;
  2807. /**
  2808. * Enable that scrolling can go beyond the last column by a number of columns.
  2809. * Defaults to 5.
  2810. */
  2811. scrollBeyondLastColumn?: number;
  2812. /**
  2813. * Enable that the editor animates scrolling to a position.
  2814. * Defaults to false.
  2815. */
  2816. smoothScrolling?: boolean;
  2817. /**
  2818. * Enable that the editor will install an interval to check if its container dom node size has changed.
  2819. * Enabling this might have a severe performance impact.
  2820. * Defaults to false.
  2821. */
  2822. automaticLayout?: boolean;
  2823. /**
  2824. * Control the wrapping of the editor.
  2825. * When `wordWrap` = "off", the lines will never wrap.
  2826. * When `wordWrap` = "on", the lines will wrap at the viewport width.
  2827. * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
  2828. * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
  2829. * Defaults to "off".
  2830. */
  2831. wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded';
  2832. /**
  2833. * Override the `wordWrap` setting.
  2834. */
  2835. wordWrapOverride1?: 'off' | 'on' | 'inherit';
  2836. /**
  2837. * Override the `wordWrapOverride1` setting.
  2838. */
  2839. wordWrapOverride2?: 'off' | 'on' | 'inherit';
  2840. /**
  2841. * Control the wrapping of the editor.
  2842. * When `wordWrap` = "off", the lines will never wrap.
  2843. * When `wordWrap` = "on", the lines will wrap at the viewport width.
  2844. * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
  2845. * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
  2846. * Defaults to 80.
  2847. */
  2848. wordWrapColumn?: number;
  2849. /**
  2850. * Control indentation of wrapped lines. Can be: 'none', 'same', 'indent' or 'deepIndent'.
  2851. * Defaults to 'same' in vscode and to 'none' in monaco-editor.
  2852. */
  2853. wrappingIndent?: 'none' | 'same' | 'indent' | 'deepIndent';
  2854. /**
  2855. * Controls the wrapping strategy to use.
  2856. * Defaults to 'simple'.
  2857. */
  2858. wrappingStrategy?: 'simple' | 'advanced';
  2859. /**
  2860. * Configure word wrapping characters. A break will be introduced before these characters.
  2861. */
  2862. wordWrapBreakBeforeCharacters?: string;
  2863. /**
  2864. * Configure word wrapping characters. A break will be introduced after these characters.
  2865. */
  2866. wordWrapBreakAfterCharacters?: string;
  2867. /**
  2868. * Performance guard: Stop rendering a line after x characters.
  2869. * Defaults to 10000.
  2870. * Use -1 to never stop rendering
  2871. */
  2872. stopRenderingLineAfter?: number;
  2873. /**
  2874. * Configure the editor's hover.
  2875. */
  2876. hover?: IEditorHoverOptions;
  2877. /**
  2878. * Enable detecting links and making them clickable.
  2879. * Defaults to true.
  2880. */
  2881. links?: boolean;
  2882. /**
  2883. * Enable inline color decorators and color picker rendering.
  2884. */
  2885. colorDecorators?: boolean;
  2886. /**
  2887. * Control the behaviour of comments in the editor.
  2888. */
  2889. comments?: IEditorCommentsOptions;
  2890. /**
  2891. * Enable custom contextmenu.
  2892. * Defaults to true.
  2893. */
  2894. contextmenu?: boolean;
  2895. /**
  2896. * A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.
  2897. * Defaults to 1.
  2898. */
  2899. mouseWheelScrollSensitivity?: number;
  2900. /**
  2901. * FastScrolling mulitplier speed when pressing `Alt`
  2902. * Defaults to 5.
  2903. */
  2904. fastScrollSensitivity?: number;
  2905. /**
  2906. * Enable that the editor scrolls only the predominant axis. Prevents horizontal drift when scrolling vertically on a trackpad.
  2907. * Defaults to true.
  2908. */
  2909. scrollPredominantAxis?: boolean;
  2910. /**
  2911. * Enable that the selection with the mouse and keys is doing column selection.
  2912. * Defaults to false.
  2913. */
  2914. columnSelection?: boolean;
  2915. /**
  2916. * The modifier to be used to add multiple cursors with the mouse.
  2917. * Defaults to 'alt'
  2918. */
  2919. multiCursorModifier?: 'ctrlCmd' | 'alt';
  2920. /**
  2921. * Merge overlapping selections.
  2922. * Defaults to true
  2923. */
  2924. multiCursorMergeOverlapping?: boolean;
  2925. /**
  2926. * Configure the behaviour when pasting a text with the line count equal to the cursor count.
  2927. * Defaults to 'spread'.
  2928. */
  2929. multiCursorPaste?: 'spread' | 'full';
  2930. /**
  2931. * Configure the editor's accessibility support.
  2932. * Defaults to 'auto'. It is best to leave this to 'auto'.
  2933. */
  2934. accessibilitySupport?: 'auto' | 'off' | 'on';
  2935. /**
  2936. * Controls the number of lines in the editor that can be read out by a screen reader
  2937. */
  2938. accessibilityPageSize?: number;
  2939. /**
  2940. * Suggest options.
  2941. */
  2942. suggest?: ISuggestOptions;
  2943. inlineSuggest?: IInlineSuggestOptions;
  2944. /**
  2945. * Smart select options.
  2946. */
  2947. smartSelect?: ISmartSelectOptions;
  2948. /**
  2949. *
  2950. */
  2951. gotoLocation?: IGotoLocationOptions;
  2952. /**
  2953. * Enable quick suggestions (shadow suggestions)
  2954. * Defaults to true.
  2955. */
  2956. quickSuggestions?: boolean | IQuickSuggestionsOptions;
  2957. /**
  2958. * Quick suggestions show delay (in ms)
  2959. * Defaults to 10 (ms)
  2960. */
  2961. quickSuggestionsDelay?: number;
  2962. /**
  2963. * Controls the spacing around the editor.
  2964. */
  2965. padding?: IEditorPaddingOptions;
  2966. /**
  2967. * Parameter hint options.
  2968. */
  2969. parameterHints?: IEditorParameterHintOptions;
  2970. /**
  2971. * Options for auto closing brackets.
  2972. * Defaults to language defined behavior.
  2973. */
  2974. autoClosingBrackets?: EditorAutoClosingStrategy;
  2975. /**
  2976. * Options for auto closing quotes.
  2977. * Defaults to language defined behavior.
  2978. */
  2979. autoClosingQuotes?: EditorAutoClosingStrategy;
  2980. /**
  2981. * Options for pressing backspace near quotes or bracket pairs.
  2982. */
  2983. autoClosingDelete?: EditorAutoClosingEditStrategy;
  2984. /**
  2985. * Options for typing over closing quotes or brackets.
  2986. */
  2987. autoClosingOvertype?: EditorAutoClosingEditStrategy;
  2988. /**
  2989. * Options for auto surrounding.
  2990. * Defaults to always allowing auto surrounding.
  2991. */
  2992. autoSurround?: EditorAutoSurroundStrategy;
  2993. /**
  2994. * Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.
  2995. * Defaults to advanced.
  2996. */
  2997. autoIndent?: 'none' | 'keep' | 'brackets' | 'advanced' | 'full';
  2998. /**
  2999. * Emulate selection behaviour of tab characters when using spaces for indentation.
  3000. * This means selection will stick to tab stops.
  3001. */
  3002. stickyTabStops?: boolean;
  3003. /**
  3004. * Enable format on type.
  3005. * Defaults to false.
  3006. */
  3007. formatOnType?: boolean;
  3008. /**
  3009. * Enable format on paste.
  3010. * Defaults to false.
  3011. */
  3012. formatOnPaste?: boolean;
  3013. /**
  3014. * Controls if the editor should allow to move selections via drag and drop.
  3015. * Defaults to false.
  3016. */
  3017. dragAndDrop?: boolean;
  3018. /**
  3019. * Enable the suggestion box to pop-up on trigger characters.
  3020. * Defaults to true.
  3021. */
  3022. suggestOnTriggerCharacters?: boolean;
  3023. /**
  3024. * Accept suggestions on ENTER.
  3025. * Defaults to 'on'.
  3026. */
  3027. acceptSuggestionOnEnter?: 'on' | 'smart' | 'off';
  3028. /**
  3029. * Accept suggestions on provider defined characters.
  3030. * Defaults to true.
  3031. */
  3032. acceptSuggestionOnCommitCharacter?: boolean;
  3033. /**
  3034. * Enable snippet suggestions. Default to 'true'.
  3035. */
  3036. snippetSuggestions?: 'top' | 'bottom' | 'inline' | 'none';
  3037. /**
  3038. * Copying without a selection copies the current line.
  3039. */
  3040. emptySelectionClipboard?: boolean;
  3041. /**
  3042. * Syntax highlighting is copied.
  3043. */
  3044. copyWithSyntaxHighlighting?: boolean;
  3045. /**
  3046. * The history mode for suggestions.
  3047. */
  3048. suggestSelection?: 'first' | 'recentlyUsed' | 'recentlyUsedByPrefix';
  3049. /**
  3050. * The font size for the suggest widget.
  3051. * Defaults to the editor font size.
  3052. */
  3053. suggestFontSize?: number;
  3054. /**
  3055. * The line height for the suggest widget.
  3056. * Defaults to the editor line height.
  3057. */
  3058. suggestLineHeight?: number;
  3059. /**
  3060. * Enable tab completion.
  3061. */
  3062. tabCompletion?: 'on' | 'off' | 'onlySnippets';
  3063. /**
  3064. * Enable selection highlight.
  3065. * Defaults to true.
  3066. */
  3067. selectionHighlight?: boolean;
  3068. /**
  3069. * Enable semantic occurrences highlight.
  3070. * Defaults to true.
  3071. */
  3072. occurrencesHighlight?: boolean;
  3073. /**
  3074. * Show code lens
  3075. * Defaults to true.
  3076. */
  3077. codeLens?: boolean;
  3078. /**
  3079. * Code lens font family. Defaults to editor font family.
  3080. */
  3081. codeLensFontFamily?: string;
  3082. /**
  3083. * Code lens font size. Default to 90% of the editor font size
  3084. */
  3085. codeLensFontSize?: number;
  3086. /**
  3087. * Control the behavior and rendering of the code action lightbulb.
  3088. */
  3089. lightbulb?: IEditorLightbulbOptions;
  3090. /**
  3091. * Timeout for running code actions on save.
  3092. */
  3093. codeActionsOnSaveTimeout?: number;
  3094. /**
  3095. * Enable code folding.
  3096. * Defaults to true.
  3097. */
  3098. folding?: boolean;
  3099. /**
  3100. * Selects the folding strategy. 'auto' uses the strategies contributed for the current document, 'indentation' uses the indentation based folding strategy.
  3101. * Defaults to 'auto'.
  3102. */
  3103. foldingStrategy?: 'auto' | 'indentation';
  3104. /**
  3105. * Enable highlight for folded regions.
  3106. * Defaults to true.
  3107. */
  3108. foldingHighlight?: boolean;
  3109. /**
  3110. * Auto fold imports folding regions.
  3111. * Defaults to true.
  3112. */
  3113. foldingImportsByDefault?: boolean;
  3114. /**
  3115. * Maximum number of foldable regions.
  3116. * Defaults to 5000.
  3117. */
  3118. foldingMaximumRegions?: number;
  3119. /**
  3120. * Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter.
  3121. * Defaults to 'mouseover'.
  3122. */
  3123. showFoldingControls?: 'always' | 'mouseover';
  3124. /**
  3125. * Controls whether clicking on the empty content after a folded line will unfold the line.
  3126. * Defaults to false.
  3127. */
  3128. unfoldOnClickAfterEndOfLine?: boolean;
  3129. /**
  3130. * Enable highlighting of matching brackets.
  3131. * Defaults to 'always'.
  3132. */
  3133. matchBrackets?: 'never' | 'near' | 'always';
  3134. /**
  3135. * Enable rendering of whitespace.
  3136. * Defaults to 'selection'.
  3137. */
  3138. renderWhitespace?: 'none' | 'boundary' | 'selection' | 'trailing' | 'all';
  3139. /**
  3140. * Enable rendering of control characters.
  3141. * Defaults to true.
  3142. */
  3143. renderControlCharacters?: boolean;
  3144. /**
  3145. * Enable rendering of current line highlight.
  3146. * Defaults to all.
  3147. */
  3148. renderLineHighlight?: 'none' | 'gutter' | 'line' | 'all';
  3149. /**
  3150. * Control if the current line highlight should be rendered only the editor is focused.
  3151. * Defaults to false.
  3152. */
  3153. renderLineHighlightOnlyWhenFocus?: boolean;
  3154. /**
  3155. * Inserting and deleting whitespace follows tab stops.
  3156. */
  3157. useTabStops?: boolean;
  3158. /**
  3159. * The font family
  3160. */
  3161. fontFamily?: string;
  3162. /**
  3163. * The font weight
  3164. */
  3165. fontWeight?: string;
  3166. /**
  3167. * The font size
  3168. */
  3169. fontSize?: number;
  3170. /**
  3171. * The line height
  3172. */
  3173. lineHeight?: number;
  3174. /**
  3175. * The letter spacing
  3176. */
  3177. letterSpacing?: number;
  3178. /**
  3179. * Controls fading out of unused variables.
  3180. */
  3181. showUnused?: boolean;
  3182. /**
  3183. * Controls whether to focus the inline editor in the peek widget by default.
  3184. * Defaults to false.
  3185. */
  3186. peekWidgetDefaultFocus?: 'tree' | 'editor';
  3187. /**
  3188. * Controls whether the definition link opens element in the peek widget.
  3189. * Defaults to false.
  3190. */
  3191. definitionLinkOpensInPeek?: boolean;
  3192. /**
  3193. * Controls strikethrough deprecated variables.
  3194. */
  3195. showDeprecated?: boolean;
  3196. /**
  3197. * Control the behavior and rendering of the inline hints.
  3198. */
  3199. inlayHints?: IEditorInlayHintsOptions;
  3200. /**
  3201. * Control if the editor should use shadow DOM.
  3202. */
  3203. useShadowDOM?: boolean;
  3204. /**
  3205. * Controls the behavior of editor guides.
  3206. */
  3207. guides?: IGuidesOptions;
  3208. /**
  3209. * Controls the behavior of the unicode highlight feature
  3210. * (by default, ambiguous and invisible characters are highlighted).
  3211. */
  3212. unicodeHighlight?: IUnicodeHighlightOptions;
  3213. /**
  3214. * Configures bracket pair colorization (disabled by default).
  3215. */
  3216. bracketPairColorization?: IBracketPairColorizationOptions;
  3217. }
  3218. export interface IDiffEditorBaseOptions {
  3219. /**
  3220. * Allow the user to resize the diff editor split view.
  3221. * Defaults to true.
  3222. */
  3223. enableSplitViewResizing?: boolean;
  3224. /**
  3225. * Render the differences in two side-by-side editors.
  3226. * Defaults to true.
  3227. */
  3228. renderSideBySide?: boolean;
  3229. /**
  3230. * Timeout in milliseconds after which diff computation is cancelled.
  3231. * Defaults to 5000.
  3232. */
  3233. maxComputationTime?: number;
  3234. /**
  3235. * Maximum supported file size in MB.
  3236. * Defaults to 50.
  3237. */
  3238. maxFileSize?: number;
  3239. /**
  3240. * Compute the diff by ignoring leading/trailing whitespace
  3241. * Defaults to true.
  3242. */
  3243. ignoreTrimWhitespace?: boolean;
  3244. /**
  3245. * Render +/- indicators for added/deleted changes.
  3246. * Defaults to true.
  3247. */
  3248. renderIndicators?: boolean;
  3249. /**
  3250. * Original model should be editable?
  3251. * Defaults to false.
  3252. */
  3253. originalEditable?: boolean;
  3254. /**
  3255. * Should the diff editor enable code lens?
  3256. * Defaults to false.
  3257. */
  3258. diffCodeLens?: boolean;
  3259. /**
  3260. * Is the diff editor should render overview ruler
  3261. * Defaults to true
  3262. */
  3263. renderOverviewRuler?: boolean;
  3264. /**
  3265. * Control the wrapping of the diff editor.
  3266. */
  3267. diffWordWrap?: 'off' | 'on' | 'inherit';
  3268. }
  3269. /**
  3270. * Configuration options for the diff editor.
  3271. */
  3272. export interface IDiffEditorOptions extends IEditorOptions, IDiffEditorBaseOptions {
  3273. }
  3274. /**
  3275. * An event describing that the configuration of the editor has changed.
  3276. */
  3277. export class ConfigurationChangedEvent {
  3278. hasChanged(id: EditorOption): boolean;
  3279. }
  3280. /**
  3281. * All computed editor options.
  3282. */
  3283. export interface IComputedEditorOptions {
  3284. get<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T>;
  3285. }
  3286. export interface IEditorOption<K extends EditorOption, V> {
  3287. readonly id: K;
  3288. readonly name: string;
  3289. defaultValue: V;
  3290. /**
  3291. * Might modify `value`.
  3292. */
  3293. applyUpdate(value: V, update: V): ApplyUpdateResult<V>;
  3294. }
  3295. export class ApplyUpdateResult<T> {
  3296. readonly newValue: T;
  3297. readonly didChange: boolean;
  3298. constructor(newValue: T, didChange: boolean);
  3299. }
  3300. /**
  3301. * Configuration options for editor comments
  3302. */
  3303. export interface IEditorCommentsOptions {
  3304. /**
  3305. * Insert a space after the line comment token and inside the block comments tokens.
  3306. * Defaults to true.
  3307. */
  3308. insertSpace?: boolean;
  3309. /**
  3310. * Ignore empty lines when inserting line comments.
  3311. * Defaults to true.
  3312. */
  3313. ignoreEmptyLines?: boolean;
  3314. }
  3315. /**
  3316. * The kind of animation in which the editor's cursor should be rendered.
  3317. */
  3318. export enum TextEditorCursorBlinkingStyle {
  3319. /**
  3320. * Hidden
  3321. */
  3322. Hidden = 0,
  3323. /**
  3324. * Blinking
  3325. */
  3326. Blink = 1,
  3327. /**
  3328. * Blinking with smooth fading
  3329. */
  3330. Smooth = 2,
  3331. /**
  3332. * Blinking with prolonged filled state and smooth fading
  3333. */
  3334. Phase = 3,
  3335. /**
  3336. * Expand collapse animation on the y axis
  3337. */
  3338. Expand = 4,
  3339. /**
  3340. * No-Blinking
  3341. */
  3342. Solid = 5
  3343. }
  3344. /**
  3345. * The style in which the editor's cursor should be rendered.
  3346. */
  3347. export enum TextEditorCursorStyle {
  3348. /**
  3349. * As a vertical line (sitting between two characters).
  3350. */
  3351. Line = 1,
  3352. /**
  3353. * As a block (sitting on top of a character).
  3354. */
  3355. Block = 2,
  3356. /**
  3357. * As a horizontal line (sitting under a character).
  3358. */
  3359. Underline = 3,
  3360. /**
  3361. * As a thin vertical line (sitting between two characters).
  3362. */
  3363. LineThin = 4,
  3364. /**
  3365. * As an outlined block (sitting on top of a character).
  3366. */
  3367. BlockOutline = 5,
  3368. /**
  3369. * As a thin horizontal line (sitting under a character).
  3370. */
  3371. UnderlineThin = 6
  3372. }
  3373. /**
  3374. * Configuration options for editor find widget
  3375. */
  3376. export interface IEditorFindOptions {
  3377. /**
  3378. * Controls whether the cursor should move to find matches while typing.
  3379. */
  3380. cursorMoveOnType?: boolean;
  3381. /**
  3382. * Controls if we seed search string in the Find Widget with editor selection.
  3383. */
  3384. seedSearchStringFromSelection?: 'never' | 'always' | 'selection';
  3385. /**
  3386. * Controls if Find in Selection flag is turned on in the editor.
  3387. */
  3388. autoFindInSelection?: 'never' | 'always' | 'multiline';
  3389. addExtraSpaceOnTop?: boolean;
  3390. /**
  3391. * Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found
  3392. */
  3393. loop?: boolean;
  3394. }
  3395. export type GoToLocationValues = 'peek' | 'gotoAndPeek' | 'goto';
  3396. /**
  3397. * Configuration options for go to location
  3398. */
  3399. export interface IGotoLocationOptions {
  3400. multiple?: GoToLocationValues;
  3401. multipleDefinitions?: GoToLocationValues;
  3402. multipleTypeDefinitions?: GoToLocationValues;
  3403. multipleDeclarations?: GoToLocationValues;
  3404. multipleImplementations?: GoToLocationValues;
  3405. multipleReferences?: GoToLocationValues;
  3406. alternativeDefinitionCommand?: string;
  3407. alternativeTypeDefinitionCommand?: string;
  3408. alternativeDeclarationCommand?: string;
  3409. alternativeImplementationCommand?: string;
  3410. alternativeReferenceCommand?: string;
  3411. }
  3412. /**
  3413. * Configuration options for editor hover
  3414. */
  3415. export interface IEditorHoverOptions {
  3416. /**
  3417. * Enable the hover.
  3418. * Defaults to true.
  3419. */
  3420. enabled?: boolean;
  3421. /**
  3422. * Delay for showing the hover.
  3423. * Defaults to 300.
  3424. */
  3425. delay?: number;
  3426. /**
  3427. * Is the hover sticky such that it can be clicked and its contents selected?
  3428. * Defaults to true.
  3429. */
  3430. sticky?: boolean;
  3431. /**
  3432. * Should the hover be shown above the line if possible?
  3433. * Defaults to false.
  3434. */
  3435. above?: boolean;
  3436. }
  3437. /**
  3438. * A description for the overview ruler position.
  3439. */
  3440. export interface OverviewRulerPosition {
  3441. /**
  3442. * Width of the overview ruler
  3443. */
  3444. readonly width: number;
  3445. /**
  3446. * Height of the overview ruler
  3447. */
  3448. readonly height: number;
  3449. /**
  3450. * Top position for the overview ruler
  3451. */
  3452. readonly top: number;
  3453. /**
  3454. * Right position for the overview ruler
  3455. */
  3456. readonly right: number;
  3457. }
  3458. export enum RenderMinimap {
  3459. None = 0,
  3460. Text = 1,
  3461. Blocks = 2
  3462. }
  3463. /**
  3464. * The internal layout details of the editor.
  3465. */
  3466. export interface EditorLayoutInfo {
  3467. /**
  3468. * Full editor width.
  3469. */
  3470. readonly width: number;
  3471. /**
  3472. * Full editor height.
  3473. */
  3474. readonly height: number;
  3475. /**
  3476. * Left position for the glyph margin.
  3477. */
  3478. readonly glyphMarginLeft: number;
  3479. /**
  3480. * The width of the glyph margin.
  3481. */
  3482. readonly glyphMarginWidth: number;
  3483. /**
  3484. * Left position for the line numbers.
  3485. */
  3486. readonly lineNumbersLeft: number;
  3487. /**
  3488. * The width of the line numbers.
  3489. */
  3490. readonly lineNumbersWidth: number;
  3491. /**
  3492. * Left position for the line decorations.
  3493. */
  3494. readonly decorationsLeft: number;
  3495. /**
  3496. * The width of the line decorations.
  3497. */
  3498. readonly decorationsWidth: number;
  3499. /**
  3500. * Left position for the content (actual text)
  3501. */
  3502. readonly contentLeft: number;
  3503. /**
  3504. * The width of the content (actual text)
  3505. */
  3506. readonly contentWidth: number;
  3507. /**
  3508. * Layout information for the minimap
  3509. */
  3510. readonly minimap: EditorMinimapLayoutInfo;
  3511. /**
  3512. * The number of columns (of typical characters) fitting on a viewport line.
  3513. */
  3514. readonly viewportColumn: number;
  3515. readonly isWordWrapMinified: boolean;
  3516. readonly isViewportWrapping: boolean;
  3517. readonly wrappingColumn: number;
  3518. /**
  3519. * The width of the vertical scrollbar.
  3520. */
  3521. readonly verticalScrollbarWidth: number;
  3522. /**
  3523. * The height of the horizontal scrollbar.
  3524. */
  3525. readonly horizontalScrollbarHeight: number;
  3526. /**
  3527. * The position of the overview ruler.
  3528. */
  3529. readonly overviewRuler: OverviewRulerPosition;
  3530. }
  3531. /**
  3532. * The internal layout details of the editor.
  3533. */
  3534. export interface EditorMinimapLayoutInfo {
  3535. readonly renderMinimap: RenderMinimap;
  3536. readonly minimapLeft: number;
  3537. readonly minimapWidth: number;
  3538. readonly minimapHeightIsEditorHeight: boolean;
  3539. readonly minimapIsSampling: boolean;
  3540. readonly minimapScale: number;
  3541. readonly minimapLineHeight: number;
  3542. readonly minimapCanvasInnerWidth: number;
  3543. readonly minimapCanvasInnerHeight: number;
  3544. readonly minimapCanvasOuterWidth: number;
  3545. readonly minimapCanvasOuterHeight: number;
  3546. }
  3547. /**
  3548. * Configuration options for editor lightbulb
  3549. */
  3550. export interface IEditorLightbulbOptions {
  3551. /**
  3552. * Enable the lightbulb code action.
  3553. * Defaults to true.
  3554. */
  3555. enabled?: boolean;
  3556. }
  3557. /**
  3558. * Configuration options for editor inlayHints
  3559. */
  3560. export interface IEditorInlayHintsOptions {
  3561. /**
  3562. * Enable the inline hints.
  3563. * Defaults to true.
  3564. */
  3565. enabled?: boolean;
  3566. /**
  3567. * Font size of inline hints.
  3568. * Default to 90% of the editor font size.
  3569. */
  3570. fontSize?: number;
  3571. /**
  3572. * Font family of inline hints.
  3573. * Defaults to editor font family.
  3574. */
  3575. fontFamily?: string;
  3576. }
  3577. /**
  3578. * Configuration options for editor minimap
  3579. */
  3580. export interface IEditorMinimapOptions {
  3581. /**
  3582. * Enable the rendering of the minimap.
  3583. * Defaults to true.
  3584. */
  3585. enabled?: boolean;
  3586. /**
  3587. * Control the side of the minimap in editor.
  3588. * Defaults to 'right'.
  3589. */
  3590. side?: 'right' | 'left';
  3591. /**
  3592. * Control the minimap rendering mode.
  3593. * Defaults to 'actual'.
  3594. */
  3595. size?: 'proportional' | 'fill' | 'fit';
  3596. /**
  3597. * Control the rendering of the minimap slider.
  3598. * Defaults to 'mouseover'.
  3599. */
  3600. showSlider?: 'always' | 'mouseover';
  3601. /**
  3602. * Render the actual text on a line (as opposed to color blocks).
  3603. * Defaults to true.
  3604. */
  3605. renderCharacters?: boolean;
  3606. /**
  3607. * Limit the width of the minimap to render at most a certain number of columns.
  3608. * Defaults to 120.
  3609. */
  3610. maxColumn?: number;
  3611. /**
  3612. * Relative size of the font in the minimap. Defaults to 1.
  3613. */
  3614. scale?: number;
  3615. }
  3616. /**
  3617. * Configuration options for editor padding
  3618. */
  3619. export interface IEditorPaddingOptions {
  3620. /**
  3621. * Spacing between top edge of editor and first line.
  3622. */
  3623. top?: number;
  3624. /**
  3625. * Spacing between bottom edge of editor and last line.
  3626. */
  3627. bottom?: number;
  3628. }
  3629. /**
  3630. * Configuration options for parameter hints
  3631. */
  3632. export interface IEditorParameterHintOptions {
  3633. /**
  3634. * Enable parameter hints.
  3635. * Defaults to true.
  3636. */
  3637. enabled?: boolean;
  3638. /**
  3639. * Enable cycling of parameter hints.
  3640. * Defaults to false.
  3641. */
  3642. cycle?: boolean;
  3643. }
  3644. /**
  3645. * Configuration options for quick suggestions
  3646. */
  3647. export interface IQuickSuggestionsOptions {
  3648. other?: boolean;
  3649. comments?: boolean;
  3650. strings?: boolean;
  3651. }
  3652. export type LineNumbersType = 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string);
  3653. export enum RenderLineNumbersType {
  3654. Off = 0,
  3655. On = 1,
  3656. Relative = 2,
  3657. Interval = 3,
  3658. Custom = 4
  3659. }
  3660. export interface InternalEditorRenderLineNumbersOptions {
  3661. readonly renderType: RenderLineNumbersType;
  3662. readonly renderFn: ((lineNumber: number) => string) | null;
  3663. }
  3664. export interface IRulerOption {
  3665. readonly column: number;
  3666. readonly color: string | null;
  3667. }
  3668. /**
  3669. * Configuration options for editor scrollbars
  3670. */
  3671. export interface IEditorScrollbarOptions {
  3672. /**
  3673. * The size of arrows (if displayed).
  3674. * Defaults to 11.
  3675. * **NOTE**: This option cannot be updated using `updateOptions()`
  3676. */
  3677. arrowSize?: number;
  3678. /**
  3679. * Render vertical scrollbar.
  3680. * Defaults to 'auto'.
  3681. */
  3682. vertical?: 'auto' | 'visible' | 'hidden';
  3683. /**
  3684. * Render horizontal scrollbar.
  3685. * Defaults to 'auto'.
  3686. */
  3687. horizontal?: 'auto' | 'visible' | 'hidden';
  3688. /**
  3689. * Cast horizontal and vertical shadows when the content is scrolled.
  3690. * Defaults to true.
  3691. * **NOTE**: This option cannot be updated using `updateOptions()`
  3692. */
  3693. useShadows?: boolean;
  3694. /**
  3695. * Render arrows at the top and bottom of the vertical scrollbar.
  3696. * Defaults to false.
  3697. * **NOTE**: This option cannot be updated using `updateOptions()`
  3698. */
  3699. verticalHasArrows?: boolean;
  3700. /**
  3701. * Render arrows at the left and right of the horizontal scrollbar.
  3702. * Defaults to false.
  3703. * **NOTE**: This option cannot be updated using `updateOptions()`
  3704. */
  3705. horizontalHasArrows?: boolean;
  3706. /**
  3707. * Listen to mouse wheel events and react to them by scrolling.
  3708. * Defaults to true.
  3709. */
  3710. handleMouseWheel?: boolean;
  3711. /**
  3712. * Always consume mouse wheel events (always call preventDefault() and stopPropagation() on the browser events).
  3713. * Defaults to true.
  3714. * **NOTE**: This option cannot be updated using `updateOptions()`
  3715. */
  3716. alwaysConsumeMouseWheel?: boolean;
  3717. /**
  3718. * Height in pixels for the horizontal scrollbar.
  3719. * Defaults to 10 (px).
  3720. */
  3721. horizontalScrollbarSize?: number;
  3722. /**
  3723. * Width in pixels for the vertical scrollbar.
  3724. * Defaults to 10 (px).
  3725. */
  3726. verticalScrollbarSize?: number;
  3727. /**
  3728. * Width in pixels for the vertical slider.
  3729. * Defaults to `verticalScrollbarSize`.
  3730. * **NOTE**: This option cannot be updated using `updateOptions()`
  3731. */
  3732. verticalSliderSize?: number;
  3733. /**
  3734. * Height in pixels for the horizontal slider.
  3735. * Defaults to `horizontalScrollbarSize`.
  3736. * **NOTE**: This option cannot be updated using `updateOptions()`
  3737. */
  3738. horizontalSliderSize?: number;
  3739. /**
  3740. * Scroll gutter clicks move by page vs jump to position.
  3741. * Defaults to false.
  3742. */
  3743. scrollByPage?: boolean;
  3744. }
  3745. export interface InternalEditorScrollbarOptions {
  3746. readonly arrowSize: number;
  3747. readonly vertical: ScrollbarVisibility;
  3748. readonly horizontal: ScrollbarVisibility;
  3749. readonly useShadows: boolean;
  3750. readonly verticalHasArrows: boolean;
  3751. readonly horizontalHasArrows: boolean;
  3752. readonly handleMouseWheel: boolean;
  3753. readonly alwaysConsumeMouseWheel: boolean;
  3754. readonly horizontalScrollbarSize: number;
  3755. readonly horizontalSliderSize: number;
  3756. readonly verticalScrollbarSize: number;
  3757. readonly verticalSliderSize: number;
  3758. readonly scrollByPage: boolean;
  3759. }
  3760. export type InUntrustedWorkspace = 'inUntrustedWorkspace';
  3761. /**
  3762. * Configuration options for unicode highlighting.
  3763. */
  3764. export interface IUnicodeHighlightOptions {
  3765. /**
  3766. * Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII.
  3767. */
  3768. nonBasicASCII?: boolean | InUntrustedWorkspace;
  3769. /**
  3770. * Controls whether characters that just reserve space or have no width at all are highlighted.
  3771. */
  3772. invisibleCharacters?: boolean;
  3773. /**
  3774. * Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.
  3775. */
  3776. ambiguousCharacters?: boolean;
  3777. /**
  3778. * Controls whether characters in comments should also be subject to unicode highlighting.
  3779. */
  3780. includeComments?: boolean | InUntrustedWorkspace;
  3781. /**
  3782. * Controls whether characters in strings should also be subject to unicode highlighting.
  3783. */
  3784. includeStrings?: boolean | InUntrustedWorkspace;
  3785. /**
  3786. * Defines allowed characters that are not being highlighted.
  3787. */
  3788. allowedCharacters?: Record<string, true>;
  3789. /**
  3790. * Unicode characters that are common in allowed locales are not being highlighted.
  3791. */
  3792. allowedLocales?: Record<string | '_os' | '_vscode', true>;
  3793. }
  3794. export interface IInlineSuggestOptions {
  3795. /**
  3796. * Enable or disable the rendering of automatic inline completions.
  3797. */
  3798. enabled?: boolean;
  3799. /**
  3800. * Configures the mode.
  3801. * Use `prefix` to only show ghost text if the text to replace is a prefix of the suggestion text.
  3802. * Use `subword` to only show ghost text if the replace text is a subword of the suggestion text.
  3803. * Use `subwordSmart` to only show ghost text if the replace text is a subword of the suggestion text, but the subword must start after the cursor position.
  3804. * Defaults to `prefix`.
  3805. */
  3806. mode?: 'prefix' | 'subword' | 'subwordSmart';
  3807. }
  3808. export interface IBracketPairColorizationOptions {
  3809. /**
  3810. * Enable or disable bracket pair colorization.
  3811. */
  3812. enabled?: boolean;
  3813. }
  3814. export interface IGuidesOptions {
  3815. /**
  3816. * Enable rendering of bracket pair guides.
  3817. * Defaults to false.
  3818. */
  3819. bracketPairs?: boolean | 'active';
  3820. /**
  3821. * Enable rendering of vertical bracket pair guides.
  3822. * Defaults to 'active'.
  3823. */
  3824. bracketPairsHorizontal?: boolean | 'active';
  3825. /**
  3826. * Enable highlighting of the active bracket pair.
  3827. * Defaults to true.
  3828. */
  3829. highlightActiveBracketPair?: boolean;
  3830. /**
  3831. * Enable rendering of indent guides.
  3832. * Defaults to true.
  3833. */
  3834. indentation?: boolean;
  3835. /**
  3836. * Enable highlighting of the active indent guide.
  3837. * Defaults to true.
  3838. */
  3839. highlightActiveIndentation?: boolean;
  3840. }
  3841. /**
  3842. * Configuration options for editor suggest widget
  3843. */
  3844. export interface ISuggestOptions {
  3845. /**
  3846. * Overwrite word ends on accept. Default to false.
  3847. */
  3848. insertMode?: 'insert' | 'replace';
  3849. /**
  3850. * Enable graceful matching. Defaults to true.
  3851. */
  3852. filterGraceful?: boolean;
  3853. /**
  3854. * Prevent quick suggestions when a snippet is active. Defaults to true.
  3855. */
  3856. snippetsPreventQuickSuggestions?: boolean;
  3857. /**
  3858. * Favors words that appear close to the cursor.
  3859. */
  3860. localityBonus?: boolean;
  3861. /**
  3862. * Enable using global storage for remembering suggestions.
  3863. */
  3864. shareSuggestSelections?: boolean;
  3865. /**
  3866. * Enable or disable icons in suggestions. Defaults to true.
  3867. */
  3868. showIcons?: boolean;
  3869. /**
  3870. * Enable or disable the suggest status bar.
  3871. */
  3872. showStatusBar?: boolean;
  3873. /**
  3874. * Enable or disable the rendering of the suggestion preview.
  3875. */
  3876. preview?: boolean;
  3877. /**
  3878. * Configures the mode of the preview.
  3879. */
  3880. previewMode?: 'prefix' | 'subword' | 'subwordSmart';
  3881. /**
  3882. * Show details inline with the label. Defaults to true.
  3883. */
  3884. showInlineDetails?: boolean;
  3885. /**
  3886. * Show method-suggestions.
  3887. */
  3888. showMethods?: boolean;
  3889. /**
  3890. * Show function-suggestions.
  3891. */
  3892. showFunctions?: boolean;
  3893. /**
  3894. * Show constructor-suggestions.
  3895. */
  3896. showConstructors?: boolean;
  3897. /**
  3898. * Show deprecated-suggestions.
  3899. */
  3900. showDeprecated?: boolean;
  3901. /**
  3902. * Show field-suggestions.
  3903. */
  3904. showFields?: boolean;
  3905. /**
  3906. * Show variable-suggestions.
  3907. */
  3908. showVariables?: boolean;
  3909. /**
  3910. * Show class-suggestions.
  3911. */
  3912. showClasses?: boolean;
  3913. /**
  3914. * Show struct-suggestions.
  3915. */
  3916. showStructs?: boolean;
  3917. /**
  3918. * Show interface-suggestions.
  3919. */
  3920. showInterfaces?: boolean;
  3921. /**
  3922. * Show module-suggestions.
  3923. */
  3924. showModules?: boolean;
  3925. /**
  3926. * Show property-suggestions.
  3927. */
  3928. showProperties?: boolean;
  3929. /**
  3930. * Show event-suggestions.
  3931. */
  3932. showEvents?: boolean;
  3933. /**
  3934. * Show operator-suggestions.
  3935. */
  3936. showOperators?: boolean;
  3937. /**
  3938. * Show unit-suggestions.
  3939. */
  3940. showUnits?: boolean;
  3941. /**
  3942. * Show value-suggestions.
  3943. */
  3944. showValues?: boolean;
  3945. /**
  3946. * Show constant-suggestions.
  3947. */
  3948. showConstants?: boolean;
  3949. /**
  3950. * Show enum-suggestions.
  3951. */
  3952. showEnums?: boolean;
  3953. /**
  3954. * Show enumMember-suggestions.
  3955. */
  3956. showEnumMembers?: boolean;
  3957. /**
  3958. * Show keyword-suggestions.
  3959. */
  3960. showKeywords?: boolean;
  3961. /**
  3962. * Show text-suggestions.
  3963. */
  3964. showWords?: boolean;
  3965. /**
  3966. * Show color-suggestions.
  3967. */
  3968. showColors?: boolean;
  3969. /**
  3970. * Show file-suggestions.
  3971. */
  3972. showFiles?: boolean;
  3973. /**
  3974. * Show reference-suggestions.
  3975. */
  3976. showReferences?: boolean;
  3977. /**
  3978. * Show folder-suggestions.
  3979. */
  3980. showFolders?: boolean;
  3981. /**
  3982. * Show typeParameter-suggestions.
  3983. */
  3984. showTypeParameters?: boolean;
  3985. /**
  3986. * Show issue-suggestions.
  3987. */
  3988. showIssues?: boolean;
  3989. /**
  3990. * Show user-suggestions.
  3991. */
  3992. showUsers?: boolean;
  3993. /**
  3994. * Show snippet-suggestions.
  3995. */
  3996. showSnippets?: boolean;
  3997. }
  3998. export interface ISmartSelectOptions {
  3999. selectLeadingAndTrailingWhitespace?: boolean;
  4000. }
  4001. /**
  4002. * Describes how to indent wrapped lines.
  4003. */
  4004. export enum WrappingIndent {
  4005. /**
  4006. * No indentation => wrapped lines begin at column 1.
  4007. */
  4008. None = 0,
  4009. /**
  4010. * Same => wrapped lines get the same indentation as the parent.
  4011. */
  4012. Same = 1,
  4013. /**
  4014. * Indent => wrapped lines get +1 indentation toward the parent.
  4015. */
  4016. Indent = 2,
  4017. /**
  4018. * DeepIndent => wrapped lines get +2 indentation toward the parent.
  4019. */
  4020. DeepIndent = 3
  4021. }
  4022. export interface EditorWrappingInfo {
  4023. readonly isDominatedByLongLines: boolean;
  4024. readonly isWordWrapMinified: boolean;
  4025. readonly isViewportWrapping: boolean;
  4026. readonly wrappingColumn: number;
  4027. }
  4028. export enum EditorOption {
  4029. acceptSuggestionOnCommitCharacter = 0,
  4030. acceptSuggestionOnEnter = 1,
  4031. accessibilitySupport = 2,
  4032. accessibilityPageSize = 3,
  4033. ariaLabel = 4,
  4034. autoClosingBrackets = 5,
  4035. autoClosingDelete = 6,
  4036. autoClosingOvertype = 7,
  4037. autoClosingQuotes = 8,
  4038. autoIndent = 9,
  4039. automaticLayout = 10,
  4040. autoSurround = 11,
  4041. bracketPairColorization = 12,
  4042. guides = 13,
  4043. codeLens = 14,
  4044. codeLensFontFamily = 15,
  4045. codeLensFontSize = 16,
  4046. colorDecorators = 17,
  4047. columnSelection = 18,
  4048. comments = 19,
  4049. contextmenu = 20,
  4050. copyWithSyntaxHighlighting = 21,
  4051. cursorBlinking = 22,
  4052. cursorSmoothCaretAnimation = 23,
  4053. cursorStyle = 24,
  4054. cursorSurroundingLines = 25,
  4055. cursorSurroundingLinesStyle = 26,
  4056. cursorWidth = 27,
  4057. disableLayerHinting = 28,
  4058. disableMonospaceOptimizations = 29,
  4059. domReadOnly = 30,
  4060. dragAndDrop = 31,
  4061. emptySelectionClipboard = 32,
  4062. extraEditorClassName = 33,
  4063. fastScrollSensitivity = 34,
  4064. find = 35,
  4065. fixedOverflowWidgets = 36,
  4066. folding = 37,
  4067. foldingStrategy = 38,
  4068. foldingHighlight = 39,
  4069. foldingImportsByDefault = 40,
  4070. foldingMaximumRegions = 41,
  4071. unfoldOnClickAfterEndOfLine = 42,
  4072. fontFamily = 43,
  4073. fontInfo = 44,
  4074. fontLigatures = 45,
  4075. fontSize = 46,
  4076. fontWeight = 47,
  4077. formatOnPaste = 48,
  4078. formatOnType = 49,
  4079. glyphMargin = 50,
  4080. gotoLocation = 51,
  4081. hideCursorInOverviewRuler = 52,
  4082. hover = 53,
  4083. inDiffEditor = 54,
  4084. inlineSuggest = 55,
  4085. letterSpacing = 56,
  4086. lightbulb = 57,
  4087. lineDecorationsWidth = 58,
  4088. lineHeight = 59,
  4089. lineNumbers = 60,
  4090. lineNumbersMinChars = 61,
  4091. linkedEditing = 62,
  4092. links = 63,
  4093. matchBrackets = 64,
  4094. minimap = 65,
  4095. mouseStyle = 66,
  4096. mouseWheelScrollSensitivity = 67,
  4097. mouseWheelZoom = 68,
  4098. multiCursorMergeOverlapping = 69,
  4099. multiCursorModifier = 70,
  4100. multiCursorPaste = 71,
  4101. occurrencesHighlight = 72,
  4102. overviewRulerBorder = 73,
  4103. overviewRulerLanes = 74,
  4104. padding = 75,
  4105. parameterHints = 76,
  4106. peekWidgetDefaultFocus = 77,
  4107. definitionLinkOpensInPeek = 78,
  4108. quickSuggestions = 79,
  4109. quickSuggestionsDelay = 80,
  4110. readOnly = 81,
  4111. renameOnType = 82,
  4112. renderControlCharacters = 83,
  4113. renderFinalNewline = 84,
  4114. renderLineHighlight = 85,
  4115. renderLineHighlightOnlyWhenFocus = 86,
  4116. renderValidationDecorations = 87,
  4117. renderWhitespace = 88,
  4118. revealHorizontalRightPadding = 89,
  4119. roundedSelection = 90,
  4120. rulers = 91,
  4121. scrollbar = 92,
  4122. scrollBeyondLastColumn = 93,
  4123. scrollBeyondLastLine = 94,
  4124. scrollPredominantAxis = 95,
  4125. selectionClipboard = 96,
  4126. selectionHighlight = 97,
  4127. selectOnLineNumbers = 98,
  4128. showFoldingControls = 99,
  4129. showUnused = 100,
  4130. snippetSuggestions = 101,
  4131. smartSelect = 102,
  4132. smoothScrolling = 103,
  4133. stickyTabStops = 104,
  4134. stopRenderingLineAfter = 105,
  4135. suggest = 106,
  4136. suggestFontSize = 107,
  4137. suggestLineHeight = 108,
  4138. suggestOnTriggerCharacters = 109,
  4139. suggestSelection = 110,
  4140. tabCompletion = 111,
  4141. tabIndex = 112,
  4142. unicodeHighlighting = 113,
  4143. unusualLineTerminators = 114,
  4144. useShadowDOM = 115,
  4145. useTabStops = 116,
  4146. wordSeparators = 117,
  4147. wordWrap = 118,
  4148. wordWrapBreakAfterCharacters = 119,
  4149. wordWrapBreakBeforeCharacters = 120,
  4150. wordWrapColumn = 121,
  4151. wordWrapOverride1 = 122,
  4152. wordWrapOverride2 = 123,
  4153. wrappingIndent = 124,
  4154. wrappingStrategy = 125,
  4155. showDeprecated = 126,
  4156. inlayHints = 127,
  4157. editorClassName = 128,
  4158. pixelRatio = 129,
  4159. tabFocusMode = 130,
  4160. layoutInfo = 131,
  4161. wrappingInfo = 132
  4162. }
  4163. export const EditorOptions: {
  4164. acceptSuggestionOnCommitCharacter: IEditorOption<EditorOption.acceptSuggestionOnCommitCharacter, boolean>;
  4165. acceptSuggestionOnEnter: IEditorOption<EditorOption.acceptSuggestionOnEnter, 'on' | 'off' | 'smart'>;
  4166. accessibilitySupport: IEditorOption<EditorOption.accessibilitySupport, AccessibilitySupport>;
  4167. accessibilityPageSize: IEditorOption<EditorOption.accessibilityPageSize, number>;
  4168. ariaLabel: IEditorOption<EditorOption.ariaLabel, string>;
  4169. autoClosingBrackets: IEditorOption<EditorOption.autoClosingBrackets, 'always' | 'languageDefined' | 'beforeWhitespace' | 'never'>;
  4170. autoClosingDelete: IEditorOption<EditorOption.autoClosingDelete, 'always' | 'never' | 'auto'>;
  4171. autoClosingOvertype: IEditorOption<EditorOption.autoClosingOvertype, 'always' | 'never' | 'auto'>;
  4172. autoClosingQuotes: IEditorOption<EditorOption.autoClosingQuotes, 'always' | 'languageDefined' | 'beforeWhitespace' | 'never'>;
  4173. autoIndent: IEditorOption<EditorOption.autoIndent, EditorAutoIndentStrategy>;
  4174. automaticLayout: IEditorOption<EditorOption.automaticLayout, boolean>;
  4175. autoSurround: IEditorOption<EditorOption.autoSurround, 'languageDefined' | 'never' | 'quotes' | 'brackets'>;
  4176. bracketPairColorization: IEditorOption<EditorOption.bracketPairColorization, Readonly<Required<IBracketPairColorizationOptions>>>;
  4177. bracketPairGuides: IEditorOption<EditorOption.guides, Readonly<Required<IGuidesOptions>>>;
  4178. stickyTabStops: IEditorOption<EditorOption.stickyTabStops, boolean>;
  4179. codeLens: IEditorOption<EditorOption.codeLens, boolean>;
  4180. codeLensFontFamily: IEditorOption<EditorOption.codeLensFontFamily, string>;
  4181. codeLensFontSize: IEditorOption<EditorOption.codeLensFontSize, number>;
  4182. colorDecorators: IEditorOption<EditorOption.colorDecorators, boolean>;
  4183. columnSelection: IEditorOption<EditorOption.columnSelection, boolean>;
  4184. comments: IEditorOption<EditorOption.comments, Readonly<Required<IEditorCommentsOptions>>>;
  4185. contextmenu: IEditorOption<EditorOption.contextmenu, boolean>;
  4186. copyWithSyntaxHighlighting: IEditorOption<EditorOption.copyWithSyntaxHighlighting, boolean>;
  4187. cursorBlinking: IEditorOption<EditorOption.cursorBlinking, TextEditorCursorBlinkingStyle>;
  4188. cursorSmoothCaretAnimation: IEditorOption<EditorOption.cursorSmoothCaretAnimation, boolean>;
  4189. cursorStyle: IEditorOption<EditorOption.cursorStyle, TextEditorCursorStyle>;
  4190. cursorSurroundingLines: IEditorOption<EditorOption.cursorSurroundingLines, number>;
  4191. cursorSurroundingLinesStyle: IEditorOption<EditorOption.cursorSurroundingLinesStyle, 'default' | 'all'>;
  4192. cursorWidth: IEditorOption<EditorOption.cursorWidth, number>;
  4193. disableLayerHinting: IEditorOption<EditorOption.disableLayerHinting, boolean>;
  4194. disableMonospaceOptimizations: IEditorOption<EditorOption.disableMonospaceOptimizations, boolean>;
  4195. domReadOnly: IEditorOption<EditorOption.domReadOnly, boolean>;
  4196. dragAndDrop: IEditorOption<EditorOption.dragAndDrop, boolean>;
  4197. emptySelectionClipboard: IEditorOption<EditorOption.emptySelectionClipboard, boolean>;
  4198. extraEditorClassName: IEditorOption<EditorOption.extraEditorClassName, string>;
  4199. fastScrollSensitivity: IEditorOption<EditorOption.fastScrollSensitivity, number>;
  4200. find: IEditorOption<EditorOption.find, Readonly<Required<IEditorFindOptions>>>;
  4201. fixedOverflowWidgets: IEditorOption<EditorOption.fixedOverflowWidgets, boolean>;
  4202. folding: IEditorOption<EditorOption.folding, boolean>;
  4203. foldingStrategy: IEditorOption<EditorOption.foldingStrategy, 'auto' | 'indentation'>;
  4204. foldingHighlight: IEditorOption<EditorOption.foldingHighlight, boolean>;
  4205. foldingImportsByDefault: IEditorOption<EditorOption.foldingImportsByDefault, boolean>;
  4206. foldingMaximumRegions: IEditorOption<EditorOption.foldingMaximumRegions, number>;
  4207. unfoldOnClickAfterEndOfLine: IEditorOption<EditorOption.unfoldOnClickAfterEndOfLine, boolean>;
  4208. fontFamily: IEditorOption<EditorOption.fontFamily, string>;
  4209. fontInfo: IEditorOption<EditorOption.fontInfo, FontInfo>;
  4210. fontLigatures2: IEditorOption<EditorOption.fontLigatures, string>;
  4211. fontSize: IEditorOption<EditorOption.fontSize, number>;
  4212. fontWeight: IEditorOption<EditorOption.fontWeight, string>;
  4213. formatOnPaste: IEditorOption<EditorOption.formatOnPaste, boolean>;
  4214. formatOnType: IEditorOption<EditorOption.formatOnType, boolean>;
  4215. glyphMargin: IEditorOption<EditorOption.glyphMargin, boolean>;
  4216. gotoLocation: IEditorOption<EditorOption.gotoLocation, Readonly<Required<IGotoLocationOptions>>>;
  4217. hideCursorInOverviewRuler: IEditorOption<EditorOption.hideCursorInOverviewRuler, boolean>;
  4218. hover: IEditorOption<EditorOption.hover, Readonly<Required<IEditorHoverOptions>>>;
  4219. inDiffEditor: IEditorOption<EditorOption.inDiffEditor, boolean>;
  4220. letterSpacing: IEditorOption<EditorOption.letterSpacing, number>;
  4221. lightbulb: IEditorOption<EditorOption.lightbulb, Readonly<Required<IEditorLightbulbOptions>>>;
  4222. lineDecorationsWidth: IEditorOption<EditorOption.lineDecorationsWidth, string | number>;
  4223. lineHeight: IEditorOption<EditorOption.lineHeight, number>;
  4224. lineNumbers: IEditorOption<EditorOption.lineNumbers, InternalEditorRenderLineNumbersOptions>;
  4225. lineNumbersMinChars: IEditorOption<EditorOption.lineNumbersMinChars, number>;
  4226. linkedEditing: IEditorOption<EditorOption.linkedEditing, boolean>;
  4227. links: IEditorOption<EditorOption.links, boolean>;
  4228. matchBrackets: IEditorOption<EditorOption.matchBrackets, 'always' | 'never' | 'near'>;
  4229. minimap: IEditorOption<EditorOption.minimap, Readonly<Required<IEditorMinimapOptions>>>;
  4230. mouseStyle: IEditorOption<EditorOption.mouseStyle, 'default' | 'text' | 'copy'>;
  4231. mouseWheelScrollSensitivity: IEditorOption<EditorOption.mouseWheelScrollSensitivity, number>;
  4232. mouseWheelZoom: IEditorOption<EditorOption.mouseWheelZoom, boolean>;
  4233. multiCursorMergeOverlapping: IEditorOption<EditorOption.multiCursorMergeOverlapping, boolean>;
  4234. multiCursorModifier: IEditorOption<EditorOption.multiCursorModifier, 'altKey' | 'metaKey' | 'ctrlKey'>;
  4235. multiCursorPaste: IEditorOption<EditorOption.multiCursorPaste, 'spread' | 'full'>;
  4236. occurrencesHighlight: IEditorOption<EditorOption.occurrencesHighlight, boolean>;
  4237. overviewRulerBorder: IEditorOption<EditorOption.overviewRulerBorder, boolean>;
  4238. overviewRulerLanes: IEditorOption<EditorOption.overviewRulerLanes, number>;
  4239. padding: IEditorOption<EditorOption.padding, Readonly<Required<IEditorPaddingOptions>>>;
  4240. parameterHints: IEditorOption<EditorOption.parameterHints, Readonly<Required<IEditorParameterHintOptions>>>;
  4241. peekWidgetDefaultFocus: IEditorOption<EditorOption.peekWidgetDefaultFocus, 'tree' | 'editor'>;
  4242. definitionLinkOpensInPeek: IEditorOption<EditorOption.definitionLinkOpensInPeek, boolean>;
  4243. quickSuggestions: IEditorOption<EditorOption.quickSuggestions, any>;
  4244. quickSuggestionsDelay: IEditorOption<EditorOption.quickSuggestionsDelay, number>;
  4245. readOnly: IEditorOption<EditorOption.readOnly, boolean>;
  4246. renameOnType: IEditorOption<EditorOption.renameOnType, boolean>;
  4247. renderControlCharacters: IEditorOption<EditorOption.renderControlCharacters, boolean>;
  4248. renderFinalNewline: IEditorOption<EditorOption.renderFinalNewline, boolean>;
  4249. renderLineHighlight: IEditorOption<EditorOption.renderLineHighlight, 'all' | 'line' | 'none' | 'gutter'>;
  4250. renderLineHighlightOnlyWhenFocus: IEditorOption<EditorOption.renderLineHighlightOnlyWhenFocus, boolean>;
  4251. renderValidationDecorations: IEditorOption<EditorOption.renderValidationDecorations, 'on' | 'off' | 'editable'>;
  4252. renderWhitespace: IEditorOption<EditorOption.renderWhitespace, 'all' | 'none' | 'boundary' | 'selection' | 'trailing'>;
  4253. revealHorizontalRightPadding: IEditorOption<EditorOption.revealHorizontalRightPadding, number>;
  4254. roundedSelection: IEditorOption<EditorOption.roundedSelection, boolean>;
  4255. rulers: IEditorOption<EditorOption.rulers, {}>;
  4256. scrollbar: IEditorOption<EditorOption.scrollbar, InternalEditorScrollbarOptions>;
  4257. scrollBeyondLastColumn: IEditorOption<EditorOption.scrollBeyondLastColumn, number>;
  4258. scrollBeyondLastLine: IEditorOption<EditorOption.scrollBeyondLastLine, boolean>;
  4259. scrollPredominantAxis: IEditorOption<EditorOption.scrollPredominantAxis, boolean>;
  4260. selectionClipboard: IEditorOption<EditorOption.selectionClipboard, boolean>;
  4261. selectionHighlight: IEditorOption<EditorOption.selectionHighlight, boolean>;
  4262. selectOnLineNumbers: IEditorOption<EditorOption.selectOnLineNumbers, boolean>;
  4263. showFoldingControls: IEditorOption<EditorOption.showFoldingControls, 'always' | 'mouseover'>;
  4264. showUnused: IEditorOption<EditorOption.showUnused, boolean>;
  4265. showDeprecated: IEditorOption<EditorOption.showDeprecated, boolean>;
  4266. inlayHints: IEditorOption<EditorOption.inlayHints, Readonly<Required<IEditorInlayHintsOptions>>>;
  4267. snippetSuggestions: IEditorOption<EditorOption.snippetSuggestions, 'none' | 'top' | 'bottom' | 'inline'>;
  4268. smartSelect: IEditorOption<EditorOption.smartSelect, Readonly<Required<ISmartSelectOptions>>>;
  4269. smoothScrolling: IEditorOption<EditorOption.smoothScrolling, boolean>;
  4270. stopRenderingLineAfter: IEditorOption<EditorOption.stopRenderingLineAfter, number>;
  4271. suggest: IEditorOption<EditorOption.suggest, Readonly<Required<ISuggestOptions>>>;
  4272. inlineSuggest: IEditorOption<EditorOption.inlineSuggest, Readonly<Required<IInlineSuggestOptions>>>;
  4273. suggestFontSize: IEditorOption<EditorOption.suggestFontSize, number>;
  4274. suggestLineHeight: IEditorOption<EditorOption.suggestLineHeight, number>;
  4275. suggestOnTriggerCharacters: IEditorOption<EditorOption.suggestOnTriggerCharacters, boolean>;
  4276. suggestSelection: IEditorOption<EditorOption.suggestSelection, 'first' | 'recentlyUsed' | 'recentlyUsedByPrefix'>;
  4277. tabCompletion: IEditorOption<EditorOption.tabCompletion, 'on' | 'off' | 'onlySnippets'>;
  4278. tabIndex: IEditorOption<EditorOption.tabIndex, number>;
  4279. unicodeHighlight: IEditorOption<EditorOption.unicodeHighlighting, Required<Readonly<IUnicodeHighlightOptions>>>;
  4280. unusualLineTerminators: IEditorOption<EditorOption.unusualLineTerminators, 'auto' | 'off' | 'prompt'>;
  4281. useShadowDOM: IEditorOption<EditorOption.useShadowDOM, boolean>;
  4282. useTabStops: IEditorOption<EditorOption.useTabStops, boolean>;
  4283. wordSeparators: IEditorOption<EditorOption.wordSeparators, string>;
  4284. wordWrap: IEditorOption<EditorOption.wordWrap, 'on' | 'off' | 'wordWrapColumn' | 'bounded'>;
  4285. wordWrapBreakAfterCharacters: IEditorOption<EditorOption.wordWrapBreakAfterCharacters, string>;
  4286. wordWrapBreakBeforeCharacters: IEditorOption<EditorOption.wordWrapBreakBeforeCharacters, string>;
  4287. wordWrapColumn: IEditorOption<EditorOption.wordWrapColumn, number>;
  4288. wordWrapOverride1: IEditorOption<EditorOption.wordWrapOverride1, 'on' | 'off' | 'inherit'>;
  4289. wordWrapOverride2: IEditorOption<EditorOption.wordWrapOverride2, 'on' | 'off' | 'inherit'>;
  4290. wrappingIndent: IEditorOption<EditorOption.wrappingIndent, WrappingIndent>;
  4291. wrappingStrategy: IEditorOption<EditorOption.wrappingStrategy, 'simple' | 'advanced'>;
  4292. editorClassName: IEditorOption<EditorOption.editorClassName, string>;
  4293. pixelRatio: IEditorOption<EditorOption.pixelRatio, number>;
  4294. tabFocusMode: IEditorOption<EditorOption.tabFocusMode, boolean>;
  4295. layoutInfo: IEditorOption<EditorOption.layoutInfo, EditorLayoutInfo>;
  4296. wrappingInfo: IEditorOption<EditorOption.wrappingInfo, EditorWrappingInfo>;
  4297. };
  4298. type EditorOptionsType = typeof EditorOptions;
  4299. type FindEditorOptionsKeyById<T extends EditorOption> = {
  4300. [K in keyof EditorOptionsType]: EditorOptionsType[K]['id'] extends T ? K : never;
  4301. }[keyof EditorOptionsType];
  4302. type ComputedEditorOptionValue<T extends IEditorOption<any, any>> = T extends IEditorOption<any, infer R> ? R : never;
  4303. export type FindComputedEditorOptionValueById<T extends EditorOption> = NonNullable<ComputedEditorOptionValue<EditorOptionsType[FindEditorOptionsKeyById<T>]>>;
  4304. export interface IEditorConstructionOptions extends IEditorOptions {
  4305. /**
  4306. * The initial editor dimension (to avoid measuring the container).
  4307. */
  4308. dimension?: IDimension;
  4309. /**
  4310. * Place overflow widgets inside an external DOM node.
  4311. * Defaults to an internal DOM node.
  4312. */
  4313. overflowWidgetsDomNode?: HTMLElement;
  4314. }
  4315. /**
  4316. * A view zone is a full horizontal rectangle that 'pushes' text down.
  4317. * The editor reserves space for view zones when rendering.
  4318. */
  4319. export interface IViewZone {
  4320. /**
  4321. * The line number after which this zone should appear.
  4322. * Use 0 to place a view zone before the first line number.
  4323. */
  4324. afterLineNumber: number;
  4325. /**
  4326. * The column after which this zone should appear.
  4327. * If not set, the maxLineColumn of `afterLineNumber` will be used.
  4328. * This is relevant for wrapped lines.
  4329. */
  4330. afterColumn?: number;
  4331. /**
  4332. * If the `afterColumn` has multiple view columns, the affinity specifies which one to use. Defaults to `none`.
  4333. */
  4334. afterColumnAffinity?: PositionAffinity;
  4335. /**
  4336. * Suppress mouse down events.
  4337. * If set, the editor will attach a mouse down listener to the view zone and .preventDefault on it.
  4338. * Defaults to false
  4339. */
  4340. suppressMouseDown?: boolean;
  4341. /**
  4342. * The height in lines of the view zone.
  4343. * If specified, `heightInPx` will be used instead of this.
  4344. * If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen.
  4345. */
  4346. heightInLines?: number;
  4347. /**
  4348. * The height in px of the view zone.
  4349. * If this is set, the editor will give preference to it rather than `heightInLines` above.
  4350. * If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen.
  4351. */
  4352. heightInPx?: number;
  4353. /**
  4354. * The minimum width in px of the view zone.
  4355. * If this is set, the editor will ensure that the scroll width is >= than this value.
  4356. */
  4357. minWidthInPx?: number;
  4358. /**
  4359. * The dom node of the view zone
  4360. */
  4361. domNode: HTMLElement;
  4362. /**
  4363. * An optional dom node for the view zone that will be placed in the margin area.
  4364. */
  4365. marginDomNode?: HTMLElement | null;
  4366. /**
  4367. * Callback which gives the relative top of the view zone as it appears (taking scrolling into account).
  4368. */
  4369. onDomNodeTop?: (top: number) => void;
  4370. /**
  4371. * Callback which gives the height in pixels of the view zone.
  4372. */
  4373. onComputedHeight?: (height: number) => void;
  4374. }
  4375. /**
  4376. * An accessor that allows for zones to be added or removed.
  4377. */
  4378. export interface IViewZoneChangeAccessor {
  4379. /**
  4380. * Create a new view zone.
  4381. * @param zone Zone to create
  4382. * @return A unique identifier to the view zone.
  4383. */
  4384. addZone(zone: IViewZone): string;
  4385. /**
  4386. * Remove a zone
  4387. * @param id A unique identifier to the view zone, as returned by the `addZone` call.
  4388. */
  4389. removeZone(id: string): void;
  4390. /**
  4391. * Change a zone's position.
  4392. * The editor will rescan the `afterLineNumber` and `afterColumn` properties of a view zone.
  4393. */
  4394. layoutZone(id: string): void;
  4395. }
  4396. /**
  4397. * A positioning preference for rendering content widgets.
  4398. */
  4399. export enum ContentWidgetPositionPreference {
  4400. /**
  4401. * Place the content widget exactly at a position
  4402. */
  4403. EXACT = 0,
  4404. /**
  4405. * Place the content widget above a position
  4406. */
  4407. ABOVE = 1,
  4408. /**
  4409. * Place the content widget below a position
  4410. */
  4411. BELOW = 2
  4412. }
  4413. /**
  4414. * A position for rendering content widgets.
  4415. */
  4416. export interface IContentWidgetPosition {
  4417. /**
  4418. * Desired position for the content widget.
  4419. * `preference` will also affect the placement.
  4420. */
  4421. position: IPosition | null;
  4422. /**
  4423. * Optionally, a range can be provided to further
  4424. * define the position of the content widget.
  4425. */
  4426. range?: IRange | null;
  4427. /**
  4428. * Placement preference for position, in order of preference.
  4429. */
  4430. preference: ContentWidgetPositionPreference[];
  4431. }
  4432. /**
  4433. * A content widget renders inline with the text and can be easily placed 'near' an editor position.
  4434. */
  4435. export interface IContentWidget {
  4436. /**
  4437. * Render this content widget in a location where it could overflow the editor's view dom node.
  4438. */
  4439. allowEditorOverflow?: boolean;
  4440. /**
  4441. * Call preventDefault() on mousedown events that target the content widget.
  4442. */
  4443. suppressMouseDown?: boolean;
  4444. /**
  4445. * Get a unique identifier of the content widget.
  4446. */
  4447. getId(): string;
  4448. /**
  4449. * Get the dom node of the content widget.
  4450. */
  4451. getDomNode(): HTMLElement;
  4452. /**
  4453. * Get the placement of the content widget.
  4454. * If null is returned, the content widget will be placed off screen.
  4455. */
  4456. getPosition(): IContentWidgetPosition | null;
  4457. /**
  4458. * Optional function that is invoked before rendering
  4459. * the content widget. If a dimension is returned the editor will
  4460. * attempt to use it.
  4461. */
  4462. beforeRender?(): IDimension | null;
  4463. /**
  4464. * Optional function that is invoked after rendering the content
  4465. * widget. Is being invoked with the selected position preference
  4466. * or `null` if not rendered.
  4467. */
  4468. afterRender?(position: ContentWidgetPositionPreference | null): void;
  4469. }
  4470. /**
  4471. * A positioning preference for rendering overlay widgets.
  4472. */
  4473. export enum OverlayWidgetPositionPreference {
  4474. /**
  4475. * Position the overlay widget in the top right corner
  4476. */
  4477. TOP_RIGHT_CORNER = 0,
  4478. /**
  4479. * Position the overlay widget in the bottom right corner
  4480. */
  4481. BOTTOM_RIGHT_CORNER = 1,
  4482. /**
  4483. * Position the overlay widget in the top center
  4484. */
  4485. TOP_CENTER = 2
  4486. }
  4487. /**
  4488. * A position for rendering overlay widgets.
  4489. */
  4490. export interface IOverlayWidgetPosition {
  4491. /**
  4492. * The position preference for the overlay widget.
  4493. */
  4494. preference: OverlayWidgetPositionPreference | null;
  4495. }
  4496. /**
  4497. * An overlay widgets renders on top of the text.
  4498. */
  4499. export interface IOverlayWidget {
  4500. /**
  4501. * Get a unique identifier of the overlay widget.
  4502. */
  4503. getId(): string;
  4504. /**
  4505. * Get the dom node of the overlay widget.
  4506. */
  4507. getDomNode(): HTMLElement;
  4508. /**
  4509. * Get the placement of the overlay widget.
  4510. * If null is returned, the overlay widget is responsible to place itself.
  4511. */
  4512. getPosition(): IOverlayWidgetPosition | null;
  4513. }
  4514. /**
  4515. * Type of hit element with the mouse in the editor.
  4516. */
  4517. export enum MouseTargetType {
  4518. /**
  4519. * Mouse is on top of an unknown element.
  4520. */
  4521. UNKNOWN = 0,
  4522. /**
  4523. * Mouse is on top of the textarea used for input.
  4524. */
  4525. TEXTAREA = 1,
  4526. /**
  4527. * Mouse is on top of the glyph margin
  4528. */
  4529. GUTTER_GLYPH_MARGIN = 2,
  4530. /**
  4531. * Mouse is on top of the line numbers
  4532. */
  4533. GUTTER_LINE_NUMBERS = 3,
  4534. /**
  4535. * Mouse is on top of the line decorations
  4536. */
  4537. GUTTER_LINE_DECORATIONS = 4,
  4538. /**
  4539. * Mouse is on top of the whitespace left in the gutter by a view zone.
  4540. */
  4541. GUTTER_VIEW_ZONE = 5,
  4542. /**
  4543. * Mouse is on top of text in the content.
  4544. */
  4545. CONTENT_TEXT = 6,
  4546. /**
  4547. * Mouse is on top of empty space in the content (e.g. after line text or below last line)
  4548. */
  4549. CONTENT_EMPTY = 7,
  4550. /**
  4551. * Mouse is on top of a view zone in the content.
  4552. */
  4553. CONTENT_VIEW_ZONE = 8,
  4554. /**
  4555. * Mouse is on top of a content widget.
  4556. */
  4557. CONTENT_WIDGET = 9,
  4558. /**
  4559. * Mouse is on top of the decorations overview ruler.
  4560. */
  4561. OVERVIEW_RULER = 10,
  4562. /**
  4563. * Mouse is on top of a scrollbar.
  4564. */
  4565. SCROLLBAR = 11,
  4566. /**
  4567. * Mouse is on top of an overlay widget.
  4568. */
  4569. OVERLAY_WIDGET = 12,
  4570. /**
  4571. * Mouse is outside of the editor.
  4572. */
  4573. OUTSIDE_EDITOR = 13
  4574. }
  4575. export interface IBaseMouseTarget {
  4576. /**
  4577. * The target element
  4578. */
  4579. readonly element: Element | null;
  4580. /**
  4581. * The 'approximate' editor position
  4582. */
  4583. readonly position: Position | null;
  4584. /**
  4585. * Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line).
  4586. */
  4587. readonly mouseColumn: number;
  4588. /**
  4589. * The 'approximate' editor range
  4590. */
  4591. readonly range: Range | null;
  4592. }
  4593. export interface IMouseTargetUnknown extends IBaseMouseTarget {
  4594. readonly type: MouseTargetType.UNKNOWN;
  4595. }
  4596. export interface IMouseTargetTextarea extends IBaseMouseTarget {
  4597. readonly type: MouseTargetType.TEXTAREA;
  4598. readonly position: null;
  4599. readonly range: null;
  4600. }
  4601. export interface IMouseTargetMarginData {
  4602. readonly isAfterLines: boolean;
  4603. readonly glyphMarginLeft: number;
  4604. readonly glyphMarginWidth: number;
  4605. readonly lineNumbersWidth: number;
  4606. readonly offsetX: number;
  4607. }
  4608. export interface IMouseTargetMargin extends IBaseMouseTarget {
  4609. readonly type: MouseTargetType.GUTTER_GLYPH_MARGIN | MouseTargetType.GUTTER_LINE_NUMBERS | MouseTargetType.GUTTER_LINE_DECORATIONS;
  4610. readonly position: Position;
  4611. readonly range: Range;
  4612. readonly detail: IMouseTargetMarginData;
  4613. }
  4614. export interface IMouseTargetViewZoneData {
  4615. readonly viewZoneId: string;
  4616. readonly positionBefore: Position | null;
  4617. readonly positionAfter: Position | null;
  4618. readonly position: Position;
  4619. readonly afterLineNumber: number;
  4620. }
  4621. export interface IMouseTargetViewZone extends IBaseMouseTarget {
  4622. readonly type: MouseTargetType.GUTTER_VIEW_ZONE | MouseTargetType.CONTENT_VIEW_ZONE;
  4623. readonly position: Position;
  4624. readonly range: Range;
  4625. readonly detail: IMouseTargetViewZoneData;
  4626. }
  4627. export interface IMouseTargetContentTextData {
  4628. readonly mightBeForeignElement: boolean;
  4629. }
  4630. export interface IMouseTargetContentText extends IBaseMouseTarget {
  4631. readonly type: MouseTargetType.CONTENT_TEXT;
  4632. readonly position: Position;
  4633. readonly range: Range;
  4634. readonly detail: IMouseTargetContentTextData;
  4635. }
  4636. export interface IMouseTargetContentEmptyData {
  4637. readonly isAfterLines: boolean;
  4638. readonly horizontalDistanceToText?: number;
  4639. }
  4640. export interface IMouseTargetContentEmpty extends IBaseMouseTarget {
  4641. readonly type: MouseTargetType.CONTENT_EMPTY;
  4642. readonly position: Position;
  4643. readonly range: Range;
  4644. readonly detail: IMouseTargetContentEmptyData;
  4645. }
  4646. export interface IMouseTargetContentWidget extends IBaseMouseTarget {
  4647. readonly type: MouseTargetType.CONTENT_WIDGET;
  4648. readonly position: null;
  4649. readonly range: null;
  4650. readonly detail: string;
  4651. }
  4652. export interface IMouseTargetOverlayWidget extends IBaseMouseTarget {
  4653. readonly type: MouseTargetType.OVERLAY_WIDGET;
  4654. readonly position: null;
  4655. readonly range: null;
  4656. readonly detail: string;
  4657. }
  4658. export interface IMouseTargetScrollbar extends IBaseMouseTarget {
  4659. readonly type: MouseTargetType.SCROLLBAR;
  4660. readonly position: Position;
  4661. readonly range: Range;
  4662. }
  4663. export interface IMouseTargetOverviewRuler extends IBaseMouseTarget {
  4664. readonly type: MouseTargetType.OVERVIEW_RULER;
  4665. }
  4666. export interface IMouseTargetOutsideEditor extends IBaseMouseTarget {
  4667. readonly type: MouseTargetType.OUTSIDE_EDITOR;
  4668. }
  4669. /**
  4670. * Target hit with the mouse in the editor.
  4671. */
  4672. export type IMouseTarget = (IMouseTargetUnknown | IMouseTargetTextarea | IMouseTargetMargin | IMouseTargetViewZone | IMouseTargetContentText | IMouseTargetContentEmpty | IMouseTargetContentWidget | IMouseTargetOverlayWidget | IMouseTargetScrollbar | IMouseTargetOverviewRuler | IMouseTargetOutsideEditor);
  4673. /**
  4674. * A mouse event originating from the editor.
  4675. */
  4676. export interface IEditorMouseEvent {
  4677. readonly event: IMouseEvent;
  4678. readonly target: IMouseTarget;
  4679. }
  4680. export interface IPartialEditorMouseEvent {
  4681. readonly event: IMouseEvent;
  4682. readonly target: IMouseTarget | null;
  4683. }
  4684. /**
  4685. * A paste event originating from the editor.
  4686. */
  4687. export interface IPasteEvent {
  4688. readonly range: Range;
  4689. readonly languageId: string | null;
  4690. }
  4691. export interface IDiffEditorConstructionOptions extends IDiffEditorOptions {
  4692. /**
  4693. * The initial editor dimension (to avoid measuring the container).
  4694. */
  4695. dimension?: IDimension;
  4696. /**
  4697. * Place overflow widgets inside an external DOM node.
  4698. * Defaults to an internal DOM node.
  4699. */
  4700. overflowWidgetsDomNode?: HTMLElement;
  4701. /**
  4702. * Aria label for original editor.
  4703. */
  4704. originalAriaLabel?: string;
  4705. /**
  4706. * Aria label for modified editor.
  4707. */
  4708. modifiedAriaLabel?: string;
  4709. /**
  4710. * Is the diff editor inside another editor
  4711. * Defaults to false
  4712. */
  4713. isInEmbeddedEditor?: boolean;
  4714. }
  4715. /**
  4716. * A rich code editor.
  4717. */
  4718. export interface ICodeEditor extends IEditor {
  4719. /**
  4720. * An event emitted when the content of the current model has changed.
  4721. * @event
  4722. */
  4723. readonly onDidChangeModelContent: IEvent<IModelContentChangedEvent>;
  4724. /**
  4725. * An event emitted when the language of the current model has changed.
  4726. * @event
  4727. */
  4728. readonly onDidChangeModelLanguage: IEvent<IModelLanguageChangedEvent>;
  4729. /**
  4730. * An event emitted when the language configuration of the current model has changed.
  4731. * @event
  4732. */
  4733. readonly onDidChangeModelLanguageConfiguration: IEvent<IModelLanguageConfigurationChangedEvent>;
  4734. /**
  4735. * An event emitted when the options of the current model has changed.
  4736. * @event
  4737. */
  4738. readonly onDidChangeModelOptions: IEvent<IModelOptionsChangedEvent>;
  4739. /**
  4740. * An event emitted when the configuration of the editor has changed. (e.g. `editor.updateOptions()`)
  4741. * @event
  4742. */
  4743. readonly onDidChangeConfiguration: IEvent<ConfigurationChangedEvent>;
  4744. /**
  4745. * An event emitted when the cursor position has changed.
  4746. * @event
  4747. */
  4748. readonly onDidChangeCursorPosition: IEvent<ICursorPositionChangedEvent>;
  4749. /**
  4750. * An event emitted when the cursor selection has changed.
  4751. * @event
  4752. */
  4753. readonly onDidChangeCursorSelection: IEvent<ICursorSelectionChangedEvent>;
  4754. /**
  4755. * An event emitted when the model of this editor has changed (e.g. `editor.setModel()`).
  4756. * @event
  4757. */
  4758. readonly onDidChangeModel: IEvent<IModelChangedEvent>;
  4759. /**
  4760. * An event emitted when the decorations of the current model have changed.
  4761. * @event
  4762. */
  4763. readonly onDidChangeModelDecorations: IEvent<IModelDecorationsChangedEvent>;
  4764. /**
  4765. * An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking).
  4766. * @event
  4767. */
  4768. readonly onDidFocusEditorText: IEvent<void>;
  4769. /**
  4770. * An event emitted when the text inside this editor lost focus (i.e. cursor stops blinking).
  4771. * @event
  4772. */
  4773. readonly onDidBlurEditorText: IEvent<void>;
  4774. /**
  4775. * An event emitted when the text inside this editor or an editor widget gained focus.
  4776. * @event
  4777. */
  4778. readonly onDidFocusEditorWidget: IEvent<void>;
  4779. /**
  4780. * An event emitted when the text inside this editor or an editor widget lost focus.
  4781. * @event
  4782. */
  4783. readonly onDidBlurEditorWidget: IEvent<void>;
  4784. /**
  4785. * An event emitted after composition has started.
  4786. */
  4787. readonly onDidCompositionStart: IEvent<void>;
  4788. /**
  4789. * An event emitted after composition has ended.
  4790. */
  4791. readonly onDidCompositionEnd: IEvent<void>;
  4792. /**
  4793. * An event emitted when editing failed because the editor is read-only.
  4794. * @event
  4795. */
  4796. readonly onDidAttemptReadOnlyEdit: IEvent<void>;
  4797. /**
  4798. * An event emitted when users paste text in the editor.
  4799. * @event
  4800. */
  4801. readonly onDidPaste: IEvent<IPasteEvent>;
  4802. /**
  4803. * An event emitted on a "mouseup".
  4804. * @event
  4805. */
  4806. readonly onMouseUp: IEvent<IEditorMouseEvent>;
  4807. /**
  4808. * An event emitted on a "mousedown".
  4809. * @event
  4810. */
  4811. readonly onMouseDown: IEvent<IEditorMouseEvent>;
  4812. /**
  4813. * An event emitted on a "contextmenu".
  4814. * @event
  4815. */
  4816. readonly onContextMenu: IEvent<IEditorMouseEvent>;
  4817. /**
  4818. * An event emitted on a "mousemove".
  4819. * @event
  4820. */
  4821. readonly onMouseMove: IEvent<IEditorMouseEvent>;
  4822. /**
  4823. * An event emitted on a "mouseleave".
  4824. * @event
  4825. */
  4826. readonly onMouseLeave: IEvent<IPartialEditorMouseEvent>;
  4827. /**
  4828. * An event emitted on a "keyup".
  4829. * @event
  4830. */
  4831. readonly onKeyUp: IEvent<IKeyboardEvent>;
  4832. /**
  4833. * An event emitted on a "keydown".
  4834. * @event
  4835. */
  4836. readonly onKeyDown: IEvent<IKeyboardEvent>;
  4837. /**
  4838. * An event emitted when the layout of the editor has changed.
  4839. * @event
  4840. */
  4841. readonly onDidLayoutChange: IEvent<EditorLayoutInfo>;
  4842. /**
  4843. * An event emitted when the content width or content height in the editor has changed.
  4844. * @event
  4845. */
  4846. readonly onDidContentSizeChange: IEvent<IContentSizeChangedEvent>;
  4847. /**
  4848. * An event emitted when the scroll in the editor has changed.
  4849. * @event
  4850. */
  4851. readonly onDidScrollChange: IEvent<IScrollEvent>;
  4852. /**
  4853. * An event emitted when hidden areas change in the editor (e.g. due to folding).
  4854. * @event
  4855. */
  4856. readonly onDidChangeHiddenAreas: IEvent<void>;
  4857. /**
  4858. * Saves current view state of the editor in a serializable object.
  4859. */
  4860. saveViewState(): ICodeEditorViewState | null;
  4861. /**
  4862. * Restores the view state of the editor from a serializable object generated by `saveViewState`.
  4863. */
  4864. restoreViewState(state: ICodeEditorViewState): void;
  4865. /**
  4866. * Returns true if the text inside this editor or an editor widget has focus.
  4867. */
  4868. hasWidgetFocus(): boolean;
  4869. /**
  4870. * Get a contribution of this editor.
  4871. * @id Unique identifier of the contribution.
  4872. * @return The contribution or null if contribution not found.
  4873. */
  4874. getContribution<T extends IEditorContribution>(id: string): T | null;
  4875. /**
  4876. * Type the getModel() of IEditor.
  4877. */
  4878. getModel(): ITextModel | null;
  4879. /**
  4880. * Sets the current model attached to this editor.
  4881. * If the previous model was created by the editor via the value key in the options
  4882. * literal object, it will be destroyed. Otherwise, if the previous model was set
  4883. * via setModel, or the model key in the options literal object, the previous model
  4884. * will not be destroyed.
  4885. * It is safe to call setModel(null) to simply detach the current model from the editor.
  4886. */
  4887. setModel(model: ITextModel | null): void;
  4888. /**
  4889. * Gets all the editor computed options.
  4890. */
  4891. getOptions(): IComputedEditorOptions;
  4892. /**
  4893. * Gets a specific editor option.
  4894. */
  4895. getOption<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T>;
  4896. /**
  4897. * Returns the editor's configuration (without any validation or defaults).
  4898. */
  4899. getRawOptions(): IEditorOptions;
  4900. /**
  4901. * Get value of the current model attached to this editor.
  4902. * @see {@link ITextModel.getValue}
  4903. */
  4904. getValue(options?: {
  4905. preserveBOM: boolean;
  4906. lineEnding: string;
  4907. }): string;
  4908. /**
  4909. * Set the value of the current model attached to this editor.
  4910. * @see {@link ITextModel.setValue}
  4911. */
  4912. setValue(newValue: string): void;
  4913. /**
  4914. * Get the width of the editor's content.
  4915. * This is information that is "erased" when computing `scrollWidth = Math.max(contentWidth, width)`
  4916. */
  4917. getContentWidth(): number;
  4918. /**
  4919. * Get the scrollWidth of the editor's viewport.
  4920. */
  4921. getScrollWidth(): number;
  4922. /**
  4923. * Get the scrollLeft of the editor's viewport.
  4924. */
  4925. getScrollLeft(): number;
  4926. /**
  4927. * Get the height of the editor's content.
  4928. * This is information that is "erased" when computing `scrollHeight = Math.max(contentHeight, height)`
  4929. */
  4930. getContentHeight(): number;
  4931. /**
  4932. * Get the scrollHeight of the editor's viewport.
  4933. */
  4934. getScrollHeight(): number;
  4935. /**
  4936. * Get the scrollTop of the editor's viewport.
  4937. */
  4938. getScrollTop(): number;
  4939. /**
  4940. * Change the scrollLeft of the editor's viewport.
  4941. */
  4942. setScrollLeft(newScrollLeft: number, scrollType?: ScrollType): void;
  4943. /**
  4944. * Change the scrollTop of the editor's viewport.
  4945. */
  4946. setScrollTop(newScrollTop: number, scrollType?: ScrollType): void;
  4947. /**
  4948. * Change the scroll position of the editor's viewport.
  4949. */
  4950. setScrollPosition(position: INewScrollPosition, scrollType?: ScrollType): void;
  4951. /**
  4952. * Get an action that is a contribution to this editor.
  4953. * @id Unique identifier of the contribution.
  4954. * @return The action or null if action not found.
  4955. */
  4956. getAction(id: string): IEditorAction;
  4957. /**
  4958. * Execute a command on the editor.
  4959. * The edits will land on the undo-redo stack, but no "undo stop" will be pushed.
  4960. * @param source The source of the call.
  4961. * @param command The command to execute
  4962. */
  4963. executeCommand(source: string | null | undefined, command: ICommand): void;
  4964. /**
  4965. * Create an "undo stop" in the undo-redo stack.
  4966. */
  4967. pushUndoStop(): boolean;
  4968. /**
  4969. * Remove the "undo stop" in the undo-redo stack.
  4970. */
  4971. popUndoStop(): boolean;
  4972. /**
  4973. * Execute edits on the editor.
  4974. * The edits will land on the undo-redo stack, but no "undo stop" will be pushed.
  4975. * @param source The source of the call.
  4976. * @param edits The edits to execute.
  4977. * @param endCursorState Cursor state after the edits were applied.
  4978. */
  4979. executeEdits(source: string | null | undefined, edits: IIdentifiedSingleEditOperation[], endCursorState?: ICursorStateComputer | Selection[]): boolean;
  4980. /**
  4981. * Execute multiple (concomitant) commands on the editor.
  4982. * @param source The source of the call.
  4983. * @param command The commands to execute
  4984. */
  4985. executeCommands(source: string | null | undefined, commands: (ICommand | null)[]): void;
  4986. /**
  4987. * Get all the decorations on a line (filtering out decorations from other editors).
  4988. */
  4989. getLineDecorations(lineNumber: number): IModelDecoration[] | null;
  4990. /**
  4991. * Get all the decorations for a range (filtering out decorations from other editors).
  4992. */
  4993. getDecorationsInRange(range: Range): IModelDecoration[] | null;
  4994. /**
  4995. * All decorations added through this call will get the ownerId of this editor.
  4996. * @see {@link ITextModel.deltaDecorations}
  4997. */
  4998. deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[];
  4999. /**
  5000. * Get the layout info for the editor.
  5001. */
  5002. getLayoutInfo(): EditorLayoutInfo;
  5003. /**
  5004. * Returns the ranges that are currently visible.
  5005. * Does not account for horizontal scrolling.
  5006. */
  5007. getVisibleRanges(): Range[];
  5008. /**
  5009. * Get the vertical position (top offset) for the line w.r.t. to the first line.
  5010. */
  5011. getTopForLineNumber(lineNumber: number): number;
  5012. /**
  5013. * Get the vertical position (top offset) for the position w.r.t. to the first line.
  5014. */
  5015. getTopForPosition(lineNumber: number, column: number): number;
  5016. /**
  5017. * Returns the editor's container dom node
  5018. */
  5019. getContainerDomNode(): HTMLElement;
  5020. /**
  5021. * Returns the editor's dom node
  5022. */
  5023. getDomNode(): HTMLElement | null;
  5024. /**
  5025. * Add a content widget. Widgets must have unique ids, otherwise they will be overwritten.
  5026. */
  5027. addContentWidget(widget: IContentWidget): void;
  5028. /**
  5029. * Layout/Reposition a content widget. This is a ping to the editor to call widget.getPosition()
  5030. * and update appropriately.
  5031. */
  5032. layoutContentWidget(widget: IContentWidget): void;
  5033. /**
  5034. * Remove a content widget.
  5035. */
  5036. removeContentWidget(widget: IContentWidget): void;
  5037. /**
  5038. * Add an overlay widget. Widgets must have unique ids, otherwise they will be overwritten.
  5039. */
  5040. addOverlayWidget(widget: IOverlayWidget): void;
  5041. /**
  5042. * Layout/Reposition an overlay widget. This is a ping to the editor to call widget.getPosition()
  5043. * and update appropriately.
  5044. */
  5045. layoutOverlayWidget(widget: IOverlayWidget): void;
  5046. /**
  5047. * Remove an overlay widget.
  5048. */
  5049. removeOverlayWidget(widget: IOverlayWidget): void;
  5050. /**
  5051. * Change the view zones. View zones are lost when a new model is attached to the editor.
  5052. */
  5053. changeViewZones(callback: (accessor: IViewZoneChangeAccessor) => void): void;
  5054. /**
  5055. * Get the horizontal position (left offset) for the column w.r.t to the beginning of the line.
  5056. * This method works only if the line `lineNumber` is currently rendered (in the editor's viewport).
  5057. * Use this method with caution.
  5058. */
  5059. getOffsetForColumn(lineNumber: number, column: number): number;
  5060. /**
  5061. * Force an editor render now.
  5062. */
  5063. render(forceRedraw?: boolean): void;
  5064. /**
  5065. * Get the hit test target at coordinates `clientX` and `clientY`.
  5066. * The coordinates are relative to the top-left of the viewport.
  5067. *
  5068. * @returns Hit test target or null if the coordinates fall outside the editor or the editor has no model.
  5069. */
  5070. getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget | null;
  5071. /**
  5072. * Get the visible position for `position`.
  5073. * The result position takes scrolling into account and is relative to the top left corner of the editor.
  5074. * Explanation 1: the results of this method will change for the same `position` if the user scrolls the editor.
  5075. * Explanation 2: the results of this method will not change if the container of the editor gets repositioned.
  5076. * Warning: the results of this method are inaccurate for positions that are outside the current editor viewport.
  5077. */
  5078. getScrolledVisiblePosition(position: IPosition): {
  5079. top: number;
  5080. left: number;
  5081. height: number;
  5082. } | null;
  5083. /**
  5084. * Apply the same font settings as the editor to `target`.
  5085. */
  5086. applyFontInfo(target: HTMLElement): void;
  5087. setBanner(bannerDomNode: HTMLElement | null, height: number): void;
  5088. }
  5089. /**
  5090. * Information about a line in the diff editor
  5091. */
  5092. export interface IDiffLineInformation {
  5093. readonly equivalentLineNumber: number;
  5094. }
  5095. /**
  5096. * A rich diff editor.
  5097. */
  5098. export interface IDiffEditor extends IEditor {
  5099. /**
  5100. * @see {@link ICodeEditor.getContainerDomNode}
  5101. */
  5102. getContainerDomNode(): HTMLElement;
  5103. /**
  5104. * An event emitted when the diff information computed by this diff editor has been updated.
  5105. * @event
  5106. */
  5107. readonly onDidUpdateDiff: IEvent<void>;
  5108. /**
  5109. * Saves current view state of the editor in a serializable object.
  5110. */
  5111. saveViewState(): IDiffEditorViewState | null;
  5112. /**
  5113. * Restores the view state of the editor from a serializable object generated by `saveViewState`.
  5114. */
  5115. restoreViewState(state: IDiffEditorViewState): void;
  5116. /**
  5117. * Type the getModel() of IEditor.
  5118. */
  5119. getModel(): IDiffEditorModel | null;
  5120. /**
  5121. * Sets the current model attached to this editor.
  5122. * If the previous model was created by the editor via the value key in the options
  5123. * literal object, it will be destroyed. Otherwise, if the previous model was set
  5124. * via setModel, or the model key in the options literal object, the previous model
  5125. * will not be destroyed.
  5126. * It is safe to call setModel(null) to simply detach the current model from the editor.
  5127. */
  5128. setModel(model: IDiffEditorModel | null): void;
  5129. /**
  5130. * Get the `original` editor.
  5131. */
  5132. getOriginalEditor(): ICodeEditor;
  5133. /**
  5134. * Get the `modified` editor.
  5135. */
  5136. getModifiedEditor(): ICodeEditor;
  5137. /**
  5138. * Get the computed diff information.
  5139. */
  5140. getLineChanges(): ILineChange[] | null;
  5141. /**
  5142. * Get information based on computed diff about a line number from the original model.
  5143. * If the diff computation is not finished or the model is missing, will return null.
  5144. */
  5145. getDiffLineInformationForOriginal(lineNumber: number): IDiffLineInformation | null;
  5146. /**
  5147. * Get information based on computed diff about a line number from the modified model.
  5148. * If the diff computation is not finished or the model is missing, will return null.
  5149. */
  5150. getDiffLineInformationForModified(lineNumber: number): IDiffLineInformation | null;
  5151. /**
  5152. * Update the editor's options after the editor has been created.
  5153. */
  5154. updateOptions(newOptions: IDiffEditorOptions): void;
  5155. }
  5156. export class FontInfo extends BareFontInfo {
  5157. readonly _editorStylingBrand: void;
  5158. readonly version: number;
  5159. readonly isTrusted: boolean;
  5160. readonly isMonospace: boolean;
  5161. readonly typicalHalfwidthCharacterWidth: number;
  5162. readonly typicalFullwidthCharacterWidth: number;
  5163. readonly canUseHalfwidthRightwardsArrow: boolean;
  5164. readonly spaceWidth: number;
  5165. readonly middotWidth: number;
  5166. readonly wsmiddotWidth: number;
  5167. readonly maxDigitWidth: number;
  5168. }
  5169. export class BareFontInfo {
  5170. readonly _bareFontInfoBrand: void;
  5171. readonly pixelRatio: number;
  5172. readonly fontFamily: string;
  5173. readonly fontWeight: string;
  5174. readonly fontSize: number;
  5175. readonly fontFeatureSettings: string;
  5176. readonly lineHeight: number;
  5177. readonly letterSpacing: number;
  5178. }
  5179. //compatibility:
  5180. export type IReadOnlyModel = ITextModel;
  5181. export type IModel = ITextModel;
  5182. }
  5183. declare namespace monaco.languages {
  5184. /**
  5185. * Register information about a new language.
  5186. */
  5187. export function register(language: ILanguageExtensionPoint): void;
  5188. /**
  5189. * Get the information of all the registered languages.
  5190. */
  5191. export function getLanguages(): ILanguageExtensionPoint[];
  5192. export function getEncodedLanguageId(languageId: string): number;
  5193. /**
  5194. * An event emitted when a language is needed for the first time (e.g. a model has it set).
  5195. * @event
  5196. */
  5197. export function onLanguage(languageId: string, callback: () => void): IDisposable;
  5198. /**
  5199. * Set the editing configuration for a language.
  5200. */
  5201. export function setLanguageConfiguration(languageId: string, configuration: LanguageConfiguration): IDisposable;
  5202. /**
  5203. * A token.
  5204. */
  5205. export interface IToken {
  5206. startIndex: number;
  5207. scopes: string;
  5208. }
  5209. /**
  5210. * The result of a line tokenization.
  5211. */
  5212. export interface ILineTokens {
  5213. /**
  5214. * The list of tokens on the line.
  5215. */
  5216. tokens: IToken[];
  5217. /**
  5218. * The tokenization end state.
  5219. * A pointer will be held to this and the object should not be modified by the tokenizer after the pointer is returned.
  5220. */
  5221. endState: IState;
  5222. }
  5223. /**
  5224. * The result of a line tokenization.
  5225. */
  5226. export interface IEncodedLineTokens {
  5227. /**
  5228. * The tokens on the line in a binary, encoded format. Each token occupies two array indices. For token i:
  5229. * - at offset 2*i => startIndex
  5230. * - at offset 2*i + 1 => metadata
  5231. * Meta data is in binary format:
  5232. * - -------------------------------------------
  5233. * 3322 2222 2222 1111 1111 1100 0000 0000
  5234. * 1098 7654 3210 9876 5432 1098 7654 3210
  5235. * - -------------------------------------------
  5236. * bbbb bbbb bfff ffff ffFF FFTT LLLL LLLL
  5237. * - -------------------------------------------
  5238. * - L = EncodedLanguageId (8 bits): Use `getEncodedLanguageId` to get the encoded ID of a language.
  5239. * - T = StandardTokenType (2 bits): Other = 0, Comment = 1, String = 2, RegEx = 3.
  5240. * - F = FontStyle (4 bits): None = 0, Italic = 1, Bold = 2, Underline = 4, Strikethrough = 8.
  5241. * - f = foreground ColorId (9 bits)
  5242. * - b = background ColorId (9 bits)
  5243. * - The color value for each colorId is defined in IStandaloneThemeData.customTokenColors:
  5244. * e.g. colorId = 1 is stored in IStandaloneThemeData.customTokenColors[1]. Color id = 0 means no color,
  5245. * id = 1 is for the default foreground color, id = 2 for the default background.
  5246. */
  5247. tokens: Uint32Array;
  5248. /**
  5249. * The tokenization end state.
  5250. * A pointer will be held to this and the object should not be modified by the tokenizer after the pointer is returned.
  5251. */
  5252. endState: IState;
  5253. }
  5254. /**
  5255. * A factory for token providers.
  5256. */
  5257. export interface TokensProviderFactory {
  5258. create(): ProviderResult<TokensProvider | EncodedTokensProvider | IMonarchLanguage>;
  5259. }
  5260. /**
  5261. * A "manual" provider of tokens.
  5262. */
  5263. export interface TokensProvider {
  5264. /**
  5265. * The initial state of a language. Will be the state passed in to tokenize the first line.
  5266. */
  5267. getInitialState(): IState;
  5268. /**
  5269. * Tokenize a line given the state at the beginning of the line.
  5270. */
  5271. tokenize(line: string, state: IState): ILineTokens;
  5272. }
  5273. /**
  5274. * A "manual" provider of tokens, returning tokens in a binary form.
  5275. */
  5276. export interface EncodedTokensProvider {
  5277. /**
  5278. * The initial state of a language. Will be the state passed in to tokenize the first line.
  5279. */
  5280. getInitialState(): IState;
  5281. /**
  5282. * Tokenize a line given the state at the beginning of the line.
  5283. */
  5284. tokenizeEncoded(line: string, state: IState): IEncodedLineTokens;
  5285. /**
  5286. * Tokenize a line given the state at the beginning of the line.
  5287. */
  5288. tokenize?(line: string, state: IState): ILineTokens;
  5289. }
  5290. /**
  5291. * Change the color map that is used for token colors.
  5292. * Supported formats (hex): #RRGGBB, $RRGGBBAA, #RGB, #RGBA
  5293. */
  5294. export function setColorMap(colorMap: string[] | null): void;
  5295. /**
  5296. * Register a tokens provider factory for a language. This tokenizer will be exclusive with a tokenizer
  5297. * set using `setTokensProvider` or one created using `setMonarchTokensProvider`, but will work together
  5298. * with a tokens provider set using `registerDocumentSemanticTokensProvider` or `registerDocumentRangeSemanticTokensProvider`.
  5299. */
  5300. export function registerTokensProviderFactory(languageId: string, factory: TokensProviderFactory): IDisposable;
  5301. /**
  5302. * Set the tokens provider for a language (manual implementation). This tokenizer will be exclusive
  5303. * with a tokenizer created using `setMonarchTokensProvider`, or with `registerTokensProviderFactory`,
  5304. * but will work together with a tokens provider set using `registerDocumentSemanticTokensProvider`
  5305. * or `registerDocumentRangeSemanticTokensProvider`.
  5306. */
  5307. export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider | Thenable<TokensProvider | EncodedTokensProvider>): IDisposable;
  5308. /**
  5309. * Set the tokens provider for a language (monarch implementation). This tokenizer will be exclusive
  5310. * with a tokenizer set using `setTokensProvider`, or with `registerTokensProviderFactory`, but will
  5311. * work together with a tokens provider set using `registerDocumentSemanticTokensProvider` or
  5312. * `registerDocumentRangeSemanticTokensProvider`.
  5313. */
  5314. export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage | Thenable<IMonarchLanguage>): IDisposable;
  5315. /**
  5316. * Register a reference provider (used by e.g. reference search).
  5317. */
  5318. export function registerReferenceProvider(languageId: string, provider: ReferenceProvider): IDisposable;
  5319. /**
  5320. * Register a rename provider (used by e.g. rename symbol).
  5321. */
  5322. export function registerRenameProvider(languageId: string, provider: RenameProvider): IDisposable;
  5323. /**
  5324. * Register a signature help provider (used by e.g. parameter hints).
  5325. */
  5326. export function registerSignatureHelpProvider(languageId: string, provider: SignatureHelpProvider): IDisposable;
  5327. /**
  5328. * Register a hover provider (used by e.g. editor hover).
  5329. */
  5330. export function registerHoverProvider(languageId: string, provider: HoverProvider): IDisposable;
  5331. /**
  5332. * Register a document symbol provider (used by e.g. outline).
  5333. */
  5334. export function registerDocumentSymbolProvider(languageId: string, provider: DocumentSymbolProvider): IDisposable;
  5335. /**
  5336. * Register a document highlight provider (used by e.g. highlight occurrences).
  5337. */
  5338. export function registerDocumentHighlightProvider(languageId: string, provider: DocumentHighlightProvider): IDisposable;
  5339. /**
  5340. * Register an linked editing range provider.
  5341. */
  5342. export function registerLinkedEditingRangeProvider(languageId: string, provider: LinkedEditingRangeProvider): IDisposable;
  5343. /**
  5344. * Register a definition provider (used by e.g. go to definition).
  5345. */
  5346. export function registerDefinitionProvider(languageId: string, provider: DefinitionProvider): IDisposable;
  5347. /**
  5348. * Register a implementation provider (used by e.g. go to implementation).
  5349. */
  5350. export function registerImplementationProvider(languageId: string, provider: ImplementationProvider): IDisposable;
  5351. /**
  5352. * Register a type definition provider (used by e.g. go to type definition).
  5353. */
  5354. export function registerTypeDefinitionProvider(languageId: string, provider: TypeDefinitionProvider): IDisposable;
  5355. /**
  5356. * Register a code lens provider (used by e.g. inline code lenses).
  5357. */
  5358. export function registerCodeLensProvider(languageId: string, provider: CodeLensProvider): IDisposable;
  5359. /**
  5360. * Register a code action provider (used by e.g. quick fix).
  5361. */
  5362. export function registerCodeActionProvider(languageId: string, provider: CodeActionProvider, metadata?: CodeActionProviderMetadata): IDisposable;
  5363. /**
  5364. * Register a formatter that can handle only entire models.
  5365. */
  5366. export function registerDocumentFormattingEditProvider(languageId: string, provider: DocumentFormattingEditProvider): IDisposable;
  5367. /**
  5368. * Register a formatter that can handle a range inside a model.
  5369. */
  5370. export function registerDocumentRangeFormattingEditProvider(languageId: string, provider: DocumentRangeFormattingEditProvider): IDisposable;
  5371. /**
  5372. * Register a formatter than can do formatting as the user types.
  5373. */
  5374. export function registerOnTypeFormattingEditProvider(languageId: string, provider: OnTypeFormattingEditProvider): IDisposable;
  5375. /**
  5376. * Register a link provider that can find links in text.
  5377. */
  5378. export function registerLinkProvider(languageId: string, provider: LinkProvider): IDisposable;
  5379. /**
  5380. * Register a completion item provider (use by e.g. suggestions).
  5381. */
  5382. export function registerCompletionItemProvider(languageId: string, provider: CompletionItemProvider): IDisposable;
  5383. /**
  5384. * Register a document color provider (used by Color Picker, Color Decorator).
  5385. */
  5386. export function registerColorProvider(languageId: string, provider: DocumentColorProvider): IDisposable;
  5387. /**
  5388. * Register a folding range provider
  5389. */
  5390. export function registerFoldingRangeProvider(languageId: string, provider: FoldingRangeProvider): IDisposable;
  5391. /**
  5392. * Register a declaration provider
  5393. */
  5394. export function registerDeclarationProvider(languageId: string, provider: DeclarationProvider): IDisposable;
  5395. /**
  5396. * Register a selection range provider
  5397. */
  5398. export function registerSelectionRangeProvider(languageId: string, provider: SelectionRangeProvider): IDisposable;
  5399. /**
  5400. * Register a document semantic tokens provider. A semantic tokens provider will complement and enhance a
  5401. * simple top-down tokenizer. Simple top-down tokenizers can be set either via `setMonarchTokensProvider`
  5402. * or `setTokensProvider`.
  5403. *
  5404. * For the best user experience, register both a semantic tokens provider and a top-down tokenizer.
  5405. */
  5406. export function registerDocumentSemanticTokensProvider(languageId: string, provider: DocumentSemanticTokensProvider): IDisposable;
  5407. /**
  5408. * Register a document range semantic tokens provider. A semantic tokens provider will complement and enhance a
  5409. * simple top-down tokenizer. Simple top-down tokenizers can be set either via `setMonarchTokensProvider`
  5410. * or `setTokensProvider`.
  5411. *
  5412. * For the best user experience, register both a semantic tokens provider and a top-down tokenizer.
  5413. */
  5414. export function registerDocumentRangeSemanticTokensProvider(languageId: string, provider: DocumentRangeSemanticTokensProvider): IDisposable;
  5415. /**
  5416. * Register an inline completions provider.
  5417. */
  5418. export function registerInlineCompletionsProvider(languageId: string, provider: InlineCompletionsProvider): IDisposable;
  5419. /**
  5420. * Register an inlay hints provider.
  5421. */
  5422. export function registerInlayHintsProvider(languageId: string, provider: InlayHintsProvider): IDisposable;
  5423. /**
  5424. * Contains additional diagnostic information about the context in which
  5425. * a [code action](#CodeActionProvider.provideCodeActions) is run.
  5426. */
  5427. export interface CodeActionContext {
  5428. /**
  5429. * An array of diagnostics.
  5430. */
  5431. readonly markers: editor.IMarkerData[];
  5432. /**
  5433. * Requested kind of actions to return.
  5434. */
  5435. readonly only?: string;
  5436. }
  5437. /**
  5438. * The code action interface defines the contract between extensions and
  5439. * the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature.
  5440. */
  5441. export interface CodeActionProvider {
  5442. /**
  5443. * Provide commands for the given document and range.
  5444. */
  5445. provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): ProviderResult<CodeActionList>;
  5446. /**
  5447. * Given a code action fill in the edit. Will only invoked when missing.
  5448. */
  5449. resolveCodeAction?(codeAction: CodeAction, token: CancellationToken): ProviderResult<CodeAction>;
  5450. }
  5451. /**
  5452. * Metadata about the type of code actions that a {@link CodeActionProvider} provides.
  5453. */
  5454. export interface CodeActionProviderMetadata {
  5455. /**
  5456. * List of code action kinds that a {@link CodeActionProvider} may return.
  5457. *
  5458. * This list is used to determine if a given `CodeActionProvider` should be invoked or not.
  5459. * To avoid unnecessary computation, every `CodeActionProvider` should list use `providedCodeActionKinds`. The
  5460. * list of kinds may either be generic, such as `["quickfix", "refactor", "source"]`, or list out every kind provided,
  5461. * such as `["quickfix.removeLine", "source.fixAll" ...]`.
  5462. */
  5463. readonly providedCodeActionKinds?: readonly string[];
  5464. }
  5465. /**
  5466. * Describes how comments for a language work.
  5467. */
  5468. export interface CommentRule {
  5469. /**
  5470. * The line comment token, like `// this is a comment`
  5471. */
  5472. lineComment?: string | null;
  5473. /**
  5474. * The block comment character pair, like `/* block comment *&#47;`
  5475. */
  5476. blockComment?: CharacterPair | null;
  5477. }
  5478. /**
  5479. * The language configuration interface defines the contract between extensions and
  5480. * various editor features, like automatic bracket insertion, automatic indentation etc.
  5481. */
  5482. export interface LanguageConfiguration {
  5483. /**
  5484. * The language's comment settings.
  5485. */
  5486. comments?: CommentRule;
  5487. /**
  5488. * The language's brackets.
  5489. * This configuration implicitly affects pressing Enter around these brackets.
  5490. */
  5491. brackets?: CharacterPair[];
  5492. /**
  5493. * The language's word definition.
  5494. * If the language supports Unicode identifiers (e.g. JavaScript), it is preferable
  5495. * to provide a word definition that uses exclusion of known separators.
  5496. * e.g.: A regex that matches anything except known separators (and dot is allowed to occur in a floating point number):
  5497. * /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
  5498. */
  5499. wordPattern?: RegExp;
  5500. /**
  5501. * The language's indentation settings.
  5502. */
  5503. indentationRules?: IndentationRule;
  5504. /**
  5505. * The language's rules to be evaluated when pressing Enter.
  5506. */
  5507. onEnterRules?: OnEnterRule[];
  5508. /**
  5509. * The language's auto closing pairs. The 'close' character is automatically inserted with the
  5510. * 'open' character is typed. If not set, the configured brackets will be used.
  5511. */
  5512. autoClosingPairs?: IAutoClosingPairConditional[];
  5513. /**
  5514. * The language's surrounding pairs. When the 'open' character is typed on a selection, the
  5515. * selected string is surrounded by the open and close characters. If not set, the autoclosing pairs
  5516. * settings will be used.
  5517. */
  5518. surroundingPairs?: IAutoClosingPair[];
  5519. /**
  5520. * Defines a list of bracket pairs that are colorized depending on their nesting level.
  5521. * If not set, the configured brackets will be used.
  5522. */
  5523. colorizedBracketPairs?: CharacterPair[];
  5524. /**
  5525. * Defines what characters must be after the cursor for bracket or quote autoclosing to occur when using the \'languageDefined\' autoclosing setting.
  5526. *
  5527. * This is typically the set of characters which can not start an expression, such as whitespace, closing brackets, non-unary operators, etc.
  5528. */
  5529. autoCloseBefore?: string;
  5530. /**
  5531. * The language's folding rules.
  5532. */
  5533. folding?: FoldingRules;
  5534. /**
  5535. * **Deprecated** Do not use.
  5536. *
  5537. * @deprecated Will be replaced by a better API soon.
  5538. */
  5539. __electricCharacterSupport?: {
  5540. docComment?: IDocComment;
  5541. };
  5542. }
  5543. /**
  5544. * Describes indentation rules for a language.
  5545. */
  5546. export interface IndentationRule {
  5547. /**
  5548. * If a line matches this pattern, then all the lines after it should be unindented once (until another rule matches).
  5549. */
  5550. decreaseIndentPattern: RegExp;
  5551. /**
  5552. * If a line matches this pattern, then all the lines after it should be indented once (until another rule matches).
  5553. */
  5554. increaseIndentPattern: RegExp;
  5555. /**
  5556. * If a line matches this pattern, then **only the next line** after it should be indented once.
  5557. */
  5558. indentNextLinePattern?: RegExp | null;
  5559. /**
  5560. * If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules.
  5561. */
  5562. unIndentedLinePattern?: RegExp | null;
  5563. }
  5564. /**
  5565. * Describes language specific folding markers such as '#region' and '#endregion'.
  5566. * The start and end regexes will be tested against the contents of all lines and must be designed efficiently:
  5567. * - the regex should start with '^'
  5568. * - regexp flags (i, g) are ignored
  5569. */
  5570. export interface FoldingMarkers {
  5571. start: RegExp;
  5572. end: RegExp;
  5573. }
  5574. /**
  5575. * Describes folding rules for a language.
  5576. */
  5577. export interface FoldingRules {
  5578. /**
  5579. * Used by the indentation based strategy to decide whether empty lines belong to the previous or the next block.
  5580. * A language adheres to the off-side rule if blocks in that language are expressed by their indentation.
  5581. * See [wikipedia](https://en.wikipedia.org/wiki/Off-side_rule) for more information.
  5582. * If not set, `false` is used and empty lines belong to the previous block.
  5583. */
  5584. offSide?: boolean;
  5585. /**
  5586. * Region markers used by the language.
  5587. */
  5588. markers?: FoldingMarkers;
  5589. }
  5590. /**
  5591. * Describes a rule to be evaluated when pressing Enter.
  5592. */
  5593. export interface OnEnterRule {
  5594. /**
  5595. * This rule will only execute if the text before the cursor matches this regular expression.
  5596. */
  5597. beforeText: RegExp;
  5598. /**
  5599. * This rule will only execute if the text after the cursor matches this regular expression.
  5600. */
  5601. afterText?: RegExp;
  5602. /**
  5603. * This rule will only execute if the text above the this line matches this regular expression.
  5604. */
  5605. previousLineText?: RegExp;
  5606. /**
  5607. * The action to execute.
  5608. */
  5609. action: EnterAction;
  5610. }
  5611. /**
  5612. * Definition of documentation comments (e.g. Javadoc/JSdoc)
  5613. */
  5614. export interface IDocComment {
  5615. /**
  5616. * The string that starts a doc comment (e.g. '/**')
  5617. */
  5618. open: string;
  5619. /**
  5620. * The string that appears on the last line and closes the doc comment (e.g. ' * /').
  5621. */
  5622. close?: string;
  5623. }
  5624. /**
  5625. * A tuple of two characters, like a pair of
  5626. * opening and closing brackets.
  5627. */
  5628. export type CharacterPair = [string, string];
  5629. export interface IAutoClosingPair {
  5630. open: string;
  5631. close: string;
  5632. }
  5633. export interface IAutoClosingPairConditional extends IAutoClosingPair {
  5634. notIn?: string[];
  5635. }
  5636. /**
  5637. * Describes what to do with the indentation when pressing Enter.
  5638. */
  5639. export enum IndentAction {
  5640. /**
  5641. * Insert new line and copy the previous line's indentation.
  5642. */
  5643. None = 0,
  5644. /**
  5645. * Insert new line and indent once (relative to the previous line's indentation).
  5646. */
  5647. Indent = 1,
  5648. /**
  5649. * Insert two new lines:
  5650. * - the first one indented which will hold the cursor
  5651. * - the second one at the same indentation level
  5652. */
  5653. IndentOutdent = 2,
  5654. /**
  5655. * Insert new line and outdent once (relative to the previous line's indentation).
  5656. */
  5657. Outdent = 3
  5658. }
  5659. /**
  5660. * Describes what to do when pressing Enter.
  5661. */
  5662. export interface EnterAction {
  5663. /**
  5664. * Describe what to do with the indentation.
  5665. */
  5666. indentAction: IndentAction;
  5667. /**
  5668. * Describes text to be appended after the new line and after the indentation.
  5669. */
  5670. appendText?: string;
  5671. /**
  5672. * Describes the number of characters to remove from the new line's indentation.
  5673. */
  5674. removeText?: number;
  5675. }
  5676. /**
  5677. * The state of the tokenizer between two lines.
  5678. * It is useful to store flags such as in multiline comment, etc.
  5679. * The model will clone the previous line's state and pass it in to tokenize the next line.
  5680. */
  5681. export interface IState {
  5682. clone(): IState;
  5683. equals(other: IState): boolean;
  5684. }
  5685. /**
  5686. * A provider result represents the values a provider, like the {@link HoverProvider},
  5687. * may return. For once this is the actual result type `T`, like `Hover`, or a thenable that resolves
  5688. * to that type `T`. In addition, `null` and `undefined` can be returned - either directly or from a
  5689. * thenable.
  5690. */
  5691. export type ProviderResult<T> = T | undefined | null | Thenable<T | undefined | null>;
  5692. /**
  5693. * A hover represents additional information for a symbol or word. Hovers are
  5694. * rendered in a tooltip-like widget.
  5695. */
  5696. export interface Hover {
  5697. /**
  5698. * The contents of this hover.
  5699. */
  5700. contents: IMarkdownString[];
  5701. /**
  5702. * The range to which this hover applies. When missing, the
  5703. * editor will use the range at the current position or the
  5704. * current position itself.
  5705. */
  5706. range?: IRange;
  5707. }
  5708. /**
  5709. * The hover provider interface defines the contract between extensions and
  5710. * the [hover](https://code.visualstudio.com/docs/editor/intellisense)-feature.
  5711. */
  5712. export interface HoverProvider {
  5713. /**
  5714. * Provide a hover for the given position and document. Multiple hovers at the same
  5715. * position will be merged by the editor. A hover can have a range which defaults
  5716. * to the word range at the position when omitted.
  5717. */
  5718. provideHover(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<Hover>;
  5719. }
  5720. export enum CompletionItemKind {
  5721. Method = 0,
  5722. Function = 1,
  5723. Constructor = 2,
  5724. Field = 3,
  5725. Variable = 4,
  5726. Class = 5,
  5727. Struct = 6,
  5728. Interface = 7,
  5729. Module = 8,
  5730. Property = 9,
  5731. Event = 10,
  5732. Operator = 11,
  5733. Unit = 12,
  5734. Value = 13,
  5735. Constant = 14,
  5736. Enum = 15,
  5737. EnumMember = 16,
  5738. Keyword = 17,
  5739. Text = 18,
  5740. Color = 19,
  5741. File = 20,
  5742. Reference = 21,
  5743. Customcolor = 22,
  5744. Folder = 23,
  5745. TypeParameter = 24,
  5746. User = 25,
  5747. Issue = 26,
  5748. Snippet = 27
  5749. }
  5750. export interface CompletionItemLabel {
  5751. label: string;
  5752. detail?: string;
  5753. description?: string;
  5754. }
  5755. export enum CompletionItemTag {
  5756. Deprecated = 1
  5757. }
  5758. export enum CompletionItemInsertTextRule {
  5759. /**
  5760. * Adjust whitespace/indentation of multiline insert texts to
  5761. * match the current line indentation.
  5762. */
  5763. KeepWhitespace = 1,
  5764. /**
  5765. * `insertText` is a snippet.
  5766. */
  5767. InsertAsSnippet = 4
  5768. }
  5769. export interface CompletionItemRanges {
  5770. insert: IRange;
  5771. replace: IRange;
  5772. }
  5773. /**
  5774. * A completion item represents a text snippet that is
  5775. * proposed to complete text that is being typed.
  5776. */
  5777. export interface CompletionItem {
  5778. /**
  5779. * The label of this completion item. By default
  5780. * this is also the text that is inserted when selecting
  5781. * this completion.
  5782. */
  5783. label: string | CompletionItemLabel;
  5784. /**
  5785. * The kind of this completion item. Based on the kind
  5786. * an icon is chosen by the editor.
  5787. */
  5788. kind: CompletionItemKind;
  5789. /**
  5790. * A modifier to the `kind` which affect how the item
  5791. * is rendered, e.g. Deprecated is rendered with a strikeout
  5792. */
  5793. tags?: ReadonlyArray<CompletionItemTag>;
  5794. /**
  5795. * A human-readable string with additional information
  5796. * about this item, like type or symbol information.
  5797. */
  5798. detail?: string;
  5799. /**
  5800. * A human-readable string that represents a doc-comment.
  5801. */
  5802. documentation?: string | IMarkdownString;
  5803. /**
  5804. * A string that should be used when comparing this item
  5805. * with other items. When `falsy` the {@link CompletionItem.label label}
  5806. * is used.
  5807. */
  5808. sortText?: string;
  5809. /**
  5810. * A string that should be used when filtering a set of
  5811. * completion items. When `falsy` the {@link CompletionItem.label label}
  5812. * is used.
  5813. */
  5814. filterText?: string;
  5815. /**
  5816. * Select this item when showing. *Note* that only one completion item can be selected and
  5817. * that the editor decides which item that is. The rule is that the *first* item of those
  5818. * that match best is selected.
  5819. */
  5820. preselect?: boolean;
  5821. /**
  5822. * A string or snippet that should be inserted in a document when selecting
  5823. * this completion.
  5824. */
  5825. insertText: string;
  5826. /**
  5827. * Additional rules (as bitmask) that should be applied when inserting
  5828. * this completion.
  5829. */
  5830. insertTextRules?: CompletionItemInsertTextRule;
  5831. /**
  5832. * A range of text that should be replaced by this completion item.
  5833. *
  5834. * Defaults to a range from the start of the {@link TextDocument.getWordRangeAtPosition current word} to the
  5835. * current position.
  5836. *
  5837. * *Note:* The range must be a {@link Range.isSingleLine single line} and it must
  5838. * {@link Range.contains contain} the position at which completion has been {@link CompletionItemProvider.provideCompletionItems requested}.
  5839. */
  5840. range: IRange | CompletionItemRanges;
  5841. /**
  5842. * An optional set of characters that when pressed while this completion is active will accept it first and
  5843. * then type that character. *Note* that all commit characters should have `length=1` and that superfluous
  5844. * characters will be ignored.
  5845. */
  5846. commitCharacters?: string[];
  5847. /**
  5848. * An optional array of additional text edits that are applied when
  5849. * selecting this completion. Edits must not overlap with the main edit
  5850. * nor with themselves.
  5851. */
  5852. additionalTextEdits?: editor.ISingleEditOperation[];
  5853. /**
  5854. * A command that should be run upon acceptance of this item.
  5855. */
  5856. command?: Command;
  5857. }
  5858. export interface CompletionList {
  5859. suggestions: CompletionItem[];
  5860. incomplete?: boolean;
  5861. dispose?(): void;
  5862. }
  5863. /**
  5864. * How a suggest provider was triggered.
  5865. */
  5866. export enum CompletionTriggerKind {
  5867. Invoke = 0,
  5868. TriggerCharacter = 1,
  5869. TriggerForIncompleteCompletions = 2
  5870. }
  5871. /**
  5872. * Contains additional information about the context in which
  5873. * {@link CompletionItemProvider.provideCompletionItems completion provider} is triggered.
  5874. */
  5875. export interface CompletionContext {
  5876. /**
  5877. * How the completion was triggered.
  5878. */
  5879. triggerKind: CompletionTriggerKind;
  5880. /**
  5881. * Character that triggered the completion item provider.
  5882. *
  5883. * `undefined` if provider was not triggered by a character.
  5884. */
  5885. triggerCharacter?: string;
  5886. }
  5887. /**
  5888. * The completion item provider interface defines the contract between extensions and
  5889. * the [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense).
  5890. *
  5891. * When computing *complete* completion items is expensive, providers can optionally implement
  5892. * the `resolveCompletionItem`-function. In that case it is enough to return completion
  5893. * items with a {@link CompletionItem.label label} from the
  5894. * {@link CompletionItemProvider.provideCompletionItems provideCompletionItems}-function. Subsequently,
  5895. * when a completion item is shown in the UI and gains focus this provider is asked to resolve
  5896. * the item, like adding {@link CompletionItem.documentation doc-comment} or {@link CompletionItem.detail details}.
  5897. */
  5898. export interface CompletionItemProvider {
  5899. triggerCharacters?: string[];
  5900. /**
  5901. * Provide completion items for the given position and document.
  5902. */
  5903. provideCompletionItems(model: editor.ITextModel, position: Position, context: CompletionContext, token: CancellationToken): ProviderResult<CompletionList>;
  5904. /**
  5905. * Given a completion item fill in more data, like {@link CompletionItem.documentation doc-comment}
  5906. * or {@link CompletionItem.detail details}.
  5907. *
  5908. * The editor will only resolve a completion item once.
  5909. */
  5910. resolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;
  5911. }
  5912. /**
  5913. * How an {@link InlineCompletionsProvider inline completion provider} was triggered.
  5914. */
  5915. export enum InlineCompletionTriggerKind {
  5916. /**
  5917. * Completion was triggered automatically while editing.
  5918. * It is sufficient to return a single completion item in this case.
  5919. */
  5920. Automatic = 0,
  5921. /**
  5922. * Completion was triggered explicitly by a user gesture.
  5923. * Return multiple completion items to enable cycling through them.
  5924. */
  5925. Explicit = 1
  5926. }
  5927. export interface InlineCompletionContext {
  5928. /**
  5929. * How the completion was triggered.
  5930. */
  5931. readonly triggerKind: InlineCompletionTriggerKind;
  5932. readonly selectedSuggestionInfo: SelectedSuggestionInfo | undefined;
  5933. }
  5934. export interface SelectedSuggestionInfo {
  5935. range: IRange;
  5936. text: string;
  5937. isSnippetText: boolean;
  5938. completionKind: CompletionItemKind;
  5939. }
  5940. export interface InlineCompletion {
  5941. /**
  5942. * The text to insert.
  5943. * If the text contains a line break, the range must end at the end of a line.
  5944. * If existing text should be replaced, the existing text must be a prefix of the text to insert.
  5945. */
  5946. readonly text: string;
  5947. /**
  5948. * The range to replace.
  5949. * Must begin and end on the same line.
  5950. */
  5951. readonly range?: IRange;
  5952. readonly command?: Command;
  5953. /**
  5954. * If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed.
  5955. * Defaults to `false`.
  5956. */
  5957. readonly completeBracketPairs?: boolean;
  5958. }
  5959. export interface InlineCompletions<TItem extends InlineCompletion = InlineCompletion> {
  5960. readonly items: readonly TItem[];
  5961. }
  5962. export interface InlineCompletionsProvider<T extends InlineCompletions = InlineCompletions> {
  5963. provideInlineCompletions(model: editor.ITextModel, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult<T>;
  5964. /**
  5965. * Will be called when an item is shown.
  5966. */
  5967. handleItemDidShow?(completions: T, item: T['items'][number]): void;
  5968. /**
  5969. * Will be called when a completions list is no longer in use and can be garbage-collected.
  5970. */
  5971. freeInlineCompletions(completions: T): void;
  5972. }
  5973. export interface CodeAction {
  5974. title: string;
  5975. command?: Command;
  5976. edit?: WorkspaceEdit;
  5977. diagnostics?: editor.IMarkerData[];
  5978. kind?: string;
  5979. isPreferred?: boolean;
  5980. disabled?: string;
  5981. }
  5982. export interface CodeActionList extends IDisposable {
  5983. readonly actions: ReadonlyArray<CodeAction>;
  5984. }
  5985. /**
  5986. * Represents a parameter of a callable-signature. A parameter can
  5987. * have a label and a doc-comment.
  5988. */
  5989. export interface ParameterInformation {
  5990. /**
  5991. * The label of this signature. Will be shown in
  5992. * the UI.
  5993. */
  5994. label: string | [number, number];
  5995. /**
  5996. * The human-readable doc-comment of this signature. Will be shown
  5997. * in the UI but can be omitted.
  5998. */
  5999. documentation?: string | IMarkdownString;
  6000. }
  6001. /**
  6002. * Represents the signature of something callable. A signature
  6003. * can have a label, like a function-name, a doc-comment, and
  6004. * a set of parameters.
  6005. */
  6006. export interface SignatureInformation {
  6007. /**
  6008. * The label of this signature. Will be shown in
  6009. * the UI.
  6010. */
  6011. label: string;
  6012. /**
  6013. * The human-readable doc-comment of this signature. Will be shown
  6014. * in the UI but can be omitted.
  6015. */
  6016. documentation?: string | IMarkdownString;
  6017. /**
  6018. * The parameters of this signature.
  6019. */
  6020. parameters: ParameterInformation[];
  6021. /**
  6022. * Index of the active parameter.
  6023. *
  6024. * If provided, this is used in place of `SignatureHelp.activeSignature`.
  6025. */
  6026. activeParameter?: number;
  6027. }
  6028. /**
  6029. * Signature help represents the signature of something
  6030. * callable. There can be multiple signatures but only one
  6031. * active and only one active parameter.
  6032. */
  6033. export interface SignatureHelp {
  6034. /**
  6035. * One or more signatures.
  6036. */
  6037. signatures: SignatureInformation[];
  6038. /**
  6039. * The active signature.
  6040. */
  6041. activeSignature: number;
  6042. /**
  6043. * The active parameter of the active signature.
  6044. */
  6045. activeParameter: number;
  6046. }
  6047. export interface SignatureHelpResult extends IDisposable {
  6048. value: SignatureHelp;
  6049. }
  6050. export enum SignatureHelpTriggerKind {
  6051. Invoke = 1,
  6052. TriggerCharacter = 2,
  6053. ContentChange = 3
  6054. }
  6055. export interface SignatureHelpContext {
  6056. readonly triggerKind: SignatureHelpTriggerKind;
  6057. readonly triggerCharacter?: string;
  6058. readonly isRetrigger: boolean;
  6059. readonly activeSignatureHelp?: SignatureHelp;
  6060. }
  6061. /**
  6062. * The signature help provider interface defines the contract between extensions and
  6063. * the [parameter hints](https://code.visualstudio.com/docs/editor/intellisense)-feature.
  6064. */
  6065. export interface SignatureHelpProvider {
  6066. readonly signatureHelpTriggerCharacters?: ReadonlyArray<string>;
  6067. readonly signatureHelpRetriggerCharacters?: ReadonlyArray<string>;
  6068. /**
  6069. * Provide help for the signature at the given position and document.
  6070. */
  6071. provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelpResult>;
  6072. }
  6073. /**
  6074. * A document highlight kind.
  6075. */
  6076. export enum DocumentHighlightKind {
  6077. /**
  6078. * A textual occurrence.
  6079. */
  6080. Text = 0,
  6081. /**
  6082. * Read-access of a symbol, like reading a variable.
  6083. */
  6084. Read = 1,
  6085. /**
  6086. * Write-access of a symbol, like writing to a variable.
  6087. */
  6088. Write = 2
  6089. }
  6090. /**
  6091. * A document highlight is a range inside a text document which deserves
  6092. * special attention. Usually a document highlight is visualized by changing
  6093. * the background color of its range.
  6094. */
  6095. export interface DocumentHighlight {
  6096. /**
  6097. * The range this highlight applies to.
  6098. */
  6099. range: IRange;
  6100. /**
  6101. * The highlight kind, default is {@link DocumentHighlightKind.Text text}.
  6102. */
  6103. kind?: DocumentHighlightKind;
  6104. }
  6105. /**
  6106. * The document highlight provider interface defines the contract between extensions and
  6107. * the word-highlight-feature.
  6108. */
  6109. export interface DocumentHighlightProvider {
  6110. /**
  6111. * Provide a set of document highlights, like all occurrences of a variable or
  6112. * all exit-points of a function.
  6113. */
  6114. provideDocumentHighlights(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<DocumentHighlight[]>;
  6115. }
  6116. /**
  6117. * The linked editing range provider interface defines the contract between extensions and
  6118. * the linked editing feature.
  6119. */
  6120. export interface LinkedEditingRangeProvider {
  6121. /**
  6122. * Provide a list of ranges that can be edited together.
  6123. */
  6124. provideLinkedEditingRanges(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<LinkedEditingRanges>;
  6125. }
  6126. /**
  6127. * Represents a list of ranges that can be edited together along with a word pattern to describe valid contents.
  6128. */
  6129. export interface LinkedEditingRanges {
  6130. /**
  6131. * A list of ranges that can be edited together. The ranges must have
  6132. * identical length and text content. The ranges cannot overlap
  6133. */
  6134. ranges: IRange[];
  6135. /**
  6136. * An optional word pattern that describes valid contents for the given ranges.
  6137. * If no pattern is provided, the language configuration's word pattern will be used.
  6138. */
  6139. wordPattern?: RegExp;
  6140. }
  6141. /**
  6142. * Value-object that contains additional information when
  6143. * requesting references.
  6144. */
  6145. export interface ReferenceContext {
  6146. /**
  6147. * Include the declaration of the current symbol.
  6148. */
  6149. includeDeclaration: boolean;
  6150. }
  6151. /**
  6152. * The reference provider interface defines the contract between extensions and
  6153. * the [find references](https://code.visualstudio.com/docs/editor/editingevolved#_peek)-feature.
  6154. */
  6155. export interface ReferenceProvider {
  6156. /**
  6157. * Provide a set of project-wide references for the given position and document.
  6158. */
  6159. provideReferences(model: editor.ITextModel, position: Position, context: ReferenceContext, token: CancellationToken): ProviderResult<Location[]>;
  6160. }
  6161. /**
  6162. * Represents a location inside a resource, such as a line
  6163. * inside a text file.
  6164. */
  6165. export interface Location {
  6166. /**
  6167. * The resource identifier of this location.
  6168. */
  6169. uri: Uri;
  6170. /**
  6171. * The document range of this locations.
  6172. */
  6173. range: IRange;
  6174. }
  6175. export interface LocationLink {
  6176. /**
  6177. * A range to select where this link originates from.
  6178. */
  6179. originSelectionRange?: IRange;
  6180. /**
  6181. * The target uri this link points to.
  6182. */
  6183. uri: Uri;
  6184. /**
  6185. * The full range this link points to.
  6186. */
  6187. range: IRange;
  6188. /**
  6189. * A range to select this link points to. Must be contained
  6190. * in `LocationLink.range`.
  6191. */
  6192. targetSelectionRange?: IRange;
  6193. }
  6194. export type Definition = Location | Location[] | LocationLink[];
  6195. /**
  6196. * The definition provider interface defines the contract between extensions and
  6197. * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)
  6198. * and peek definition features.
  6199. */
  6200. export interface DefinitionProvider {
  6201. /**
  6202. * Provide the definition of the symbol at the given position and document.
  6203. */
  6204. provideDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;
  6205. }
  6206. /**
  6207. * The definition provider interface defines the contract between extensions and
  6208. * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)
  6209. * and peek definition features.
  6210. */
  6211. export interface DeclarationProvider {
  6212. /**
  6213. * Provide the declaration of the symbol at the given position and document.
  6214. */
  6215. provideDeclaration(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;
  6216. }
  6217. /**
  6218. * The implementation provider interface defines the contract between extensions and
  6219. * the go to implementation feature.
  6220. */
  6221. export interface ImplementationProvider {
  6222. /**
  6223. * Provide the implementation of the symbol at the given position and document.
  6224. */
  6225. provideImplementation(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;
  6226. }
  6227. /**
  6228. * The type definition provider interface defines the contract between extensions and
  6229. * the go to type definition feature.
  6230. */
  6231. export interface TypeDefinitionProvider {
  6232. /**
  6233. * Provide the type definition of the symbol at the given position and document.
  6234. */
  6235. provideTypeDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;
  6236. }
  6237. /**
  6238. * A symbol kind.
  6239. */
  6240. export enum SymbolKind {
  6241. File = 0,
  6242. Module = 1,
  6243. Namespace = 2,
  6244. Package = 3,
  6245. Class = 4,
  6246. Method = 5,
  6247. Property = 6,
  6248. Field = 7,
  6249. Constructor = 8,
  6250. Enum = 9,
  6251. Interface = 10,
  6252. Function = 11,
  6253. Variable = 12,
  6254. Constant = 13,
  6255. String = 14,
  6256. Number = 15,
  6257. Boolean = 16,
  6258. Array = 17,
  6259. Object = 18,
  6260. Key = 19,
  6261. Null = 20,
  6262. EnumMember = 21,
  6263. Struct = 22,
  6264. Event = 23,
  6265. Operator = 24,
  6266. TypeParameter = 25
  6267. }
  6268. export enum SymbolTag {
  6269. Deprecated = 1
  6270. }
  6271. export interface DocumentSymbol {
  6272. name: string;
  6273. detail: string;
  6274. kind: SymbolKind;
  6275. tags: ReadonlyArray<SymbolTag>;
  6276. containerName?: string;
  6277. range: IRange;
  6278. selectionRange: IRange;
  6279. children?: DocumentSymbol[];
  6280. }
  6281. /**
  6282. * The document symbol provider interface defines the contract between extensions and
  6283. * the [go to symbol](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-symbol)-feature.
  6284. */
  6285. export interface DocumentSymbolProvider {
  6286. displayName?: string;
  6287. /**
  6288. * Provide symbol information for the given document.
  6289. */
  6290. provideDocumentSymbols(model: editor.ITextModel, token: CancellationToken): ProviderResult<DocumentSymbol[]>;
  6291. }
  6292. export type TextEdit = {
  6293. range: IRange;
  6294. text: string;
  6295. eol?: editor.EndOfLineSequence;
  6296. };
  6297. /**
  6298. * Interface used to format a model
  6299. */
  6300. export interface FormattingOptions {
  6301. /**
  6302. * Size of a tab in spaces.
  6303. */
  6304. tabSize: number;
  6305. /**
  6306. * Prefer spaces over tabs.
  6307. */
  6308. insertSpaces: boolean;
  6309. }
  6310. /**
  6311. * The document formatting provider interface defines the contract between extensions and
  6312. * the formatting-feature.
  6313. */
  6314. export interface DocumentFormattingEditProvider {
  6315. readonly displayName?: string;
  6316. /**
  6317. * Provide formatting edits for a whole document.
  6318. */
  6319. provideDocumentFormattingEdits(model: editor.ITextModel, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
  6320. }
  6321. /**
  6322. * The document formatting provider interface defines the contract between extensions and
  6323. * the formatting-feature.
  6324. */
  6325. export interface DocumentRangeFormattingEditProvider {
  6326. readonly displayName?: string;
  6327. /**
  6328. * Provide formatting edits for a range in a document.
  6329. *
  6330. * The given range is a hint and providers can decide to format a smaller
  6331. * or larger range. Often this is done by adjusting the start and end
  6332. * of the range to full syntax nodes.
  6333. */
  6334. provideDocumentRangeFormattingEdits(model: editor.ITextModel, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
  6335. }
  6336. /**
  6337. * The document formatting provider interface defines the contract between extensions and
  6338. * the formatting-feature.
  6339. */
  6340. export interface OnTypeFormattingEditProvider {
  6341. autoFormatTriggerCharacters: string[];
  6342. /**
  6343. * Provide formatting edits after a character has been typed.
  6344. *
  6345. * The given position and character should hint to the provider
  6346. * what range the position to expand to, like find the matching `{`
  6347. * when `}` has been entered.
  6348. */
  6349. provideOnTypeFormattingEdits(model: editor.ITextModel, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
  6350. }
  6351. /**
  6352. * A link inside the editor.
  6353. */
  6354. export interface ILink {
  6355. range: IRange;
  6356. url?: Uri | string;
  6357. tooltip?: string;
  6358. }
  6359. export interface ILinksList {
  6360. links: ILink[];
  6361. dispose?(): void;
  6362. }
  6363. /**
  6364. * A provider of links.
  6365. */
  6366. export interface LinkProvider {
  6367. provideLinks(model: editor.ITextModel, token: CancellationToken): ProviderResult<ILinksList>;
  6368. resolveLink?: (link: ILink, token: CancellationToken) => ProviderResult<ILink>;
  6369. }
  6370. /**
  6371. * A color in RGBA format.
  6372. */
  6373. export interface IColor {
  6374. /**
  6375. * The red component in the range [0-1].
  6376. */
  6377. readonly red: number;
  6378. /**
  6379. * The green component in the range [0-1].
  6380. */
  6381. readonly green: number;
  6382. /**
  6383. * The blue component in the range [0-1].
  6384. */
  6385. readonly blue: number;
  6386. /**
  6387. * The alpha component in the range [0-1].
  6388. */
  6389. readonly alpha: number;
  6390. }
  6391. /**
  6392. * String representations for a color
  6393. */
  6394. export interface IColorPresentation {
  6395. /**
  6396. * The label of this color presentation. It will be shown on the color
  6397. * picker header. By default this is also the text that is inserted when selecting
  6398. * this color presentation.
  6399. */
  6400. label: string;
  6401. /**
  6402. * An {@link TextEdit edit} which is applied to a document when selecting
  6403. * this presentation for the color.
  6404. */
  6405. textEdit?: TextEdit;
  6406. /**
  6407. * An optional array of additional {@link TextEdit text edits} that are applied when
  6408. * selecting this color presentation.
  6409. */
  6410. additionalTextEdits?: TextEdit[];
  6411. }
  6412. /**
  6413. * A color range is a range in a text model which represents a color.
  6414. */
  6415. export interface IColorInformation {
  6416. /**
  6417. * The range within the model.
  6418. */
  6419. range: IRange;
  6420. /**
  6421. * The color represented in this range.
  6422. */
  6423. color: IColor;
  6424. }
  6425. /**
  6426. * A provider of colors for editor models.
  6427. */
  6428. export interface DocumentColorProvider {
  6429. /**
  6430. * Provides the color ranges for a specific model.
  6431. */
  6432. provideDocumentColors(model: editor.ITextModel, token: CancellationToken): ProviderResult<IColorInformation[]>;
  6433. /**
  6434. * Provide the string representations for a color.
  6435. */
  6436. provideColorPresentations(model: editor.ITextModel, colorInfo: IColorInformation, token: CancellationToken): ProviderResult<IColorPresentation[]>;
  6437. }
  6438. export interface SelectionRange {
  6439. range: IRange;
  6440. }
  6441. export interface SelectionRangeProvider {
  6442. /**
  6443. * Provide ranges that should be selected from the given position.
  6444. */
  6445. provideSelectionRanges(model: editor.ITextModel, positions: Position[], token: CancellationToken): ProviderResult<SelectionRange[][]>;
  6446. }
  6447. export interface FoldingContext {
  6448. }
  6449. /**
  6450. * A provider of folding ranges for editor models.
  6451. */
  6452. export interface FoldingRangeProvider {
  6453. /**
  6454. * An optional event to signal that the folding ranges from this provider have changed.
  6455. */
  6456. onDidChange?: IEvent<this>;
  6457. /**
  6458. * Provides the folding ranges for a specific model.
  6459. */
  6460. provideFoldingRanges(model: editor.ITextModel, context: FoldingContext, token: CancellationToken): ProviderResult<FoldingRange[]>;
  6461. }
  6462. export interface FoldingRange {
  6463. /**
  6464. * The one-based start line of the range to fold. The folded area starts after the line's last character.
  6465. */
  6466. start: number;
  6467. /**
  6468. * The one-based end line of the range to fold. The folded area ends with the line's last character.
  6469. */
  6470. end: number;
  6471. /**
  6472. * Describes the {@link FoldingRangeKind Kind} of the folding range such as {@link FoldingRangeKind.Comment Comment} or
  6473. * {@link FoldingRangeKind.Region Region}. The kind is used to categorize folding ranges and used by commands
  6474. * like 'Fold all comments'. See
  6475. * {@link FoldingRangeKind} for an enumeration of standardized kinds.
  6476. */
  6477. kind?: FoldingRangeKind;
  6478. }
  6479. export class FoldingRangeKind {
  6480. value: string;
  6481. /**
  6482. * Kind for folding range representing a comment. The value of the kind is 'comment'.
  6483. */
  6484. static readonly Comment: FoldingRangeKind;
  6485. /**
  6486. * Kind for folding range representing a import. The value of the kind is 'imports'.
  6487. */
  6488. static readonly Imports: FoldingRangeKind;
  6489. /**
  6490. * Kind for folding range representing regions (for example marked by `#region`, `#endregion`).
  6491. * The value of the kind is 'region'.
  6492. */
  6493. static readonly Region: FoldingRangeKind;
  6494. /**
  6495. * Creates a new {@link FoldingRangeKind}.
  6496. *
  6497. * @param value of the kind.
  6498. */
  6499. constructor(value: string);
  6500. }
  6501. export interface WorkspaceEditMetadata {
  6502. needsConfirmation: boolean;
  6503. label: string;
  6504. description?: string;
  6505. }
  6506. export interface WorkspaceFileEditOptions {
  6507. overwrite?: boolean;
  6508. ignoreIfNotExists?: boolean;
  6509. ignoreIfExists?: boolean;
  6510. recursive?: boolean;
  6511. copy?: boolean;
  6512. folder?: boolean;
  6513. skipTrashBin?: boolean;
  6514. maxSize?: number;
  6515. }
  6516. export interface WorkspaceFileEdit {
  6517. oldUri?: Uri;
  6518. newUri?: Uri;
  6519. options?: WorkspaceFileEditOptions;
  6520. metadata?: WorkspaceEditMetadata;
  6521. }
  6522. export interface WorkspaceTextEdit {
  6523. resource: Uri;
  6524. edit: TextEdit;
  6525. modelVersionId?: number;
  6526. metadata?: WorkspaceEditMetadata;
  6527. }
  6528. export interface WorkspaceEdit {
  6529. edits: Array<WorkspaceTextEdit | WorkspaceFileEdit>;
  6530. }
  6531. export interface Rejection {
  6532. rejectReason?: string;
  6533. }
  6534. export interface RenameLocation {
  6535. range: IRange;
  6536. text: string;
  6537. }
  6538. export interface RenameProvider {
  6539. provideRenameEdits(model: editor.ITextModel, position: Position, newName: string, token: CancellationToken): ProviderResult<WorkspaceEdit & Rejection>;
  6540. resolveRenameLocation?(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<RenameLocation & Rejection>;
  6541. }
  6542. export interface Command {
  6543. id: string;
  6544. title: string;
  6545. tooltip?: string;
  6546. arguments?: any[];
  6547. }
  6548. export interface CodeLens {
  6549. range: IRange;
  6550. id?: string;
  6551. command?: Command;
  6552. }
  6553. export interface CodeLensList {
  6554. lenses: CodeLens[];
  6555. dispose(): void;
  6556. }
  6557. export interface CodeLensProvider {
  6558. onDidChange?: IEvent<this>;
  6559. provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult<CodeLensList>;
  6560. resolveCodeLens?(model: editor.ITextModel, codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;
  6561. }
  6562. export enum InlayHintKind {
  6563. Type = 1,
  6564. Parameter = 2
  6565. }
  6566. export interface InlayHintLabelPart {
  6567. label: string;
  6568. tooltip?: string | IMarkdownString;
  6569. command?: Command;
  6570. location?: Location;
  6571. }
  6572. export interface InlayHint {
  6573. label: string | InlayHintLabelPart[];
  6574. tooltip?: string | IMarkdownString;
  6575. command?: Command;
  6576. position: IPosition;
  6577. kind?: InlayHintKind;
  6578. paddingLeft?: boolean;
  6579. paddingRight?: boolean;
  6580. }
  6581. export interface InlayHintList {
  6582. hints: InlayHint[];
  6583. dispose(): void;
  6584. }
  6585. export interface InlayHintsProvider {
  6586. displayName?: string;
  6587. onDidChangeInlayHints?: IEvent<void>;
  6588. provideInlayHints(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult<InlayHintList>;
  6589. resolveInlayHint?(hint: InlayHint, token: CancellationToken): ProviderResult<InlayHint>;
  6590. }
  6591. export interface SemanticTokensLegend {
  6592. readonly tokenTypes: string[];
  6593. readonly tokenModifiers: string[];
  6594. }
  6595. export interface SemanticTokens {
  6596. readonly resultId?: string;
  6597. readonly data: Uint32Array;
  6598. }
  6599. export interface SemanticTokensEdit {
  6600. readonly start: number;
  6601. readonly deleteCount: number;
  6602. readonly data?: Uint32Array;
  6603. }
  6604. export interface SemanticTokensEdits {
  6605. readonly resultId?: string;
  6606. readonly edits: SemanticTokensEdit[];
  6607. }
  6608. export interface DocumentSemanticTokensProvider {
  6609. onDidChange?: IEvent<void>;
  6610. getLegend(): SemanticTokensLegend;
  6611. provideDocumentSemanticTokens(model: editor.ITextModel, lastResultId: string | null, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensEdits>;
  6612. releaseDocumentSemanticTokens(resultId: string | undefined): void;
  6613. }
  6614. export interface DocumentRangeSemanticTokensProvider {
  6615. getLegend(): SemanticTokensLegend;
  6616. provideDocumentRangeSemanticTokens(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
  6617. }
  6618. export interface ILanguageExtensionPoint {
  6619. id: string;
  6620. extensions?: string[];
  6621. filenames?: string[];
  6622. filenamePatterns?: string[];
  6623. firstLine?: string;
  6624. aliases?: string[];
  6625. mimetypes?: string[];
  6626. configuration?: Uri;
  6627. }
  6628. /**
  6629. * A Monarch language definition
  6630. */
  6631. export interface IMonarchLanguage {
  6632. /**
  6633. * map from string to ILanguageRule[]
  6634. */
  6635. tokenizer: {
  6636. [name: string]: IMonarchLanguageRule[];
  6637. };
  6638. /**
  6639. * is the language case insensitive?
  6640. */
  6641. ignoreCase?: boolean;
  6642. /**
  6643. * is the language unicode-aware? (i.e., /\u{1D306}/)
  6644. */
  6645. unicode?: boolean;
  6646. /**
  6647. * if no match in the tokenizer assign this token class (default 'source')
  6648. */
  6649. defaultToken?: string;
  6650. /**
  6651. * for example [['{','}','delimiter.curly']]
  6652. */
  6653. brackets?: IMonarchLanguageBracket[];
  6654. /**
  6655. * start symbol in the tokenizer (by default the first entry is used)
  6656. */
  6657. start?: string;
  6658. /**
  6659. * attach this to every token class (by default '.' + name)
  6660. */
  6661. tokenPostfix?: string;
  6662. /**
  6663. * include line feeds (in the form of a \n character) at the end of lines
  6664. * Defaults to false
  6665. */
  6666. includeLF?: boolean;
  6667. /**
  6668. * Other keys that can be referred to by the tokenizer.
  6669. */
  6670. [key: string]: any;
  6671. }
  6672. /**
  6673. * A rule is either a regular expression and an action
  6674. * shorthands: [reg,act] == { regex: reg, action: act}
  6675. * and : [reg,act,nxt] == { regex: reg, action: act{ next: nxt }}
  6676. */
  6677. export type IShortMonarchLanguageRule1 = [string | RegExp, IMonarchLanguageAction];
  6678. export type IShortMonarchLanguageRule2 = [string | RegExp, IMonarchLanguageAction, string];
  6679. export interface IExpandedMonarchLanguageRule {
  6680. /**
  6681. * match tokens
  6682. */
  6683. regex?: string | RegExp;
  6684. /**
  6685. * action to take on match
  6686. */
  6687. action?: IMonarchLanguageAction;
  6688. /**
  6689. * or an include rule. include all rules from the included state
  6690. */
  6691. include?: string;
  6692. }
  6693. export type IMonarchLanguageRule = IShortMonarchLanguageRule1 | IShortMonarchLanguageRule2 | IExpandedMonarchLanguageRule;
  6694. /**
  6695. * An action is either an array of actions...
  6696. * ... or a case statement with guards...
  6697. * ... or a basic action with a token value.
  6698. */
  6699. export type IShortMonarchLanguageAction = string;
  6700. export interface IExpandedMonarchLanguageAction {
  6701. /**
  6702. * array of actions for each parenthesized match group
  6703. */
  6704. group?: IMonarchLanguageAction[];
  6705. /**
  6706. * map from string to ILanguageAction
  6707. */
  6708. cases?: Object;
  6709. /**
  6710. * token class (ie. css class) (or "@brackets" or "@rematch")
  6711. */
  6712. token?: string;
  6713. /**
  6714. * the next state to push, or "@push", "@pop", "@popall"
  6715. */
  6716. next?: string;
  6717. /**
  6718. * switch to this state
  6719. */
  6720. switchTo?: string;
  6721. /**
  6722. * go back n characters in the stream
  6723. */
  6724. goBack?: number;
  6725. /**
  6726. * @open or @close
  6727. */
  6728. bracket?: string;
  6729. /**
  6730. * switch to embedded language (using the mimetype) or get out using "@pop"
  6731. */
  6732. nextEmbedded?: string;
  6733. /**
  6734. * log a message to the browser console window
  6735. */
  6736. log?: string;
  6737. }
  6738. export type IMonarchLanguageAction = IShortMonarchLanguageAction | IExpandedMonarchLanguageAction | IShortMonarchLanguageAction[] | IExpandedMonarchLanguageAction[];
  6739. /**
  6740. * This interface can be shortened as an array, ie. ['{','}','delimiter.curly']
  6741. */
  6742. export interface IMonarchLanguageBracket {
  6743. /**
  6744. * open bracket
  6745. */
  6746. open: string;
  6747. /**
  6748. * closing bracket
  6749. */
  6750. close: string;
  6751. /**
  6752. * token class
  6753. */
  6754. token: string;
  6755. }
  6756. }
  6757. declare namespace monaco.worker {
  6758. export interface IMirrorTextModel {
  6759. readonly version: number;
  6760. }
  6761. export interface IMirrorModel extends IMirrorTextModel {
  6762. readonly uri: Uri;
  6763. readonly version: number;
  6764. getValue(): string;
  6765. }
  6766. export interface IWorkerContext<H = undefined> {
  6767. /**
  6768. * A proxy to the main thread host object.
  6769. */
  6770. host: H;
  6771. /**
  6772. * Get all available mirror models in this worker.
  6773. */
  6774. getMirrorModels(): IMirrorModel[];
  6775. }
  6776. }
  6777. //dtsv=3
  6778. /*---------------------------------------------------------------------------------------------
  6779. * Copyright (c) Microsoft Corporation. All rights reserved.
  6780. * Licensed under the MIT License. See License.txt in the project root for license information.
  6781. *--------------------------------------------------------------------------------------------*/
  6782. declare namespace monaco.languages.css {
  6783. export interface CSSFormatConfiguration {
  6784. /** separate selectors with newline (e.g. "a,\nbr" or "a, br"): Default: true */
  6785. newlineBetweenSelectors?: boolean;
  6786. /** add a new line after every css rule: Default: true */
  6787. newlineBetweenRules?: boolean;
  6788. /** ensure space around selector separators: '>', '+', '~' (e.g. "a>b" -> "a > b"): Default: false */
  6789. spaceAroundSelectorSeparator?: boolean;
  6790. /** put braces on the same line as rules (`collapse`), or put braces on own line, Allman / ANSI style (`expand`). Default `collapse` */
  6791. braceStyle?: 'collapse' | 'expand';
  6792. /** whether existing line breaks before elements should be preserved. Default: true */
  6793. preserveNewLines?: boolean;
  6794. /** maximum number of line breaks to be preserved in one chunk. Default: unlimited */
  6795. maxPreserveNewLines?: number;
  6796. }
  6797. export interface Options {
  6798. readonly validate?: boolean;
  6799. readonly lint?: {
  6800. readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error';
  6801. readonly vendorPrefix?: 'ignore' | 'warning' | 'error';
  6802. readonly duplicateProperties?: 'ignore' | 'warning' | 'error';
  6803. readonly emptyRules?: 'ignore' | 'warning' | 'error';
  6804. readonly importStatement?: 'ignore' | 'warning' | 'error';
  6805. readonly boxModel?: 'ignore' | 'warning' | 'error';
  6806. readonly universalSelector?: 'ignore' | 'warning' | 'error';
  6807. readonly zeroUnits?: 'ignore' | 'warning' | 'error';
  6808. readonly fontFaceProperties?: 'ignore' | 'warning' | 'error';
  6809. readonly hexColorLength?: 'ignore' | 'warning' | 'error';
  6810. readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error';
  6811. readonly unknownProperties?: 'ignore' | 'warning' | 'error';
  6812. readonly ieHack?: 'ignore' | 'warning' | 'error';
  6813. readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error';
  6814. readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error';
  6815. readonly important?: 'ignore' | 'warning' | 'error';
  6816. readonly float?: 'ignore' | 'warning' | 'error';
  6817. readonly idSelector?: 'ignore' | 'warning' | 'error';
  6818. };
  6819. /**
  6820. * Configures the CSS data types known by the langauge service.
  6821. */
  6822. readonly data?: CSSDataConfiguration;
  6823. /**
  6824. * Settings for the CSS formatter.
  6825. */
  6826. readonly format?: CSSFormatConfiguration;
  6827. }
  6828. export interface ModeConfiguration {
  6829. /**
  6830. * Defines whether the built-in completionItemProvider is enabled.
  6831. */
  6832. readonly completionItems?: boolean;
  6833. /**
  6834. * Defines whether the built-in hoverProvider is enabled.
  6835. */
  6836. readonly hovers?: boolean;
  6837. /**
  6838. * Defines whether the built-in documentSymbolProvider is enabled.
  6839. */
  6840. readonly documentSymbols?: boolean;
  6841. /**
  6842. * Defines whether the built-in definitions provider is enabled.
  6843. */
  6844. readonly definitions?: boolean;
  6845. /**
  6846. * Defines whether the built-in references provider is enabled.
  6847. */
  6848. readonly references?: boolean;
  6849. /**
  6850. * Defines whether the built-in references provider is enabled.
  6851. */
  6852. readonly documentHighlights?: boolean;
  6853. /**
  6854. * Defines whether the built-in rename provider is enabled.
  6855. */
  6856. readonly rename?: boolean;
  6857. /**
  6858. * Defines whether the built-in color provider is enabled.
  6859. */
  6860. readonly colors?: boolean;
  6861. /**
  6862. * Defines whether the built-in foldingRange provider is enabled.
  6863. */
  6864. readonly foldingRanges?: boolean;
  6865. /**
  6866. * Defines whether the built-in diagnostic provider is enabled.
  6867. */
  6868. readonly diagnostics?: boolean;
  6869. /**
  6870. * Defines whether the built-in selection range provider is enabled.
  6871. */
  6872. readonly selectionRanges?: boolean;
  6873. /**
  6874. * Defines whether the built-in document formatting edit provider is enabled.
  6875. */
  6876. readonly documentFormattingEdits?: boolean;
  6877. /**
  6878. * Defines whether the built-in document formatting range edit provider is enabled.
  6879. */
  6880. readonly documentRangeFormattingEdits?: boolean;
  6881. }
  6882. export interface LanguageServiceDefaults {
  6883. readonly languageId: string;
  6884. readonly onDidChange: IEvent<LanguageServiceDefaults>;
  6885. readonly modeConfiguration: ModeConfiguration;
  6886. readonly options: Options;
  6887. setOptions(options: Options): void;
  6888. setModeConfiguration(modeConfiguration: ModeConfiguration): void;
  6889. /** @deprecated Use options instead */
  6890. readonly diagnosticsOptions: DiagnosticsOptions;
  6891. /** @deprecated Use setOptions instead */
  6892. setDiagnosticsOptions(options: DiagnosticsOptions): void;
  6893. }
  6894. /** @deprecated Use Options instead */
  6895. export type DiagnosticsOptions = Options;
  6896. export const cssDefaults: LanguageServiceDefaults;
  6897. export const scssDefaults: LanguageServiceDefaults;
  6898. export const lessDefaults: LanguageServiceDefaults;
  6899. export interface CSSDataConfiguration {
  6900. /**
  6901. * Defines whether the standard CSS properties, at-directives, pseudoClasses and pseudoElements are shown.
  6902. */
  6903. useDefaultDataProvider?: boolean;
  6904. /**
  6905. * Provides a set of custom data providers.
  6906. */
  6907. dataProviders?: {
  6908. [providerId: string]: CSSDataV1;
  6909. };
  6910. }
  6911. /**
  6912. * Custom CSS properties, at-directives, pseudoClasses and pseudoElements
  6913. * https://github.com/microsoft/vscode-css-languageservice/blob/main/docs/customData.md
  6914. */
  6915. export interface CSSDataV1 {
  6916. version: 1 | 1.1;
  6917. properties?: IPropertyData[];
  6918. atDirectives?: IAtDirectiveData[];
  6919. pseudoClasses?: IPseudoClassData[];
  6920. pseudoElements?: IPseudoElementData[];
  6921. }
  6922. export type EntryStatus = 'standard' | 'experimental' | 'nonstandard' | 'obsolete';
  6923. export interface IReference {
  6924. name: string;
  6925. url: string;
  6926. }
  6927. export interface IPropertyData {
  6928. name: string;
  6929. description?: string | MarkupContent;
  6930. browsers?: string[];
  6931. restrictions?: string[];
  6932. status?: EntryStatus;
  6933. syntax?: string;
  6934. values?: IValueData[];
  6935. references?: IReference[];
  6936. relevance?: number;
  6937. }
  6938. export interface IAtDirectiveData {
  6939. name: string;
  6940. description?: string | MarkupContent;
  6941. browsers?: string[];
  6942. status?: EntryStatus;
  6943. references?: IReference[];
  6944. }
  6945. export interface IPseudoClassData {
  6946. name: string;
  6947. description?: string | MarkupContent;
  6948. browsers?: string[];
  6949. status?: EntryStatus;
  6950. references?: IReference[];
  6951. }
  6952. export interface IPseudoElementData {
  6953. name: string;
  6954. description?: string | MarkupContent;
  6955. browsers?: string[];
  6956. status?: EntryStatus;
  6957. references?: IReference[];
  6958. }
  6959. export interface IValueData {
  6960. name: string;
  6961. description?: string | MarkupContent;
  6962. browsers?: string[];
  6963. status?: EntryStatus;
  6964. references?: IReference[];
  6965. }
  6966. export interface MarkupContent {
  6967. kind: MarkupKind;
  6968. value: string;
  6969. }
  6970. export type MarkupKind = 'plaintext' | 'markdown';
  6971. }
  6972. /*---------------------------------------------------------------------------------------------
  6973. * Copyright (c) Microsoft Corporation. All rights reserved.
  6974. * Licensed under the MIT License. See License.txt in the project root for license information.
  6975. *--------------------------------------------------------------------------------------------*/
  6976. declare namespace monaco.languages.html {
  6977. export interface HTMLFormatConfiguration {
  6978. readonly tabSize: number;
  6979. readonly insertSpaces: boolean;
  6980. readonly wrapLineLength: number;
  6981. readonly unformatted: string;
  6982. readonly contentUnformatted: string;
  6983. readonly indentInnerHtml: boolean;
  6984. readonly preserveNewLines: boolean;
  6985. readonly maxPreserveNewLines: number | undefined;
  6986. readonly indentHandlebars: boolean;
  6987. readonly endWithNewline: boolean;
  6988. readonly extraLiners: string;
  6989. readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline';
  6990. }
  6991. export interface CompletionConfiguration {
  6992. readonly [providerId: string]: boolean;
  6993. }
  6994. export interface Options {
  6995. /**
  6996. * Settings for the HTML formatter.
  6997. */
  6998. readonly format?: HTMLFormatConfiguration;
  6999. /**
  7000. * Code completion settings.
  7001. */
  7002. readonly suggest?: CompletionConfiguration;
  7003. /**
  7004. * Configures the HTML data types known by the HTML langauge service.
  7005. */
  7006. readonly data?: HTMLDataConfiguration;
  7007. }
  7008. export interface ModeConfiguration {
  7009. /**
  7010. * Defines whether the built-in completionItemProvider is enabled.
  7011. */
  7012. readonly completionItems?: boolean;
  7013. /**
  7014. * Defines whether the built-in hoverProvider is enabled.
  7015. */
  7016. readonly hovers?: boolean;
  7017. /**
  7018. * Defines whether the built-in documentSymbolProvider is enabled.
  7019. */
  7020. readonly documentSymbols?: boolean;
  7021. /**
  7022. * Defines whether the built-in definitions provider is enabled.
  7023. */
  7024. readonly links?: boolean;
  7025. /**
  7026. * Defines whether the built-in references provider is enabled.
  7027. */
  7028. readonly documentHighlights?: boolean;
  7029. /**
  7030. * Defines whether the built-in rename provider is enabled.
  7031. */
  7032. readonly rename?: boolean;
  7033. /**
  7034. * Defines whether the built-in color provider is enabled.
  7035. */
  7036. readonly colors?: boolean;
  7037. /**
  7038. * Defines whether the built-in foldingRange provider is enabled.
  7039. */
  7040. readonly foldingRanges?: boolean;
  7041. /**
  7042. * Defines whether the built-in diagnostic provider is enabled.
  7043. */
  7044. readonly diagnostics?: boolean;
  7045. /**
  7046. * Defines whether the built-in selection range provider is enabled.
  7047. */
  7048. readonly selectionRanges?: boolean;
  7049. /**
  7050. * Defines whether the built-in documentFormattingEdit provider is enabled.
  7051. */
  7052. readonly documentFormattingEdits?: boolean;
  7053. /**
  7054. * Defines whether the built-in documentRangeFormattingEdit provider is enabled.
  7055. */
  7056. readonly documentRangeFormattingEdits?: boolean;
  7057. }
  7058. export interface LanguageServiceDefaults {
  7059. readonly languageId: string;
  7060. readonly modeConfiguration: ModeConfiguration;
  7061. readonly onDidChange: IEvent<LanguageServiceDefaults>;
  7062. readonly options: Options;
  7063. setOptions(options: Options): void;
  7064. setModeConfiguration(modeConfiguration: ModeConfiguration): void;
  7065. }
  7066. export const htmlLanguageService: LanguageServiceRegistration;
  7067. export const htmlDefaults: LanguageServiceDefaults;
  7068. export const handlebarLanguageService: LanguageServiceRegistration;
  7069. export const handlebarDefaults: LanguageServiceDefaults;
  7070. export const razorLanguageService: LanguageServiceRegistration;
  7071. export const razorDefaults: LanguageServiceDefaults;
  7072. export interface LanguageServiceRegistration extends IDisposable {
  7073. readonly defaults: LanguageServiceDefaults;
  7074. }
  7075. /**
  7076. * Registers a new HTML language service for the languageId.
  7077. * Note: 'html', 'handlebar' and 'razor' are registered by default.
  7078. *
  7079. * Use this method to register additional language ids with a HTML service.
  7080. * The language server has to be registered before an editor model is opened.
  7081. */
  7082. export function registerHTMLLanguageService(languageId: string, options?: Options, modeConfiguration?: ModeConfiguration): LanguageServiceRegistration;
  7083. export interface HTMLDataConfiguration {
  7084. /**
  7085. * Defines whether the standard HTML tags and attributes are shown
  7086. */
  7087. readonly useDefaultDataProvider?: boolean;
  7088. /**
  7089. * Provides a set of custom data providers.
  7090. */
  7091. readonly dataProviders?: {
  7092. [providerId: string]: HTMLDataV1;
  7093. };
  7094. }
  7095. /**
  7096. * Custom HTML tags attributes and attribute values
  7097. * https://github.com/microsoft/vscode-html-languageservice/blob/main/docs/customData.md
  7098. */
  7099. export interface HTMLDataV1 {
  7100. readonly version: 1 | 1.1;
  7101. readonly tags?: ITagData[];
  7102. readonly globalAttributes?: IAttributeData[];
  7103. readonly valueSets?: IValueSet[];
  7104. }
  7105. export interface IReference {
  7106. readonly name: string;
  7107. readonly url: string;
  7108. }
  7109. export interface ITagData {
  7110. readonly name: string;
  7111. readonly description?: string | MarkupContent;
  7112. readonly attributes: IAttributeData[];
  7113. readonly references?: IReference[];
  7114. }
  7115. export interface IAttributeData {
  7116. readonly name: string;
  7117. readonly description?: string | MarkupContent;
  7118. readonly valueSet?: string;
  7119. readonly values?: IValueData[];
  7120. readonly references?: IReference[];
  7121. }
  7122. export interface IValueData {
  7123. readonly name: string;
  7124. readonly description?: string | MarkupContent;
  7125. readonly references?: IReference[];
  7126. }
  7127. export interface IValueSet {
  7128. readonly name: string;
  7129. readonly values: IValueData[];
  7130. }
  7131. export interface MarkupContent {
  7132. readonly kind: MarkupKind;
  7133. readonly value: string;
  7134. }
  7135. export type MarkupKind = 'plaintext' | 'markdown';
  7136. }
  7137. /*---------------------------------------------------------------------------------------------
  7138. * Copyright (c) Microsoft Corporation. All rights reserved.
  7139. * Licensed under the MIT License. See License.txt in the project root for license information.
  7140. *--------------------------------------------------------------------------------------------*/
  7141. declare namespace monaco.languages.json {
  7142. export interface DiagnosticsOptions {
  7143. /**
  7144. * If set, the validator will be enabled and perform syntax and schema based validation,
  7145. * unless `DiagnosticsOptions.schemaValidation` is set to `ignore`.
  7146. */
  7147. readonly validate?: boolean;
  7148. /**
  7149. * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments.
  7150. * `DiagnosticsOptions.allowComments` will override this setting.
  7151. */
  7152. readonly allowComments?: boolean;
  7153. /**
  7154. * A list of known schemas and/or associations of schemas to file names.
  7155. */
  7156. readonly schemas?: {
  7157. /**
  7158. * The URI of the schema, which is also the identifier of the schema.
  7159. */
  7160. readonly uri: string;
  7161. /**
  7162. * A list of glob patterns that describe for which file URIs the JSON schema will be used.
  7163. * '*' and '**' wildcards are supported. Exclusion patterns start with '!'.
  7164. * For example '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'.
  7165. * A match succeeds when there is at least one pattern matching and last matching pattern does not start with '!'.
  7166. */
  7167. readonly fileMatch?: string[];
  7168. /**
  7169. * The schema for the given URI.
  7170. */
  7171. readonly schema?: any;
  7172. }[];
  7173. /**
  7174. * If set, the schema service would load schema content on-demand with 'fetch' if available
  7175. */
  7176. readonly enableSchemaRequest?: boolean;
  7177. /**
  7178. * The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used.
  7179. */
  7180. readonly schemaValidation?: SeverityLevel;
  7181. /**
  7182. * The severity of problems that occurred when resolving and loading schemas. If set to 'ignore', schema resolving problems are not reported. If not set, 'warning' is used.
  7183. */
  7184. readonly schemaRequest?: SeverityLevel;
  7185. /**
  7186. * The severity of reported trailing commas. If not set, trailing commas will be reported as errors.
  7187. */
  7188. readonly trailingCommas?: SeverityLevel;
  7189. /**
  7190. * The severity of reported comments. If not set, 'DiagnosticsOptions.allowComments' defines whether comments are ignored or reported as errors.
  7191. */
  7192. readonly comments?: SeverityLevel;
  7193. }
  7194. export type SeverityLevel = 'error' | 'warning' | 'ignore';
  7195. export interface ModeConfiguration {
  7196. /**
  7197. * Defines whether the built-in documentFormattingEdit provider is enabled.
  7198. */
  7199. readonly documentFormattingEdits?: boolean;
  7200. /**
  7201. * Defines whether the built-in documentRangeFormattingEdit provider is enabled.
  7202. */
  7203. readonly documentRangeFormattingEdits?: boolean;
  7204. /**
  7205. * Defines whether the built-in completionItemProvider is enabled.
  7206. */
  7207. readonly completionItems?: boolean;
  7208. /**
  7209. * Defines whether the built-in hoverProvider is enabled.
  7210. */
  7211. readonly hovers?: boolean;
  7212. /**
  7213. * Defines whether the built-in documentSymbolProvider is enabled.
  7214. */
  7215. readonly documentSymbols?: boolean;
  7216. /**
  7217. * Defines whether the built-in tokens provider is enabled.
  7218. */
  7219. readonly tokens?: boolean;
  7220. /**
  7221. * Defines whether the built-in color provider is enabled.
  7222. */
  7223. readonly colors?: boolean;
  7224. /**
  7225. * Defines whether the built-in foldingRange provider is enabled.
  7226. */
  7227. readonly foldingRanges?: boolean;
  7228. /**
  7229. * Defines whether the built-in diagnostic provider is enabled.
  7230. */
  7231. readonly diagnostics?: boolean;
  7232. /**
  7233. * Defines whether the built-in selection range provider is enabled.
  7234. */
  7235. readonly selectionRanges?: boolean;
  7236. }
  7237. export interface LanguageServiceDefaults {
  7238. readonly languageId: string;
  7239. readonly onDidChange: IEvent<LanguageServiceDefaults>;
  7240. readonly diagnosticsOptions: DiagnosticsOptions;
  7241. readonly modeConfiguration: ModeConfiguration;
  7242. setDiagnosticsOptions(options: DiagnosticsOptions): void;
  7243. setModeConfiguration(modeConfiguration: ModeConfiguration): void;
  7244. }
  7245. export const jsonDefaults: LanguageServiceDefaults;
  7246. }
  7247. /*---------------------------------------------------------------------------------------------
  7248. * Copyright (c) Microsoft Corporation. All rights reserved.
  7249. * Licensed under the MIT License. See License.txt in the project root for license information.
  7250. *--------------------------------------------------------------------------------------------*/
  7251. declare namespace monaco.languages.typescript {
  7252. export enum ModuleKind {
  7253. None = 0,
  7254. CommonJS = 1,
  7255. AMD = 2,
  7256. UMD = 3,
  7257. System = 4,
  7258. ES2015 = 5,
  7259. ESNext = 99
  7260. }
  7261. export enum JsxEmit {
  7262. None = 0,
  7263. Preserve = 1,
  7264. React = 2,
  7265. ReactNative = 3,
  7266. ReactJSX = 4,
  7267. ReactJSXDev = 5
  7268. }
  7269. export enum NewLineKind {
  7270. CarriageReturnLineFeed = 0,
  7271. LineFeed = 1
  7272. }
  7273. export enum ScriptTarget {
  7274. ES3 = 0,
  7275. ES5 = 1,
  7276. ES2015 = 2,
  7277. ES2016 = 3,
  7278. ES2017 = 4,
  7279. ES2018 = 5,
  7280. ES2019 = 6,
  7281. ES2020 = 7,
  7282. ESNext = 99,
  7283. JSON = 100,
  7284. Latest = 99
  7285. }
  7286. export enum ModuleResolutionKind {
  7287. Classic = 1,
  7288. NodeJs = 2
  7289. }
  7290. interface MapLike<T> {
  7291. [index: string]: T;
  7292. }
  7293. type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | null | undefined;
  7294. interface CompilerOptions {
  7295. allowJs?: boolean;
  7296. allowSyntheticDefaultImports?: boolean;
  7297. allowUmdGlobalAccess?: boolean;
  7298. allowUnreachableCode?: boolean;
  7299. allowUnusedLabels?: boolean;
  7300. alwaysStrict?: boolean;
  7301. baseUrl?: string;
  7302. charset?: string;
  7303. checkJs?: boolean;
  7304. declaration?: boolean;
  7305. declarationMap?: boolean;
  7306. emitDeclarationOnly?: boolean;
  7307. declarationDir?: string;
  7308. disableSizeLimit?: boolean;
  7309. disableSourceOfProjectReferenceRedirect?: boolean;
  7310. downlevelIteration?: boolean;
  7311. emitBOM?: boolean;
  7312. emitDecoratorMetadata?: boolean;
  7313. experimentalDecorators?: boolean;
  7314. forceConsistentCasingInFileNames?: boolean;
  7315. importHelpers?: boolean;
  7316. inlineSourceMap?: boolean;
  7317. inlineSources?: boolean;
  7318. isolatedModules?: boolean;
  7319. jsx?: JsxEmit;
  7320. keyofStringsOnly?: boolean;
  7321. lib?: string[];
  7322. locale?: string;
  7323. mapRoot?: string;
  7324. maxNodeModuleJsDepth?: number;
  7325. module?: ModuleKind;
  7326. moduleResolution?: ModuleResolutionKind;
  7327. newLine?: NewLineKind;
  7328. noEmit?: boolean;
  7329. noEmitHelpers?: boolean;
  7330. noEmitOnError?: boolean;
  7331. noErrorTruncation?: boolean;
  7332. noFallthroughCasesInSwitch?: boolean;
  7333. noImplicitAny?: boolean;
  7334. noImplicitReturns?: boolean;
  7335. noImplicitThis?: boolean;
  7336. noStrictGenericChecks?: boolean;
  7337. noUnusedLocals?: boolean;
  7338. noUnusedParameters?: boolean;
  7339. noImplicitUseStrict?: boolean;
  7340. noLib?: boolean;
  7341. noResolve?: boolean;
  7342. out?: string;
  7343. outDir?: string;
  7344. outFile?: string;
  7345. paths?: MapLike<string[]>;
  7346. preserveConstEnums?: boolean;
  7347. preserveSymlinks?: boolean;
  7348. project?: string;
  7349. reactNamespace?: string;
  7350. jsxFactory?: string;
  7351. composite?: boolean;
  7352. removeComments?: boolean;
  7353. rootDir?: string;
  7354. rootDirs?: string[];
  7355. skipLibCheck?: boolean;
  7356. skipDefaultLibCheck?: boolean;
  7357. sourceMap?: boolean;
  7358. sourceRoot?: string;
  7359. strict?: boolean;
  7360. strictFunctionTypes?: boolean;
  7361. strictBindCallApply?: boolean;
  7362. strictNullChecks?: boolean;
  7363. strictPropertyInitialization?: boolean;
  7364. stripInternal?: boolean;
  7365. suppressExcessPropertyErrors?: boolean;
  7366. suppressImplicitAnyIndexErrors?: boolean;
  7367. target?: ScriptTarget;
  7368. traceResolution?: boolean;
  7369. resolveJsonModule?: boolean;
  7370. types?: string[];
  7371. /** Paths used to compute primary types search locations */
  7372. typeRoots?: string[];
  7373. esModuleInterop?: boolean;
  7374. useDefineForClassFields?: boolean;
  7375. [option: string]: CompilerOptionsValue | undefined;
  7376. }
  7377. export interface DiagnosticsOptions {
  7378. noSemanticValidation?: boolean;
  7379. noSyntaxValidation?: boolean;
  7380. noSuggestionDiagnostics?: boolean;
  7381. /**
  7382. * Limit diagnostic computation to only visible files.
  7383. * Defaults to false.
  7384. */
  7385. onlyVisible?: boolean;
  7386. diagnosticCodesToIgnore?: number[];
  7387. }
  7388. export interface WorkerOptions {
  7389. /** A full HTTP path to a JavaScript file which adds a function `customTSWorkerFactory` to the self inside a web-worker */
  7390. customWorkerPath?: string;
  7391. }
  7392. interface InlayHintsOptions {
  7393. readonly includeInlayParameterNameHints?: 'none' | 'literals' | 'all';
  7394. readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean;
  7395. readonly includeInlayFunctionParameterTypeHints?: boolean;
  7396. readonly includeInlayVariableTypeHints?: boolean;
  7397. readonly includeInlayPropertyDeclarationTypeHints?: boolean;
  7398. readonly includeInlayFunctionLikeReturnTypeHints?: boolean;
  7399. readonly includeInlayEnumMemberValueHints?: boolean;
  7400. }
  7401. interface IExtraLib {
  7402. content: string;
  7403. version: number;
  7404. }
  7405. export interface IExtraLibs {
  7406. [path: string]: IExtraLib;
  7407. }
  7408. /**
  7409. * A linked list of formatted diagnostic messages to be used as part of a multiline message.
  7410. * It is built from the bottom up, leaving the head to be the "main" diagnostic.
  7411. */
  7412. interface DiagnosticMessageChain {
  7413. messageText: string;
  7414. /** Diagnostic category: warning = 0, error = 1, suggestion = 2, message = 3 */
  7415. category: 0 | 1 | 2 | 3;
  7416. code: number;
  7417. next?: DiagnosticMessageChain[];
  7418. }
  7419. export interface Diagnostic extends DiagnosticRelatedInformation {
  7420. /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
  7421. reportsUnnecessary?: {};
  7422. reportsDeprecated?: {};
  7423. source?: string;
  7424. relatedInformation?: DiagnosticRelatedInformation[];
  7425. }
  7426. export interface DiagnosticRelatedInformation {
  7427. /** Diagnostic category: warning = 0, error = 1, suggestion = 2, message = 3 */
  7428. category: 0 | 1 | 2 | 3;
  7429. code: number;
  7430. /** TypeScriptWorker removes all but the `fileName` property to avoid serializing circular JSON structures. */
  7431. file: {
  7432. fileName: string;
  7433. } | undefined;
  7434. start: number | undefined;
  7435. length: number | undefined;
  7436. messageText: string | DiagnosticMessageChain;
  7437. }
  7438. interface EmitOutput {
  7439. outputFiles: OutputFile[];
  7440. emitSkipped: boolean;
  7441. }
  7442. interface OutputFile {
  7443. name: string;
  7444. writeByteOrderMark: boolean;
  7445. text: string;
  7446. }
  7447. export interface LanguageServiceDefaults {
  7448. /**
  7449. * Event fired when compiler options or diagnostics options are changed.
  7450. */
  7451. readonly onDidChange: IEvent<void>;
  7452. /**
  7453. * Event fired when extra libraries registered with the language service change.
  7454. */
  7455. readonly onDidExtraLibsChange: IEvent<void>;
  7456. readonly workerOptions: WorkerOptions;
  7457. readonly inlayHintsOptions: InlayHintsOptions;
  7458. /**
  7459. * Get the current extra libs registered with the language service.
  7460. */
  7461. getExtraLibs(): IExtraLibs;
  7462. /**
  7463. * Add an additional source file to the language service. Use this
  7464. * for typescript (definition) files that won't be loaded as editor
  7465. * documents, like `jquery.d.ts`.
  7466. *
  7467. * @param content The file content
  7468. * @param filePath An optional file path
  7469. * @returns A disposable which will remove the file from the
  7470. * language service upon disposal.
  7471. */
  7472. addExtraLib(content: string, filePath?: string): IDisposable;
  7473. /**
  7474. * Remove all existing extra libs and set the additional source
  7475. * files to the language service. Use this for typescript definition
  7476. * files that won't be loaded as editor documents, like `jquery.d.ts`.
  7477. * @param libs An array of entries to register.
  7478. */
  7479. setExtraLibs(libs: {
  7480. content: string;
  7481. filePath?: string;
  7482. }[]): void;
  7483. /**
  7484. * Get current TypeScript compiler options for the language service.
  7485. */
  7486. getCompilerOptions(): CompilerOptions;
  7487. /**
  7488. * Set TypeScript compiler options.
  7489. */
  7490. setCompilerOptions(options: CompilerOptions): void;
  7491. /**
  7492. * Get the current diagnostics options for the language service.
  7493. */
  7494. getDiagnosticsOptions(): DiagnosticsOptions;
  7495. /**
  7496. * Configure whether syntactic and/or semantic validation should
  7497. * be performed
  7498. */
  7499. setDiagnosticsOptions(options: DiagnosticsOptions): void;
  7500. /**
  7501. * Configure webworker options
  7502. */
  7503. setWorkerOptions(options: WorkerOptions): void;
  7504. /**
  7505. * No-op.
  7506. */
  7507. setMaximumWorkerIdleTime(value: number): void;
  7508. /**
  7509. * Configure if all existing models should be eagerly sync'd
  7510. * to the worker on start or restart.
  7511. */
  7512. setEagerModelSync(value: boolean): void;
  7513. /**
  7514. * Get the current setting for whether all existing models should be eagerly sync'd
  7515. * to the worker on start or restart.
  7516. */
  7517. getEagerModelSync(): boolean;
  7518. /**
  7519. * Configure inlay hints options.
  7520. */
  7521. setInlayHintsOptions(options: InlayHintsOptions): void;
  7522. }
  7523. export interface TypeScriptWorker {
  7524. /**
  7525. * Get diagnostic messages for any syntax issues in the given file.
  7526. */
  7527. getSyntacticDiagnostics(fileName: string): Promise<Diagnostic[]>;
  7528. /**
  7529. * Get diagnostic messages for any semantic issues in the given file.
  7530. */
  7531. getSemanticDiagnostics(fileName: string): Promise<Diagnostic[]>;
  7532. /**
  7533. * Get diagnostic messages for any suggestions related to the given file.
  7534. */
  7535. getSuggestionDiagnostics(fileName: string): Promise<Diagnostic[]>;
  7536. /**
  7537. * Get the content of a given file.
  7538. */
  7539. getScriptText(fileName: string): Promise<string | undefined>;
  7540. /**
  7541. * Get diagnostic messages related to the current compiler options.
  7542. * @param fileName Not used
  7543. */
  7544. getCompilerOptionsDiagnostics(fileName: string): Promise<Diagnostic[]>;
  7545. /**
  7546. * Get code completions for the given file and position.
  7547. * @returns `Promise<typescript.CompletionInfo | undefined>`
  7548. */
  7549. getCompletionsAtPosition(fileName: string, position: number): Promise<any | undefined>;
  7550. /**
  7551. * Get code completion details for the given file, position, and entry.
  7552. * @returns `Promise<typescript.CompletionEntryDetails | undefined>`
  7553. */
  7554. getCompletionEntryDetails(fileName: string, position: number, entry: string): Promise<any | undefined>;
  7555. /**
  7556. * Get signature help items for the item at the given file and position.
  7557. * @returns `Promise<typescript.SignatureHelpItems | undefined>`
  7558. */
  7559. getSignatureHelpItems(fileName: string, position: number, options: any): Promise<any | undefined>;
  7560. /**
  7561. * Get quick info for the item at the given position in the file.
  7562. * @returns `Promise<typescript.QuickInfo | undefined>`
  7563. */
  7564. getQuickInfoAtPosition(fileName: string, position: number): Promise<any | undefined>;
  7565. /**
  7566. * Get other ranges which are related to the item at the given position in the file (often used for highlighting).
  7567. * @returns `Promise<ReadonlyArray<typescript.ReferenceEntry> | undefined>`
  7568. */
  7569. getOccurrencesAtPosition(fileName: string, position: number): Promise<ReadonlyArray<any> | undefined>;
  7570. /**
  7571. * Get the definition of the item at the given position in the file.
  7572. * @returns `Promise<ReadonlyArray<typescript.DefinitionInfo> | undefined>`
  7573. */
  7574. getDefinitionAtPosition(fileName: string, position: number): Promise<ReadonlyArray<any> | undefined>;
  7575. /**
  7576. * Get references to the item at the given position in the file.
  7577. * @returns `Promise<typescript.ReferenceEntry[] | undefined>`
  7578. */
  7579. getReferencesAtPosition(fileName: string, position: number): Promise<any[] | undefined>;
  7580. /**
  7581. * Get outline entries for the item at the given position in the file.
  7582. * @returns `Promise<typescript.NavigationBarItem[]>`
  7583. */
  7584. getNavigationBarItems(fileName: string): Promise<any[]>;
  7585. /**
  7586. * Get changes which should be applied to format the given file.
  7587. * @param options `typescript.FormatCodeOptions`
  7588. * @returns `Promise<typescript.TextChange[]>`
  7589. */
  7590. getFormattingEditsForDocument(fileName: string, options: any): Promise<any[]>;
  7591. /**
  7592. * Get changes which should be applied to format the given range in the file.
  7593. * @param options `typescript.FormatCodeOptions`
  7594. * @returns `Promise<typescript.TextChange[]>`
  7595. */
  7596. getFormattingEditsForRange(fileName: string, start: number, end: number, options: any): Promise<any[]>;
  7597. /**
  7598. * Get formatting changes which should be applied after the given keystroke.
  7599. * @param options `typescript.FormatCodeOptions`
  7600. * @returns `Promise<typescript.TextChange[]>`
  7601. */
  7602. getFormattingEditsAfterKeystroke(fileName: string, postion: number, ch: string, options: any): Promise<any[]>;
  7603. /**
  7604. * Get other occurrences which should be updated when renaming the item at the given file and position.
  7605. * @returns `Promise<readonly typescript.RenameLocation[] | undefined>`
  7606. */
  7607. findRenameLocations(fileName: string, positon: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename: boolean): Promise<readonly any[] | undefined>;
  7608. /**
  7609. * Get edits which should be applied to rename the item at the given file and position (or a failure reason).
  7610. * @param options `typescript.RenameInfoOptions`
  7611. * @returns `Promise<typescript.RenameInfo>`
  7612. */
  7613. getRenameInfo(fileName: string, positon: number, options: any): Promise<any>;
  7614. /**
  7615. * Get transpiled output for the given file.
  7616. * @returns `typescript.EmitOutput`
  7617. */
  7618. getEmitOutput(fileName: string): Promise<EmitOutput>;
  7619. /**
  7620. * Get possible code fixes at the given position in the file.
  7621. * @param formatOptions `typescript.FormatCodeOptions`
  7622. * @returns `Promise<ReadonlyArray<typescript.CodeFixAction>>`
  7623. */
  7624. getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: any): Promise<ReadonlyArray<any>>;
  7625. /**
  7626. * Get inlay hints in the range of the file.
  7627. * @param fileName
  7628. * @returns `Promise<typescript.InlayHint[]>`
  7629. */
  7630. provideInlayHints(fileName: string, start: number, end: number): Promise<ReadonlyArray<any>>;
  7631. }
  7632. export const typescriptVersion: string;
  7633. export const typescriptDefaults: LanguageServiceDefaults;
  7634. export const javascriptDefaults: LanguageServiceDefaults;
  7635. export const getTypeScriptWorker: () => Promise<(...uris: Uri[]) => Promise<TypeScriptWorker>>;
  7636. export const getJavaScriptWorker: () => Promise<(...uris: Uri[]) => Promise<TypeScriptWorker>>;
  7637. }