monaco.d.ts 258 KB

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