1
0

monaco.d.ts.txt 279 KB

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