1
0

monaco.d.ts 266 KB

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