monaco.d.ts 271 KB

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