monaco.d.ts 240 KB

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