monaco.d.ts 255 KB

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