monaco.d.ts 272 KB

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