editor.api.d.ts 288 KB

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