e4bf81d8ed95dabacf0de78f7ee7a54f3a2fd866e51cc494abcd49af75af024dea6638a670384e118f64708d4588c927fa298e951cc4778574e6ba7aebf521 291 KB

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