monaco.d.ts 247 KB

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