monaco.d.ts 293 KB

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