monaco.d.ts 271 KB

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