monaco.d.ts 180 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237
  1. /*!-----------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Type definitions for monaco-editor v0.9.0
  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 module monaco {
  11. interface Thenable<T> {
  12. /**
  13. * Attaches callbacks for the resolution and/or rejection of the Promise.
  14. * @param onfulfilled The callback to execute when the Promise is resolved.
  15. * @param onrejected The callback to execute when the Promise is rejected.
  16. * @returns A Promise for the completion of which ever callback is executed.
  17. */
  18. then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
  19. then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
  20. }
  21. export interface IDisposable {
  22. dispose(): void;
  23. }
  24. export interface IEvent<T> {
  25. (listener: (e: T) => any, thisArg?: any): IDisposable;
  26. }
  27. /**
  28. * A helper that allows to emit and listen to typed events
  29. */
  30. export class Emitter<T> {
  31. constructor();
  32. readonly event: IEvent<T>;
  33. fire(event?: T): void;
  34. dispose(): void;
  35. }
  36. export enum Severity {
  37. Ignore = 0,
  38. Info = 1,
  39. Warning = 2,
  40. Error = 3,
  41. }
  42. /**
  43. * The value callback to complete a promise
  44. */
  45. export interface TValueCallback<T> {
  46. (value: T): void;
  47. }
  48. export interface ProgressCallback {
  49. (progress: any): any;
  50. }
  51. /**
  52. * A Promise implementation that supports progress and cancelation.
  53. */
  54. export class Promise<V> {
  55. constructor(init: (complete: TValueCallback<V>, error: (err: any) => void, progress: ProgressCallback) => void, oncancel?: any);
  56. public then<U>(success?: (value: V) => Promise<U>, error?: (err: any) => Promise<U>, progress?: ProgressCallback): Promise<U>;
  57. public then<U>(success?: (value: V) => Promise<U>, error?: (err: any) => Promise<U> | U, progress?: ProgressCallback): Promise<U>;
  58. public then<U>(success?: (value: V) => Promise<U>, error?: (err: any) => U, progress?: ProgressCallback): Promise<U>;
  59. public then<U>(success?: (value: V) => Promise<U>, error?: (err: any) => void, progress?: ProgressCallback): Promise<U>;
  60. public then<U>(success?: (value: V) => Promise<U> | U, error?: (err: any) => Promise<U>, progress?: ProgressCallback): Promise<U>;
  61. public then<U>(success?: (value: V) => Promise<U> | U, error?: (err: any) => Promise<U> | U, progress?: ProgressCallback): Promise<U>;
  62. public then<U>(success?: (value: V) => Promise<U> | U, error?: (err: any) => U, progress?: ProgressCallback): Promise<U>;
  63. public then<U>(success?: (value: V) => Promise<U> | U, error?: (err: any) => void, progress?: ProgressCallback): Promise<U>;
  64. public then<U>(success?: (value: V) => U, error?: (err: any) => Promise<U>, progress?: ProgressCallback): Promise<U>;
  65. public then<U>(success?: (value: V) => U, error?: (err: any) => Promise<U> | U, progress?: ProgressCallback): Promise<U>;
  66. public then<U>(success?: (value: V) => U, error?: (err: any) => U, progress?: ProgressCallback): Promise<U>;
  67. public then<U>(success?: (value: V) => U, error?: (err: any) => void, progress?: ProgressCallback): Promise<U>;
  68. public done(success?: (value: V) => void, error?: (err: any) => any, progress?: ProgressCallback): void;
  69. public cancel(): void;
  70. public static as(value: null): Promise<null>;
  71. public static as(value: undefined): Promise<undefined>;
  72. public static as<ValueType>(value: Promise<ValueType>): Promise<ValueType>;
  73. public static as<ValueType>(value: Thenable<ValueType>): Thenable<ValueType>;
  74. public static as<ValueType>(value: ValueType): Promise<ValueType>;
  75. public static is(value: any): value is Thenable<any>;
  76. public static timeout(delay: number): Promise<void>;
  77. public static join<ValueType>(promises: Promise<ValueType>[]): Promise<ValueType[]>;
  78. public static join<ValueType>(promises: Thenable<ValueType>[]): Thenable<ValueType[]>;
  79. public static join<ValueType>(promises: { [n: string]: Promise<ValueType> }): Promise<{ [n: string]: ValueType }>;
  80. public static any<ValueType>(promises: Promise<ValueType>[]): Promise<{ key: string; value: Promise<ValueType>; }>;
  81. public static wrap<ValueType>(value: Thenable<ValueType>): Promise<ValueType>;
  82. public static wrap<ValueType>(value: ValueType): Promise<ValueType>;
  83. public static wrapError<ValueType>(error: Error): Promise<ValueType>;
  84. }
  85. export class CancellationTokenSource {
  86. readonly token: CancellationToken;
  87. cancel(): void;
  88. dispose(): void;
  89. }
  90. export interface CancellationToken {
  91. readonly isCancellationRequested: boolean;
  92. /**
  93. * An event emitted when cancellation is requested
  94. * @event
  95. */
  96. readonly onCancellationRequested: IEvent<any>;
  97. }
  98. /**
  99. * Uniform Resource Identifier (Uri) http://tools.ietf.org/html/rfc3986.
  100. * This class is a simple parser which creates the basic component paths
  101. * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
  102. * and encoding.
  103. *
  104. * foo://example.com:8042/over/there?name=ferret#nose
  105. * \_/ \______________/\_________/ \_________/ \__/
  106. * | | | | |
  107. * scheme authority path query fragment
  108. * | _____________________|__
  109. * / \ / \
  110. * urn:example:animal:ferret:nose
  111. *
  112. *
  113. */
  114. export class Uri {
  115. static isUri(thing: any): thing is Uri;
  116. protected constructor();
  117. /**
  118. * scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'.
  119. * The part before the first colon.
  120. */
  121. readonly scheme: string;
  122. /**
  123. * authority is the 'www.msft.com' part of 'http://www.msft.com/some/path?query#fragment'.
  124. * The part between the first double slashes and the next slash.
  125. */
  126. readonly authority: string;
  127. /**
  128. * path is the '/some/path' part of 'http://www.msft.com/some/path?query#fragment'.
  129. */
  130. readonly path: string;
  131. /**
  132. * query is the 'query' part of 'http://www.msft.com/some/path?query#fragment'.
  133. */
  134. readonly query: string;
  135. /**
  136. * fragment is the 'fragment' part of 'http://www.msft.com/some/path?query#fragment'.
  137. */
  138. readonly fragment: string;
  139. /**
  140. * Returns a string representing the corresponding file system path of this Uri.
  141. * Will handle UNC paths and normalize windows drive letters to lower-case. Also
  142. * uses the platform specific path separator. Will *not* validate the path for
  143. * invalid characters and semantics. Will *not* look at the scheme of this Uri.
  144. */
  145. readonly fsPath: string;
  146. with(change: {
  147. scheme?: string;
  148. authority?: string;
  149. path?: string;
  150. query?: string;
  151. fragment?: string;
  152. }): Uri;
  153. static parse(value: string): Uri;
  154. static file(path: string): Uri;
  155. static from(components: {
  156. scheme?: string;
  157. authority?: string;
  158. path?: string;
  159. query?: string;
  160. fragment?: string;
  161. }): Uri;
  162. /**
  163. *
  164. * @param skipEncoding Do not encode the result, default is `false`
  165. */
  166. toString(skipEncoding?: boolean): string;
  167. toJSON(): any;
  168. static revive(data: any): Uri;
  169. }
  170. /**
  171. * Virtual Key Codes, the value does not hold any inherent meaning.
  172. * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
  173. * But these are "more general", as they should work across browsers & OS`s.
  174. */
  175. export enum KeyCode {
  176. /**
  177. * Placed first to cover the 0 value of the enum.
  178. */
  179. Unknown = 0,
  180. Backspace = 1,
  181. Tab = 2,
  182. Enter = 3,
  183. Shift = 4,
  184. Ctrl = 5,
  185. Alt = 6,
  186. PauseBreak = 7,
  187. CapsLock = 8,
  188. Escape = 9,
  189. Space = 10,
  190. PageUp = 11,
  191. PageDown = 12,
  192. End = 13,
  193. Home = 14,
  194. LeftArrow = 15,
  195. UpArrow = 16,
  196. RightArrow = 17,
  197. DownArrow = 18,
  198. Insert = 19,
  199. Delete = 20,
  200. KEY_0 = 21,
  201. KEY_1 = 22,
  202. KEY_2 = 23,
  203. KEY_3 = 24,
  204. KEY_4 = 25,
  205. KEY_5 = 26,
  206. KEY_6 = 27,
  207. KEY_7 = 28,
  208. KEY_8 = 29,
  209. KEY_9 = 30,
  210. KEY_A = 31,
  211. KEY_B = 32,
  212. KEY_C = 33,
  213. KEY_D = 34,
  214. KEY_E = 35,
  215. KEY_F = 36,
  216. KEY_G = 37,
  217. KEY_H = 38,
  218. KEY_I = 39,
  219. KEY_J = 40,
  220. KEY_K = 41,
  221. KEY_L = 42,
  222. KEY_M = 43,
  223. KEY_N = 44,
  224. KEY_O = 45,
  225. KEY_P = 46,
  226. KEY_Q = 47,
  227. KEY_R = 48,
  228. KEY_S = 49,
  229. KEY_T = 50,
  230. KEY_U = 51,
  231. KEY_V = 52,
  232. KEY_W = 53,
  233. KEY_X = 54,
  234. KEY_Y = 55,
  235. KEY_Z = 56,
  236. Meta = 57,
  237. ContextMenu = 58,
  238. F1 = 59,
  239. F2 = 60,
  240. F3 = 61,
  241. F4 = 62,
  242. F5 = 63,
  243. F6 = 64,
  244. F7 = 65,
  245. F8 = 66,
  246. F9 = 67,
  247. F10 = 68,
  248. F11 = 69,
  249. F12 = 70,
  250. F13 = 71,
  251. F14 = 72,
  252. F15 = 73,
  253. F16 = 74,
  254. F17 = 75,
  255. F18 = 76,
  256. F19 = 77,
  257. NumLock = 78,
  258. ScrollLock = 79,
  259. /**
  260. * Used for miscellaneous characters; it can vary by keyboard.
  261. * For the US standard keyboard, the ';:' key
  262. */
  263. US_SEMICOLON = 80,
  264. /**
  265. * For any country/region, the '+' key
  266. * For the US standard keyboard, the '=+' key
  267. */
  268. US_EQUAL = 81,
  269. /**
  270. * For any country/region, the ',' key
  271. * For the US standard keyboard, the ',<' key
  272. */
  273. US_COMMA = 82,
  274. /**
  275. * For any country/region, the '-' key
  276. * For the US standard keyboard, the '-_' key
  277. */
  278. US_MINUS = 83,
  279. /**
  280. * For any country/region, the '.' key
  281. * For the US standard keyboard, the '.>' key
  282. */
  283. US_DOT = 84,
  284. /**
  285. * Used for miscellaneous characters; it can vary by keyboard.
  286. * For the US standard keyboard, the '/?' key
  287. */
  288. US_SLASH = 85,
  289. /**
  290. * Used for miscellaneous characters; it can vary by keyboard.
  291. * For the US standard keyboard, the '`~' key
  292. */
  293. US_BACKTICK = 86,
  294. /**
  295. * Used for miscellaneous characters; it can vary by keyboard.
  296. * For the US standard keyboard, the '[{' key
  297. */
  298. US_OPEN_SQUARE_BRACKET = 87,
  299. /**
  300. * Used for miscellaneous characters; it can vary by keyboard.
  301. * For the US standard keyboard, the '\|' key
  302. */
  303. US_BACKSLASH = 88,
  304. /**
  305. * Used for miscellaneous characters; it can vary by keyboard.
  306. * For the US standard keyboard, the ']}' key
  307. */
  308. US_CLOSE_SQUARE_BRACKET = 89,
  309. /**
  310. * Used for miscellaneous characters; it can vary by keyboard.
  311. * For the US standard keyboard, the ''"' key
  312. */
  313. US_QUOTE = 90,
  314. /**
  315. * Used for miscellaneous characters; it can vary by keyboard.
  316. */
  317. OEM_8 = 91,
  318. /**
  319. * Either the angle bracket key or the backslash key on the RT 102-key keyboard.
  320. */
  321. OEM_102 = 92,
  322. NUMPAD_0 = 93,
  323. NUMPAD_1 = 94,
  324. NUMPAD_2 = 95,
  325. NUMPAD_3 = 96,
  326. NUMPAD_4 = 97,
  327. NUMPAD_5 = 98,
  328. NUMPAD_6 = 99,
  329. NUMPAD_7 = 100,
  330. NUMPAD_8 = 101,
  331. NUMPAD_9 = 102,
  332. NUMPAD_MULTIPLY = 103,
  333. NUMPAD_ADD = 104,
  334. NUMPAD_SEPARATOR = 105,
  335. NUMPAD_SUBTRACT = 106,
  336. NUMPAD_DECIMAL = 107,
  337. NUMPAD_DIVIDE = 108,
  338. /**
  339. * Cover all key codes when IME is processing input.
  340. */
  341. KEY_IN_COMPOSITION = 109,
  342. ABNT_C1 = 110,
  343. ABNT_C2 = 111,
  344. /**
  345. * Placed last to cover the length of the enum.
  346. * Please do not depend on this value!
  347. */
  348. MAX_VALUE = 112,
  349. }
  350. export class KeyMod {
  351. static readonly CtrlCmd: number;
  352. static readonly Shift: number;
  353. static readonly Alt: number;
  354. static readonly WinCtrl: number;
  355. static chord(firstPart: number, secondPart: number): number;
  356. }
  357. /**
  358. * MarkedString can be used to render human readable text. It is either a markdown string
  359. * or a code-block that provides a language and a code snippet. Note that
  360. * markdown strings will be sanitized - that means html will be escaped.
  361. */
  362. export type MarkedString = string | {
  363. readonly language: string;
  364. readonly value: string;
  365. };
  366. export interface IKeyboardEvent {
  367. readonly browserEvent: KeyboardEvent;
  368. readonly target: HTMLElement;
  369. readonly ctrlKey: boolean;
  370. readonly shiftKey: boolean;
  371. readonly altKey: boolean;
  372. readonly metaKey: boolean;
  373. readonly keyCode: KeyCode;
  374. readonly code: string;
  375. equals(keybinding: number): boolean;
  376. preventDefault(): void;
  377. stopPropagation(): void;
  378. }
  379. export interface IMouseEvent {
  380. readonly browserEvent: MouseEvent;
  381. readonly leftButton: boolean;
  382. readonly middleButton: boolean;
  383. readonly rightButton: boolean;
  384. readonly target: HTMLElement;
  385. readonly detail: number;
  386. readonly posx: number;
  387. readonly posy: number;
  388. readonly ctrlKey: boolean;
  389. readonly shiftKey: boolean;
  390. readonly altKey: boolean;
  391. readonly metaKey: boolean;
  392. readonly timestamp: number;
  393. preventDefault(): void;
  394. stopPropagation(): void;
  395. }
  396. export interface IScrollEvent {
  397. readonly scrollTop: number;
  398. readonly scrollLeft: number;
  399. readonly scrollWidth: number;
  400. readonly scrollHeight: number;
  401. readonly scrollTopChanged: boolean;
  402. readonly scrollLeftChanged: boolean;
  403. readonly scrollWidthChanged: boolean;
  404. readonly scrollHeightChanged: boolean;
  405. }
  406. /**
  407. * A position in the editor. This interface is suitable for serialization.
  408. */
  409. export interface IPosition {
  410. /**
  411. * line number (starts at 1)
  412. */
  413. readonly lineNumber: number;
  414. /**
  415. * column (the first character in a line is between column 1 and column 2)
  416. */
  417. readonly column: number;
  418. }
  419. /**
  420. * A position in the editor.
  421. */
  422. export class Position {
  423. /**
  424. * line number (starts at 1)
  425. */
  426. readonly lineNumber: number;
  427. /**
  428. * column (the first character in a line is between column 1 and column 2)
  429. */
  430. readonly column: number;
  431. constructor(lineNumber: number, column: number);
  432. /**
  433. * Test if this position equals other position
  434. */
  435. equals(other: IPosition): boolean;
  436. /**
  437. * Test if position `a` equals position `b`
  438. */
  439. static equals(a: IPosition, b: IPosition): boolean;
  440. /**
  441. * Test if this position is before other position.
  442. * If the two positions are equal, the result will be false.
  443. */
  444. isBefore(other: IPosition): boolean;
  445. /**
  446. * Test if position `a` is before position `b`.
  447. * If the two positions are equal, the result will be false.
  448. */
  449. static isBefore(a: IPosition, b: IPosition): boolean;
  450. /**
  451. * Test if this position is before other position.
  452. * If the two positions are equal, the result will be true.
  453. */
  454. isBeforeOrEqual(other: IPosition): boolean;
  455. /**
  456. * Test if position `a` is before position `b`.
  457. * If the two positions are equal, the result will be true.
  458. */
  459. static isBeforeOrEqual(a: IPosition, b: IPosition): boolean;
  460. /**
  461. * A function that compares positions, useful for sorting
  462. */
  463. static compare(a: IPosition, b: IPosition): number;
  464. /**
  465. * Clone this position.
  466. */
  467. clone(): Position;
  468. /**
  469. * Convert to a human-readable representation.
  470. */
  471. toString(): string;
  472. /**
  473. * Create a `Position` from an `IPosition`.
  474. */
  475. static lift(pos: IPosition): Position;
  476. /**
  477. * Test if `obj` is an `IPosition`.
  478. */
  479. static isIPosition(obj: any): obj is IPosition;
  480. }
  481. /**
  482. * A range in the editor. This interface is suitable for serialization.
  483. */
  484. export interface IRange {
  485. /**
  486. * Line number on which the range starts (starts at 1).
  487. */
  488. readonly startLineNumber: number;
  489. /**
  490. * Column on which the range starts in line `startLineNumber` (starts at 1).
  491. */
  492. readonly startColumn: number;
  493. /**
  494. * Line number on which the range ends.
  495. */
  496. readonly endLineNumber: number;
  497. /**
  498. * Column on which the range ends in line `endLineNumber`.
  499. */
  500. readonly endColumn: number;
  501. }
  502. /**
  503. * A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)
  504. */
  505. export class Range {
  506. /**
  507. * Line number on which the range starts (starts at 1).
  508. */
  509. readonly startLineNumber: number;
  510. /**
  511. * Column on which the range starts in line `startLineNumber` (starts at 1).
  512. */
  513. readonly startColumn: number;
  514. /**
  515. * Line number on which the range ends.
  516. */
  517. readonly endLineNumber: number;
  518. /**
  519. * Column on which the range ends in line `endLineNumber`.
  520. */
  521. readonly endColumn: number;
  522. constructor(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number);
  523. /**
  524. * Test if this range is empty.
  525. */
  526. isEmpty(): boolean;
  527. /**
  528. * Test if `range` is empty.
  529. */
  530. static isEmpty(range: IRange): boolean;
  531. /**
  532. * Test if position is in this range. If the position is at the edges, will return true.
  533. */
  534. containsPosition(position: IPosition): boolean;
  535. /**
  536. * Test if `position` is in `range`. If the position is at the edges, will return true.
  537. */
  538. static containsPosition(range: IRange, position: IPosition): boolean;
  539. /**
  540. * Test if range is in this range. If the range is equal to this range, will return true.
  541. */
  542. containsRange(range: IRange): boolean;
  543. /**
  544. * Test if `otherRange` is in `range`. If the ranges are equal, will return true.
  545. */
  546. static containsRange(range: IRange, otherRange: IRange): boolean;
  547. /**
  548. * A reunion of the two ranges.
  549. * The smallest position will be used as the start point, and the largest one as the end point.
  550. */
  551. plusRange(range: IRange): Range;
  552. /**
  553. * A reunion of the two ranges.
  554. * The smallest position will be used as the start point, and the largest one as the end point.
  555. */
  556. static plusRange(a: IRange, b: IRange): Range;
  557. /**
  558. * A intersection of the two ranges.
  559. */
  560. intersectRanges(range: IRange): Range;
  561. /**
  562. * A intersection of the two ranges.
  563. */
  564. static intersectRanges(a: IRange, b: IRange): Range;
  565. /**
  566. * Test if this range equals other.
  567. */
  568. equalsRange(other: IRange): boolean;
  569. /**
  570. * Test if range `a` equals `b`.
  571. */
  572. static equalsRange(a: IRange, b: IRange): boolean;
  573. /**
  574. * Return the end position (which will be after or equal to the start position)
  575. */
  576. getEndPosition(): Position;
  577. /**
  578. * Return the start position (which will be before or equal to the end position)
  579. */
  580. getStartPosition(): Position;
  581. /**
  582. * Clone this range.
  583. */
  584. cloneRange(): Range;
  585. /**
  586. * Transform to a user presentable string representation.
  587. */
  588. toString(): string;
  589. /**
  590. * Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.
  591. */
  592. setEndPosition(endLineNumber: number, endColumn: number): Range;
  593. /**
  594. * Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.
  595. */
  596. setStartPosition(startLineNumber: number, startColumn: number): Range;
  597. /**
  598. * Create a new empty range using this range's start position.
  599. */
  600. collapseToStart(): Range;
  601. /**
  602. * Create a new empty range using this range's start position.
  603. */
  604. static collapseToStart(range: IRange): Range;
  605. static fromPositions(start: IPosition, end?: IPosition): Range;
  606. /**
  607. * Create a `Range` from an `IRange`.
  608. */
  609. static lift(range: IRange): Range;
  610. /**
  611. * Test if `obj` is an `IRange`.
  612. */
  613. static isIRange(obj: any): obj is IRange;
  614. /**
  615. * Test if the two ranges are touching in any way.
  616. */
  617. static areIntersectingOrTouching(a: IRange, b: IRange): boolean;
  618. /**
  619. * A function that compares ranges, useful for sorting ranges
  620. * It will first compare ranges on the startPosition and then on the endPosition
  621. */
  622. static compareRangesUsingStarts(a: IRange, b: IRange): number;
  623. /**
  624. * A function that compares ranges, useful for sorting ranges
  625. * It will first compare ranges on the endPosition and then on the startPosition
  626. */
  627. static compareRangesUsingEnds(a: IRange, b: IRange): number;
  628. /**
  629. * Test if the range spans multiple lines.
  630. */
  631. static spansMultipleLines(range: IRange): boolean;
  632. }
  633. /**
  634. * A selection in the editor.
  635. * The selection is a range that has an orientation.
  636. */
  637. export interface ISelection {
  638. /**
  639. * The line number on which the selection has started.
  640. */
  641. readonly selectionStartLineNumber: number;
  642. /**
  643. * The column on `selectionStartLineNumber` where the selection has started.
  644. */
  645. readonly selectionStartColumn: number;
  646. /**
  647. * The line number on which the selection has ended.
  648. */
  649. readonly positionLineNumber: number;
  650. /**
  651. * The column on `positionLineNumber` where the selection has ended.
  652. */
  653. readonly positionColumn: number;
  654. }
  655. /**
  656. * A selection in the editor.
  657. * The selection is a range that has an orientation.
  658. */
  659. export class Selection extends Range {
  660. /**
  661. * The line number on which the selection has started.
  662. */
  663. readonly selectionStartLineNumber: number;
  664. /**
  665. * The column on `selectionStartLineNumber` where the selection has started.
  666. */
  667. readonly selectionStartColumn: number;
  668. /**
  669. * The line number on which the selection has ended.
  670. */
  671. readonly positionLineNumber: number;
  672. /**
  673. * The column on `positionLineNumber` where the selection has ended.
  674. */
  675. readonly positionColumn: number;
  676. constructor(selectionStartLineNumber: number, selectionStartColumn: number, positionLineNumber: number, positionColumn: number);
  677. /**
  678. * Clone this selection.
  679. */
  680. clone(): Selection;
  681. /**
  682. * Transform to a human-readable representation.
  683. */
  684. toString(): string;
  685. /**
  686. * Test if equals other selection.
  687. */
  688. equalsSelection(other: ISelection): boolean;
  689. /**
  690. * Test if the two selections are equal.
  691. */
  692. static selectionsEqual(a: ISelection, b: ISelection): boolean;
  693. /**
  694. * Get directions (LTR or RTL).
  695. */
  696. getDirection(): SelectionDirection;
  697. /**
  698. * Create a new selection with a different `positionLineNumber` and `positionColumn`.
  699. */
  700. setEndPosition(endLineNumber: number, endColumn: number): Selection;
  701. /**
  702. * Get the position at `positionLineNumber` and `positionColumn`.
  703. */
  704. getPosition(): Position;
  705. /**
  706. * Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`.
  707. */
  708. setStartPosition(startLineNumber: number, startColumn: number): Selection;
  709. /**
  710. * Create a `Selection` from one or two positions
  711. */
  712. static fromPositions(start: IPosition, end?: IPosition): Selection;
  713. /**
  714. * Create a `Selection` from an `ISelection`.
  715. */
  716. static liftSelection(sel: ISelection): Selection;
  717. /**
  718. * `a` equals `b`.
  719. */
  720. static selectionsArrEqual(a: ISelection[], b: ISelection[]): boolean;
  721. /**
  722. * Test if `obj` is an `ISelection`.
  723. */
  724. static isISelection(obj: any): obj is ISelection;
  725. /**
  726. * Create with a direction.
  727. */
  728. static createWithDirection(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number, direction: SelectionDirection): Selection;
  729. }
  730. /**
  731. * The direction of a selection.
  732. */
  733. export enum SelectionDirection {
  734. /**
  735. * The selection starts above where it ends.
  736. */
  737. LTR = 0,
  738. /**
  739. * The selection starts below where it ends.
  740. */
  741. RTL = 1,
  742. }
  743. export class Token {
  744. _tokenBrand: void;
  745. readonly offset: number;
  746. readonly type: string;
  747. readonly language: string;
  748. constructor(offset: number, type: string, language: string);
  749. toString(): string;
  750. }
  751. }
  752. declare module monaco.editor {
  753. /**
  754. * Create a new editor under `domElement`.
  755. * `domElement` should be empty (not contain other dom nodes).
  756. * The editor will read the size of `domElement`.
  757. */
  758. export function create(domElement: HTMLElement, options?: IEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneCodeEditor;
  759. /**
  760. * Emitted when an editor is created.
  761. * Creating a diff editor might cause this listener to be invoked with the two editors.
  762. * @event
  763. */
  764. export function onDidCreateEditor(listener: (codeEditor: ICodeEditor) => void): IDisposable;
  765. /**
  766. * Create a new diff editor under `domElement`.
  767. * `domElement` should be empty (not contain other dom nodes).
  768. * The editor will read the size of `domElement`.
  769. */
  770. export function createDiffEditor(domElement: HTMLElement, options?: IDiffEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneDiffEditor;
  771. export interface IDiffNavigator {
  772. revealFirst: boolean;
  773. canNavigate(): boolean;
  774. next(): void;
  775. previous(): void;
  776. dispose(): void;
  777. }
  778. export interface IDiffNavigatorOptions {
  779. readonly followsCaret?: boolean;
  780. readonly ignoreCharChanges?: boolean;
  781. readonly alwaysRevealFirst?: boolean;
  782. }
  783. export function createDiffNavigator(diffEditor: IStandaloneDiffEditor, opts?: IDiffNavigatorOptions): IDiffNavigator;
  784. /**
  785. * Create a new editor model.
  786. * You can specify the language that should be set for this model or let the language be inferred from the `uri`.
  787. */
  788. export function createModel(value: string, language?: string, uri?: Uri): IModel;
  789. /**
  790. * Change the language for a model.
  791. */
  792. export function setModelLanguage(model: IModel, language: string): void;
  793. /**
  794. * Set the markers for a model.
  795. */
  796. export function setModelMarkers(model: IModel, owner: string, markers: IMarkerData[]): void;
  797. /**
  798. * Get the model that has `uri` if it exists.
  799. */
  800. export function getModel(uri: Uri): IModel;
  801. /**
  802. * Get all the created models.
  803. */
  804. export function getModels(): IModel[];
  805. /**
  806. * Emitted when a model is created.
  807. * @event
  808. */
  809. export function onDidCreateModel(listener: (model: IModel) => void): IDisposable;
  810. /**
  811. * Emitted right before a model is disposed.
  812. * @event
  813. */
  814. export function onWillDisposeModel(listener: (model: IModel) => void): IDisposable;
  815. /**
  816. * Emitted when a different language is set to a model.
  817. * @event
  818. */
  819. export function onDidChangeModelLanguage(listener: (e: {
  820. readonly model: IModel;
  821. readonly oldLanguage: string;
  822. }) => void): IDisposable;
  823. /**
  824. * Create a new web worker that has model syncing capabilities built in.
  825. * Specify an AMD module to load that will `create` an object that will be proxied.
  826. */
  827. export function createWebWorker<T>(opts: IWebWorkerOptions): MonacoWebWorker<T>;
  828. /**
  829. * Colorize the contents of `domNode` using attribute `data-lang`.
  830. */
  831. export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): Promise<void>;
  832. /**
  833. * Colorize `text` using language `languageId`.
  834. */
  835. export function colorize(text: string, languageId: string, options: IColorizerOptions): Promise<string>;
  836. /**
  837. * Colorize a line in a model.
  838. */
  839. export function colorizeModelLine(model: IModel, lineNumber: number, tabSize?: number): string;
  840. /**
  841. * Tokenize `text` using language `languageId`
  842. */
  843. export function tokenize(text: string, languageId: string): Token[][];
  844. /**
  845. * Define a new theme.
  846. */
  847. export function defineTheme(themeName: string, themeData: IStandaloneThemeData): void;
  848. /**
  849. * Switches to a theme.
  850. */
  851. export function setTheme(themeName: string): void;
  852. export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black';
  853. export interface IStandaloneThemeData {
  854. base: BuiltinTheme;
  855. inherit: boolean;
  856. rules: ITokenThemeRule[];
  857. colors: IColors;
  858. }
  859. export type IColors = {
  860. [colorId: string]: string;
  861. };
  862. export interface ITokenThemeRule {
  863. token: string;
  864. foreground?: string;
  865. background?: string;
  866. fontStyle?: string;
  867. }
  868. /**
  869. * A web worker that can provide a proxy to an arbitrary file.
  870. */
  871. export interface MonacoWebWorker<T> {
  872. /**
  873. * Terminate the web worker, thus invalidating the returned proxy.
  874. */
  875. dispose(): void;
  876. /**
  877. * Get a proxy to the arbitrary loaded code.
  878. */
  879. getProxy(): Promise<T>;
  880. /**
  881. * Synchronize (send) the models at `resources` to the web worker,
  882. * making them available in the monaco.worker.getMirrorModels().
  883. */
  884. withSyncedResources(resources: Uri[]): Promise<T>;
  885. }
  886. export interface IWebWorkerOptions {
  887. /**
  888. * The AMD moduleId to load.
  889. * It should export a function `create` that should return the exported proxy.
  890. */
  891. moduleId: string;
  892. /**
  893. * The data to send over when calling create on the module.
  894. */
  895. createData?: any;
  896. /**
  897. * A label to be used to identify the web worker for debugging purposes.
  898. */
  899. label?: string;
  900. }
  901. /**
  902. * The options to create an editor.
  903. */
  904. export interface IEditorConstructionOptions extends IEditorOptions {
  905. /**
  906. * The initial model associated with this code editor.
  907. */
  908. model?: IModel;
  909. /**
  910. * The initial value of the auto created model in the editor.
  911. * To not create automatically a model, use `model: null`.
  912. */
  913. value?: string;
  914. /**
  915. * The initial language of the auto created model in the editor.
  916. * To not create automatically a model, use `model: null`.
  917. */
  918. language?: string;
  919. /**
  920. * Initial theme to be used for rendering.
  921. * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
  922. * You can create custom themes via `monaco.editor.defineTheme`.
  923. * To switch a theme, use `monaco.editor.setTheme`
  924. */
  925. theme?: string;
  926. /**
  927. * An URL to open when Ctrl+H (Windows and Linux) or Cmd+H (OSX) is pressed in
  928. * the accessibility help dialog in the editor.
  929. *
  930. * Defaults to "https://go.microsoft.com/fwlink/?linkid=852450"
  931. */
  932. accessibilityHelpUrl?: string;
  933. }
  934. /**
  935. * The options to create a diff editor.
  936. */
  937. export interface IDiffEditorConstructionOptions extends IDiffEditorOptions {
  938. /**
  939. * Initial theme to be used for rendering.
  940. * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
  941. * You can create custom themes via `monaco.editor.defineTheme`.
  942. * To switch a theme, use `monaco.editor.setTheme`
  943. */
  944. theme?: string;
  945. }
  946. export interface IStandaloneCodeEditor extends ICodeEditor {
  947. addCommand(keybinding: number, handler: ICommandHandler, context: string): string;
  948. createContextKey<T>(key: string, defaultValue: T): IContextKey<T>;
  949. addAction(descriptor: IActionDescriptor): IDisposable;
  950. }
  951. export interface IStandaloneDiffEditor extends IDiffEditor {
  952. addCommand(keybinding: number, handler: ICommandHandler, context: string): string;
  953. createContextKey<T>(key: string, defaultValue: T): IContextKey<T>;
  954. addAction(descriptor: IActionDescriptor): IDisposable;
  955. getOriginalEditor(): IStandaloneCodeEditor;
  956. getModifiedEditor(): IStandaloneCodeEditor;
  957. }
  958. export interface ICommandHandler {
  959. (...args: any[]): void;
  960. }
  961. export interface IContextKey<T> {
  962. set(value: T): void;
  963. reset(): void;
  964. get(): T;
  965. }
  966. export interface IEditorOverrideServices {
  967. [index: string]: any;
  968. }
  969. /**
  970. * A structure defining a problem/warning/etc.
  971. */
  972. export interface IMarkerData {
  973. code?: string;
  974. severity: Severity;
  975. message: string;
  976. source?: string;
  977. startLineNumber: number;
  978. startColumn: number;
  979. endLineNumber: number;
  980. endColumn: number;
  981. }
  982. export interface IColorizerOptions {
  983. tabSize?: number;
  984. }
  985. export interface IColorizerElementOptions extends IColorizerOptions {
  986. theme?: string;
  987. mimeType?: string;
  988. }
  989. export enum ScrollbarVisibility {
  990. Auto = 1,
  991. Hidden = 2,
  992. Visible = 3,
  993. }
  994. export interface ThemeColor {
  995. id: string;
  996. }
  997. /**
  998. * Vertical Lane in the overview ruler of the editor.
  999. */
  1000. export enum OverviewRulerLane {
  1001. Left = 1,
  1002. Center = 2,
  1003. Right = 4,
  1004. Full = 7,
  1005. }
  1006. /**
  1007. * Options for rendering a model decoration in the overview ruler.
  1008. */
  1009. export interface IModelDecorationOverviewRulerOptions {
  1010. /**
  1011. * CSS color to render in the overview ruler.
  1012. * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
  1013. */
  1014. color: string | ThemeColor;
  1015. /**
  1016. * CSS color to render in the overview ruler.
  1017. * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
  1018. */
  1019. darkColor: string | ThemeColor;
  1020. /**
  1021. * CSS color to render in the overview ruler.
  1022. * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
  1023. */
  1024. hcColor?: string | ThemeColor;
  1025. /**
  1026. * The position in the overview ruler.
  1027. */
  1028. position: OverviewRulerLane;
  1029. }
  1030. /**
  1031. * Options for a model decoration.
  1032. */
  1033. export interface IModelDecorationOptions {
  1034. /**
  1035. * Customize the growing behavior of the decoration when typing at the edges of the decoration.
  1036. * Defaults to TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges
  1037. */
  1038. stickiness?: TrackedRangeStickiness;
  1039. /**
  1040. * CSS class name describing the decoration.
  1041. */
  1042. className?: string;
  1043. /**
  1044. * Message to be rendered when hovering over the glyph margin decoration.
  1045. */
  1046. glyphMarginHoverMessage?: MarkedString | MarkedString[];
  1047. /**
  1048. * Array of MarkedString to render as the decoration message.
  1049. */
  1050. hoverMessage?: MarkedString | MarkedString[];
  1051. /**
  1052. * Should the decoration expand to encompass a whole line.
  1053. */
  1054. isWholeLine?: boolean;
  1055. /**
  1056. * If set, render this decoration in the overview ruler.
  1057. */
  1058. overviewRuler?: IModelDecorationOverviewRulerOptions;
  1059. /**
  1060. * If set, the decoration will be rendered in the glyph margin with this CSS class name.
  1061. */
  1062. glyphMarginClassName?: string;
  1063. /**
  1064. * If set, the decoration will be rendered in the lines decorations with this CSS class name.
  1065. */
  1066. linesDecorationsClassName?: string;
  1067. /**
  1068. * If set, the decoration will be rendered in the margin (covering its full width) with this CSS class name.
  1069. */
  1070. marginClassName?: string;
  1071. /**
  1072. * If set, the decoration will be rendered inline with the text with this CSS class name.
  1073. * Please use this only for CSS rules that must impact the text. For example, use `className`
  1074. * to have a background color decoration.
  1075. */
  1076. inlineClassName?: string;
  1077. /**
  1078. * If set, the decoration will be rendered before the text with this CSS class name.
  1079. */
  1080. beforeContentClassName?: string;
  1081. /**
  1082. * If set, the decoration will be rendered after the text with this CSS class name.
  1083. */
  1084. afterContentClassName?: string;
  1085. }
  1086. /**
  1087. * New model decorations.
  1088. */
  1089. export interface IModelDeltaDecoration {
  1090. /**
  1091. * Range that this decoration covers.
  1092. */
  1093. range: IRange;
  1094. /**
  1095. * Options associated with this decoration.
  1096. */
  1097. options: IModelDecorationOptions;
  1098. }
  1099. /**
  1100. * A decoration in the model.
  1101. */
  1102. export interface IModelDecoration {
  1103. /**
  1104. * Identifier for a decoration.
  1105. */
  1106. readonly id: string;
  1107. /**
  1108. * Identifier for a decoration's owener.
  1109. */
  1110. readonly ownerId: number;
  1111. /**
  1112. * Range that this decoration covers.
  1113. */
  1114. readonly range: Range;
  1115. /**
  1116. * Options associated with this decoration.
  1117. */
  1118. readonly options: IModelDecorationOptions;
  1119. /**
  1120. * A flag describing if this is a problem decoration (e.g. warning/error).
  1121. */
  1122. readonly isForValidation: boolean;
  1123. }
  1124. /**
  1125. * Word inside a model.
  1126. */
  1127. export interface IWordAtPosition {
  1128. /**
  1129. * The word.
  1130. */
  1131. readonly word: string;
  1132. /**
  1133. * The column where the word starts.
  1134. */
  1135. readonly startColumn: number;
  1136. /**
  1137. * The column where the word ends.
  1138. */
  1139. readonly endColumn: number;
  1140. }
  1141. /**
  1142. * End of line character preference.
  1143. */
  1144. export enum EndOfLinePreference {
  1145. /**
  1146. * Use the end of line character identified in the text buffer.
  1147. */
  1148. TextDefined = 0,
  1149. /**
  1150. * Use line feed (\n) as the end of line character.
  1151. */
  1152. LF = 1,
  1153. /**
  1154. * Use carriage return and line feed (\r\n) as the end of line character.
  1155. */
  1156. CRLF = 2,
  1157. }
  1158. /**
  1159. * The default end of line to use when instantiating models.
  1160. */
  1161. export enum DefaultEndOfLine {
  1162. /**
  1163. * Use line feed (\n) as the end of line character.
  1164. */
  1165. LF = 1,
  1166. /**
  1167. * Use carriage return and line feed (\r\n) as the end of line character.
  1168. */
  1169. CRLF = 2,
  1170. }
  1171. /**
  1172. * End of line character preference.
  1173. */
  1174. export enum EndOfLineSequence {
  1175. /**
  1176. * Use line feed (\n) as the end of line character.
  1177. */
  1178. LF = 0,
  1179. /**
  1180. * Use carriage return and line feed (\r\n) as the end of line character.
  1181. */
  1182. CRLF = 1,
  1183. }
  1184. /**
  1185. * An identifier for a single edit operation.
  1186. */
  1187. export interface ISingleEditOperationIdentifier {
  1188. /**
  1189. * Identifier major
  1190. */
  1191. major: number;
  1192. /**
  1193. * Identifier minor
  1194. */
  1195. minor: number;
  1196. }
  1197. /**
  1198. * A builder and helper for edit operations for a command.
  1199. */
  1200. export interface IEditOperationBuilder {
  1201. /**
  1202. * Add a new edit operation (a replace operation).
  1203. * @param range The range to replace (delete). May be empty to represent a simple insert.
  1204. * @param text The text to replace with. May be null to represent a simple delete.
  1205. */
  1206. addEditOperation(range: Range, text: string): void;
  1207. /**
  1208. * Add a new edit operation (a replace operation).
  1209. * The inverse edits will be accessible in `ICursorStateComputerData.getInverseEditOperations()`
  1210. * @param range The range to replace (delete). May be empty to represent a simple insert.
  1211. * @param text The text to replace with. May be null to represent a simple delete.
  1212. */
  1213. addTrackedEditOperation(range: Range, text: string): void;
  1214. /**
  1215. * Track `selection` when applying edit operations.
  1216. * A best effort will be made to not grow/expand the selection.
  1217. * An empty selection will clamp to a nearby character.
  1218. * @param selection The selection to track.
  1219. * @param trackPreviousOnEmpty If set, and the selection is empty, indicates whether the selection
  1220. * should clamp to the previous or the next character.
  1221. * @return A unique identifer.
  1222. */
  1223. trackSelection(selection: Selection, trackPreviousOnEmpty?: boolean): string;
  1224. }
  1225. /**
  1226. * A helper for computing cursor state after a command.
  1227. */
  1228. export interface ICursorStateComputerData {
  1229. /**
  1230. * Get the inverse edit operations of the added edit operations.
  1231. */
  1232. getInverseEditOperations(): IIdentifiedSingleEditOperation[];
  1233. /**
  1234. * Get a previously tracked selection.
  1235. * @param id The unique identifier returned by `trackSelection`.
  1236. * @return The selection.
  1237. */
  1238. getTrackedSelection(id: string): Selection;
  1239. }
  1240. /**
  1241. * A command that modifies text / cursor state on a model.
  1242. */
  1243. export interface ICommand {
  1244. /**
  1245. * Get the edit operations needed to execute this command.
  1246. * @param model The model the command will execute on.
  1247. * @param builder A helper to collect the needed edit operations and to track selections.
  1248. */
  1249. getEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder): void;
  1250. /**
  1251. * Compute the cursor state after the edit operations were applied.
  1252. * @param model The model the commad has executed on.
  1253. * @param helper A helper to get inverse edit operations and to get previously tracked selections.
  1254. * @return The cursor state after the command executed.
  1255. */
  1256. computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection;
  1257. }
  1258. /**
  1259. * A single edit operation, that acts as a simple replace.
  1260. * i.e. Replace text at `range` with `text` in model.
  1261. */
  1262. export interface ISingleEditOperation {
  1263. /**
  1264. * The range to replace. This can be empty to emulate a simple insert.
  1265. */
  1266. range: IRange;
  1267. /**
  1268. * The text to replace with. This can be null to emulate a simple delete.
  1269. */
  1270. text: string;
  1271. /**
  1272. * This indicates that this operation has "insert" semantics.
  1273. * i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved.
  1274. */
  1275. forceMoveMarkers?: boolean;
  1276. }
  1277. /**
  1278. * A single edit operation, that has an identifier.
  1279. */
  1280. export interface IIdentifiedSingleEditOperation {
  1281. /**
  1282. * An identifier associated with this single edit operation.
  1283. */
  1284. identifier: ISingleEditOperationIdentifier;
  1285. /**
  1286. * The range to replace. This can be empty to emulate a simple insert.
  1287. */
  1288. range: Range;
  1289. /**
  1290. * The text to replace with. This can be null to emulate a simple delete.
  1291. */
  1292. text: string;
  1293. /**
  1294. * This indicates that this operation has "insert" semantics.
  1295. * i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved.
  1296. */
  1297. forceMoveMarkers: boolean;
  1298. /**
  1299. * This indicates that this operation is inserting automatic whitespace
  1300. * that can be removed on next model edit operation if `config.trimAutoWhitespace` is true.
  1301. */
  1302. isAutoWhitespaceEdit?: boolean;
  1303. }
  1304. /**
  1305. * A callback that can compute the cursor state after applying a series of edit operations.
  1306. */
  1307. export interface ICursorStateComputer {
  1308. /**
  1309. * A callback that can compute the resulting cursors state after some edit operations have been executed.
  1310. */
  1311. (inverseEditOperations: IIdentifiedSingleEditOperation[]): Selection[];
  1312. }
  1313. export class TextModelResolvedOptions {
  1314. _textModelResolvedOptionsBrand: void;
  1315. readonly tabSize: number;
  1316. readonly insertSpaces: boolean;
  1317. readonly defaultEOL: DefaultEndOfLine;
  1318. readonly trimAutoWhitespace: boolean;
  1319. }
  1320. export interface ITextModelUpdateOptions {
  1321. tabSize?: number;
  1322. insertSpaces?: boolean;
  1323. trimAutoWhitespace?: boolean;
  1324. }
  1325. /**
  1326. * A textual read-only model.
  1327. */
  1328. export interface ITextModel {
  1329. /**
  1330. * Get the resolved options for this model.
  1331. */
  1332. getOptions(): TextModelResolvedOptions;
  1333. /**
  1334. * Get the current version id of the model.
  1335. * Anytime a change happens to the model (even undo/redo),
  1336. * the version id is incremented.
  1337. */
  1338. getVersionId(): number;
  1339. /**
  1340. * Get the alternative version id of the model.
  1341. * This alternative version id is not always incremented,
  1342. * it will return the same values in the case of undo-redo.
  1343. */
  1344. getAlternativeVersionId(): number;
  1345. /**
  1346. * Replace the entire text buffer value contained in this model.
  1347. */
  1348. setValue(newValue: string): void;
  1349. /**
  1350. * Get the text stored in this model.
  1351. * @param eol The end of line character preference. Defaults to `EndOfLinePreference.TextDefined`.
  1352. * @param preserverBOM Preserve a BOM character if it was detected when the model was constructed.
  1353. * @return The text.
  1354. */
  1355. getValue(eol?: EndOfLinePreference, preserveBOM?: boolean): string;
  1356. /**
  1357. * Get the length of the text stored in this model.
  1358. */
  1359. getValueLength(eol?: EndOfLinePreference, preserveBOM?: boolean): number;
  1360. /**
  1361. * Get the text in a certain range.
  1362. * @param range The range describing what text to get.
  1363. * @param eol The end of line character preference. This will only be used for multiline ranges. Defaults to `EndOfLinePreference.TextDefined`.
  1364. * @return The text.
  1365. */
  1366. getValueInRange(range: IRange, eol?: EndOfLinePreference): string;
  1367. /**
  1368. * Get the length of text in a certain range.
  1369. * @param range The range describing what text length to get.
  1370. * @return The text length.
  1371. */
  1372. getValueLengthInRange(range: IRange): number;
  1373. /**
  1374. * Get the number of lines in the model.
  1375. */
  1376. getLineCount(): number;
  1377. /**
  1378. * Get the text for a certain line.
  1379. */
  1380. getLineContent(lineNumber: number): string;
  1381. /**
  1382. * Get the text for all lines.
  1383. */
  1384. getLinesContent(): string[];
  1385. /**
  1386. * Get the end of line sequence predominantly used in the text buffer.
  1387. * @return EOL char sequence (e.g.: '\n' or '\r\n').
  1388. */
  1389. getEOL(): string;
  1390. /**
  1391. * Change the end of line sequence used in the text buffer.
  1392. */
  1393. setEOL(eol: EndOfLineSequence): void;
  1394. /**
  1395. * Get the minimum legal column for line at `lineNumber`
  1396. */
  1397. getLineMinColumn(lineNumber: number): number;
  1398. /**
  1399. * Get the maximum legal column for line at `lineNumber`
  1400. */
  1401. getLineMaxColumn(lineNumber: number): number;
  1402. /**
  1403. * Returns the column before the first non whitespace character for line at `lineNumber`.
  1404. * Returns 0 if line is empty or contains only whitespace.
  1405. */
  1406. getLineFirstNonWhitespaceColumn(lineNumber: number): number;
  1407. /**
  1408. * Returns the column after the last non whitespace character for line at `lineNumber`.
  1409. * Returns 0 if line is empty or contains only whitespace.
  1410. */
  1411. getLineLastNonWhitespaceColumn(lineNumber: number): number;
  1412. /**
  1413. * Create a valid position,
  1414. */
  1415. validatePosition(position: IPosition): Position;
  1416. /**
  1417. * Advances the given position by the given offest (negative offsets are also accepted)
  1418. * and returns it as a new valid position.
  1419. *
  1420. * If the offset and position are such that their combination goes beyond the beginning or
  1421. * end of the model, throws an exception.
  1422. *
  1423. * If the ofsset is such that the new position would be in the middle of a multi-byte
  1424. * line terminator, throws an exception.
  1425. */
  1426. modifyPosition(position: IPosition, offset: number): Position;
  1427. /**
  1428. * Create a valid range.
  1429. */
  1430. validateRange(range: IRange): Range;
  1431. /**
  1432. * Converts the position to a zero-based offset.
  1433. *
  1434. * The position will be [adjusted](#TextDocument.validatePosition).
  1435. *
  1436. * @param position A position.
  1437. * @return A valid zero-based offset.
  1438. */
  1439. getOffsetAt(position: IPosition): number;
  1440. /**
  1441. * Converts a zero-based offset to a position.
  1442. *
  1443. * @param offset A zero-based offset.
  1444. * @return A valid [position](#Position).
  1445. */
  1446. getPositionAt(offset: number): Position;
  1447. /**
  1448. * Get a range covering the entire model
  1449. */
  1450. getFullModelRange(): Range;
  1451. /**
  1452. * Returns iff the model was disposed or not.
  1453. */
  1454. isDisposed(): boolean;
  1455. /**
  1456. * Search the model.
  1457. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
  1458. * @param searchOnlyEditableRange Limit the searching to only search inside the editable range of the model.
  1459. * @param isRegex Used to indicate that `searchString` is a regular expression.
  1460. * @param matchCase Force the matching to match lower/upper case exactly.
  1461. * @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
  1462. * @param captureMatches The result will contain the captured groups.
  1463. * @param limitResultCount Limit the number of results
  1464. * @return The ranges where the matches are. It is empty if not matches have been found.
  1465. */
  1466. findMatches(searchString: string, searchOnlyEditableRange: boolean, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean, limitResultCount?: number): FindMatch[];
  1467. /**
  1468. * Search the model.
  1469. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
  1470. * @param searchScope Limit the searching to only search inside this range.
  1471. * @param isRegex Used to indicate that `searchString` is a regular expression.
  1472. * @param matchCase Force the matching to match lower/upper case exactly.
  1473. * @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
  1474. * @param captureMatches The result will contain the captured groups.
  1475. * @param limitResultCount Limit the number of results
  1476. * @return The ranges where the matches are. It is empty if no matches have been found.
  1477. */
  1478. findMatches(searchString: string, searchScope: IRange, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean, limitResultCount?: number): FindMatch[];
  1479. /**
  1480. * Search the model for the next match. Loops to the beginning of the model if needed.
  1481. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
  1482. * @param searchStart Start the searching at the specified position.
  1483. * @param isRegex Used to indicate that `searchString` is a regular expression.
  1484. * @param matchCase Force the matching to match lower/upper case exactly.
  1485. * @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
  1486. * @param captureMatches The result will contain the captured groups.
  1487. * @return The range where the next match is. It is null if no next match has been found.
  1488. */
  1489. findNextMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): FindMatch;
  1490. /**
  1491. * Search the model for the previous match. Loops to the end of the model if needed.
  1492. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
  1493. * @param searchStart Start the searching at the specified position.
  1494. * @param isRegex Used to indicate that `searchString` is a regular expression.
  1495. * @param matchCase Force the matching to match lower/upper case exactly.
  1496. * @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
  1497. * @param captureMatches The result will contain the captured groups.
  1498. * @return The range where the previous match is. It is null if no previous match has been found.
  1499. */
  1500. findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): FindMatch;
  1501. }
  1502. export class FindMatch {
  1503. _findMatchBrand: void;
  1504. readonly range: Range;
  1505. readonly matches: string[];
  1506. }
  1507. export interface IReadOnlyModel extends ITextModel {
  1508. /**
  1509. * Gets the resource associated with this editor model.
  1510. */
  1511. readonly uri: Uri;
  1512. /**
  1513. * Get the language associated with this model.
  1514. */
  1515. getModeId(): string;
  1516. /**
  1517. * Get the word under or besides `position`.
  1518. * @param position The position to look for a word.
  1519. * @param skipSyntaxTokens Ignore syntax tokens, as identified by the mode.
  1520. * @return The word under or besides `position`. Might be null.
  1521. */
  1522. getWordAtPosition(position: IPosition): IWordAtPosition;
  1523. /**
  1524. * Get the word under or besides `position` trimmed to `position`.column
  1525. * @param position The position to look for a word.
  1526. * @param skipSyntaxTokens Ignore syntax tokens, as identified by the mode.
  1527. * @return The word under or besides `position`. Will never be null.
  1528. */
  1529. getWordUntilPosition(position: IPosition): IWordAtPosition;
  1530. }
  1531. /**
  1532. * A model that is tokenized.
  1533. */
  1534. export interface ITokenizedModel extends ITextModel {
  1535. /**
  1536. * Get the language associated with this model.
  1537. */
  1538. getModeId(): string;
  1539. /**
  1540. * Get the word under or besides `position`.
  1541. * @param position The position to look for a word.
  1542. * @param skipSyntaxTokens Ignore syntax tokens, as identified by the mode.
  1543. * @return The word under or besides `position`. Might be null.
  1544. */
  1545. getWordAtPosition(position: IPosition): IWordAtPosition;
  1546. /**
  1547. * Get the word under or besides `position` trimmed to `position`.column
  1548. * @param position The position to look for a word.
  1549. * @param skipSyntaxTokens Ignore syntax tokens, as identified by the mode.
  1550. * @return The word under or besides `position`. Will never be null.
  1551. */
  1552. getWordUntilPosition(position: IPosition): IWordAtPosition;
  1553. }
  1554. /**
  1555. * A model that can track markers.
  1556. */
  1557. export interface ITextModelWithMarkers extends ITextModel {
  1558. }
  1559. /**
  1560. * Describes the behavior of decorations when typing/editing near their edges.
  1561. * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
  1562. */
  1563. export enum TrackedRangeStickiness {
  1564. AlwaysGrowsWhenTypingAtEdges = 0,
  1565. NeverGrowsWhenTypingAtEdges = 1,
  1566. GrowsOnlyWhenTypingBefore = 2,
  1567. GrowsOnlyWhenTypingAfter = 3,
  1568. }
  1569. /**
  1570. * A model that can have decorations.
  1571. */
  1572. export interface ITextModelWithDecorations {
  1573. /**
  1574. * Perform a minimum ammount of operations, in order to transform the decorations
  1575. * identified by `oldDecorations` to the decorations described by `newDecorations`
  1576. * and returns the new identifiers associated with the resulting decorations.
  1577. *
  1578. * @param oldDecorations Array containing previous decorations identifiers.
  1579. * @param newDecorations Array describing what decorations should result after the call.
  1580. * @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.
  1581. * @return An array containing the new decorations identifiers.
  1582. */
  1583. deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[], ownerId?: number): string[];
  1584. /**
  1585. * Get the options associated with a decoration.
  1586. * @param id The decoration id.
  1587. * @return The decoration options or null if the decoration was not found.
  1588. */
  1589. getDecorationOptions(id: string): IModelDecorationOptions;
  1590. /**
  1591. * Get the range associated with a decoration.
  1592. * @param id The decoration id.
  1593. * @return The decoration range or null if the decoration was not found.
  1594. */
  1595. getDecorationRange(id: string): Range;
  1596. /**
  1597. * Gets all the decorations for the line `lineNumber` as an array.
  1598. * @param lineNumber The line number
  1599. * @param ownerId If set, it will ignore decorations belonging to other owners.
  1600. * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
  1601. * @return An array with the decorations
  1602. */
  1603. getLineDecorations(lineNumber: number, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
  1604. /**
  1605. * Gets all the decorations for the lines between `startLineNumber` and `endLineNumber` as an array.
  1606. * @param startLineNumber The start line number
  1607. * @param endLineNumber The end line number
  1608. * @param ownerId If set, it will ignore decorations belonging to other owners.
  1609. * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
  1610. * @return An array with the decorations
  1611. */
  1612. getLinesDecorations(startLineNumber: number, endLineNumber: number, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
  1613. /**
  1614. * Gets all the deocorations in a range as an array. Only `startLineNumber` and `endLineNumber` from `range` are used for filtering.
  1615. * So for now it returns all the decorations on the same line as `range`.
  1616. * @param range The range to search in
  1617. * @param ownerId If set, it will ignore decorations belonging to other owners.
  1618. * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
  1619. * @return An array with the decorations
  1620. */
  1621. getDecorationsInRange(range: IRange, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
  1622. /**
  1623. * Gets all the decorations as an array.
  1624. * @param ownerId If set, it will ignore decorations belonging to other owners.
  1625. * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
  1626. */
  1627. getAllDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
  1628. }
  1629. /**
  1630. * An editable text model.
  1631. */
  1632. export interface IEditableTextModel extends ITextModelWithMarkers {
  1633. /**
  1634. * Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs).
  1635. */
  1636. normalizeIndentation(str: string): string;
  1637. /**
  1638. * Get what is considered to be one indent (e.g. a tab character or 4 spaces, etc.).
  1639. */
  1640. getOneIndent(): string;
  1641. /**
  1642. * Change the options of this model.
  1643. */
  1644. updateOptions(newOpts: ITextModelUpdateOptions): void;
  1645. /**
  1646. * Detect the indentation options for this model from its content.
  1647. */
  1648. detectIndentation(defaultInsertSpaces: boolean, defaultTabSize: number): void;
  1649. /**
  1650. * Push a stack element onto the undo stack. This acts as an undo/redo point.
  1651. * The idea is to use `pushEditOperations` to edit the model and then to
  1652. * `pushStackElement` to create an undo/redo stop point.
  1653. */
  1654. pushStackElement(): void;
  1655. /**
  1656. * Push edit operations, basically editing the model. This is the preferred way
  1657. * of editing the model. The edit operations will land on the undo stack.
  1658. * @param beforeCursorState The cursor state before the edit operaions. This cursor state will be returned when `undo` or `redo` are invoked.
  1659. * @param editOperations The edit operations.
  1660. * @param cursorStateComputer A callback that can compute the resulting cursors state after the edit operations have been executed.
  1661. * @return The cursor state returned by the `cursorStateComputer`.
  1662. */
  1663. pushEditOperations(beforeCursorState: Selection[], editOperations: IIdentifiedSingleEditOperation[], cursorStateComputer: ICursorStateComputer): Selection[];
  1664. /**
  1665. * Edit the model without adding the edits to the undo stack.
  1666. * This can have dire consequences on the undo stack! See @pushEditOperations for the preferred way.
  1667. * @param operations The edit operations.
  1668. * @return The inverse edit operations, that, when applied, will bring the model back to the previous state.
  1669. */
  1670. applyEdits(operations: IIdentifiedSingleEditOperation[]): IIdentifiedSingleEditOperation[];
  1671. }
  1672. /**
  1673. * A model.
  1674. */
  1675. export interface IModel extends IReadOnlyModel, IEditableTextModel, ITextModelWithMarkers, ITokenizedModel, ITextModelWithDecorations {
  1676. /**
  1677. * An event emitted when the contents of the model have changed.
  1678. * @event
  1679. */
  1680. onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable;
  1681. /**
  1682. * An event emitted when decorations of the model have changed.
  1683. * @event
  1684. */
  1685. onDidChangeDecorations(listener: (e: IModelDecorationsChangedEvent) => void): IDisposable;
  1686. /**
  1687. * An event emitted when the model options have changed.
  1688. * @event
  1689. */
  1690. onDidChangeOptions(listener: (e: IModelOptionsChangedEvent) => void): IDisposable;
  1691. /**
  1692. * An event emitted when the language associated with the model has changed.
  1693. * @event
  1694. */
  1695. onDidChangeLanguage(listener: (e: IModelLanguageChangedEvent) => void): IDisposable;
  1696. /**
  1697. * An event emitted right before disposing the model.
  1698. * @event
  1699. */
  1700. onWillDispose(listener: () => void): IDisposable;
  1701. /**
  1702. * A unique identifier associated with this model.
  1703. */
  1704. readonly id: string;
  1705. /**
  1706. * Destroy this model. This will unbind the model from the mode
  1707. * and make all necessary clean-up to release this object to the GC.
  1708. */
  1709. dispose(): void;
  1710. }
  1711. /**
  1712. * A model for the diff editor.
  1713. */
  1714. export interface IDiffEditorModel {
  1715. /**
  1716. * Original model.
  1717. */
  1718. original: IModel;
  1719. /**
  1720. * Modified model.
  1721. */
  1722. modified: IModel;
  1723. }
  1724. /**
  1725. * An event describing that an editor has had its model reset (i.e. `editor.setModel()`).
  1726. */
  1727. export interface IModelChangedEvent {
  1728. /**
  1729. * The `uri` of the previous model or null.
  1730. */
  1731. readonly oldModelUrl: Uri;
  1732. /**
  1733. * The `uri` of the new model or null.
  1734. */
  1735. readonly newModelUrl: Uri;
  1736. }
  1737. export interface IDimension {
  1738. width: number;
  1739. height: number;
  1740. }
  1741. /**
  1742. * A change
  1743. */
  1744. export interface IChange {
  1745. readonly originalStartLineNumber: number;
  1746. readonly originalEndLineNumber: number;
  1747. readonly modifiedStartLineNumber: number;
  1748. readonly modifiedEndLineNumber: number;
  1749. }
  1750. /**
  1751. * A character level change.
  1752. */
  1753. export interface ICharChange extends IChange {
  1754. readonly originalStartColumn: number;
  1755. readonly originalEndColumn: number;
  1756. readonly modifiedStartColumn: number;
  1757. readonly modifiedEndColumn: number;
  1758. }
  1759. /**
  1760. * A line change
  1761. */
  1762. export interface ILineChange extends IChange {
  1763. readonly charChanges: ICharChange[];
  1764. }
  1765. /**
  1766. * Information about a line in the diff editor
  1767. */
  1768. export interface IDiffLineInformation {
  1769. readonly equivalentLineNumber: number;
  1770. }
  1771. export interface INewScrollPosition {
  1772. scrollLeft?: number;
  1773. scrollTop?: number;
  1774. }
  1775. /**
  1776. * Description of an action contribution
  1777. */
  1778. export interface IActionDescriptor {
  1779. /**
  1780. * An unique identifier of the contributed action.
  1781. */
  1782. id: string;
  1783. /**
  1784. * A label of the action that will be presented to the user.
  1785. */
  1786. label: string;
  1787. /**
  1788. * Precondition rule.
  1789. */
  1790. precondition?: string;
  1791. /**
  1792. * An array of keybindings for the action.
  1793. */
  1794. keybindings?: number[];
  1795. /**
  1796. * The keybinding rule (condition on top of precondition).
  1797. */
  1798. keybindingContext?: string;
  1799. /**
  1800. * Control if the action should show up in the context menu and where.
  1801. * The context menu of the editor has these default:
  1802. * navigation - The navigation group comes first in all cases.
  1803. * 1_modification - This group comes next and contains commands that modify your code.
  1804. * 9_cutcopypaste - The last default group with the basic editing commands.
  1805. * You can also create your own group.
  1806. * Defaults to null (don't show in context menu).
  1807. */
  1808. contextMenuGroupId?: string;
  1809. /**
  1810. * Control the order in the context menu group.
  1811. */
  1812. contextMenuOrder?: number;
  1813. /**
  1814. * Method that will be executed when the action is triggered.
  1815. * @param editor The editor instance is passed in as a convinience
  1816. */
  1817. run(editor: ICommonCodeEditor): void | Promise<void>;
  1818. }
  1819. export interface IEditorAction {
  1820. readonly id: string;
  1821. readonly label: string;
  1822. readonly alias: string;
  1823. isSupported(): boolean;
  1824. run(): Promise<void>;
  1825. }
  1826. export type IEditorModel = IModel | IDiffEditorModel;
  1827. /**
  1828. * A (serializable) state of the cursors.
  1829. */
  1830. export interface ICursorState {
  1831. inSelectionMode: boolean;
  1832. selectionStart: IPosition;
  1833. position: IPosition;
  1834. }
  1835. /**
  1836. * A (serializable) state of the view.
  1837. */
  1838. export interface IViewState {
  1839. scrollTop: number;
  1840. scrollTopWithoutViewZones: number;
  1841. scrollLeft: number;
  1842. }
  1843. /**
  1844. * A (serializable) state of the code editor.
  1845. */
  1846. export interface ICodeEditorViewState {
  1847. cursorState: ICursorState[];
  1848. viewState: IViewState;
  1849. contributionsState: {
  1850. [id: string]: any;
  1851. };
  1852. }
  1853. /**
  1854. * (Serializable) View state for the diff editor.
  1855. */
  1856. export interface IDiffEditorViewState {
  1857. original: ICodeEditorViewState;
  1858. modified: ICodeEditorViewState;
  1859. }
  1860. /**
  1861. * An editor view state.
  1862. */
  1863. export type IEditorViewState = ICodeEditorViewState | IDiffEditorViewState;
  1864. /**
  1865. * An editor.
  1866. */
  1867. export interface IEditor {
  1868. /**
  1869. * An event emitted when the editor has been disposed.
  1870. * @event
  1871. */
  1872. onDidDispose(listener: () => void): IDisposable;
  1873. /**
  1874. * Dispose the editor.
  1875. */
  1876. dispose(): void;
  1877. /**
  1878. * Get a unique id for this editor instance.
  1879. */
  1880. getId(): string;
  1881. /**
  1882. * Get the editor type. Please see `EditorType`.
  1883. * This is to avoid an instanceof check
  1884. */
  1885. getEditorType(): string;
  1886. /**
  1887. * Update the editor's options after the editor has been created.
  1888. */
  1889. updateOptions(newOptions: IEditorOptions): void;
  1890. /**
  1891. * Instructs the editor to remeasure its container. This method should
  1892. * be called when the container of the editor gets resized.
  1893. */
  1894. layout(dimension?: IDimension): void;
  1895. /**
  1896. * Brings browser focus to the editor text
  1897. */
  1898. focus(): void;
  1899. /**
  1900. * Returns true if this editor has keyboard focus (e.g. cursor is blinking).
  1901. */
  1902. isFocused(): boolean;
  1903. /**
  1904. * Returns all actions associated with this editor.
  1905. */
  1906. getActions(): IEditorAction[];
  1907. /**
  1908. * Returns all actions associated with this editor.
  1909. */
  1910. getSupportedActions(): IEditorAction[];
  1911. /**
  1912. * Saves current view state of the editor in a serializable object.
  1913. */
  1914. saveViewState(): IEditorViewState;
  1915. /**
  1916. * Restores the view state of the editor from a serializable object generated by `saveViewState`.
  1917. */
  1918. restoreViewState(state: IEditorViewState): void;
  1919. /**
  1920. * Given a position, returns a column number that takes tab-widths into account.
  1921. */
  1922. getVisibleColumnFromPosition(position: IPosition): number;
  1923. /**
  1924. * Returns the primary position of the cursor.
  1925. */
  1926. getPosition(): Position;
  1927. /**
  1928. * Set the primary position of the cursor. This will remove any secondary cursors.
  1929. * @param position New primary cursor's position
  1930. */
  1931. setPosition(position: IPosition): void;
  1932. /**
  1933. * Scroll vertically as necessary and reveal a line.
  1934. */
  1935. revealLine(lineNumber: number): void;
  1936. /**
  1937. * Scroll vertically as necessary and reveal a line centered vertically.
  1938. */
  1939. revealLineInCenter(lineNumber: number): void;
  1940. /**
  1941. * Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport.
  1942. */
  1943. revealLineInCenterIfOutsideViewport(lineNumber: number): void;
  1944. /**
  1945. * Scroll vertically or horizontally as necessary and reveal a position.
  1946. */
  1947. revealPosition(position: IPosition, revealVerticalInCenter?: boolean, revealHorizontal?: boolean): void;
  1948. /**
  1949. * Scroll vertically or horizontally as necessary and reveal a position centered vertically.
  1950. */
  1951. revealPositionInCenter(position: IPosition): void;
  1952. /**
  1953. * Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport.
  1954. */
  1955. revealPositionInCenterIfOutsideViewport(position: IPosition): void;
  1956. /**
  1957. * Returns the primary selection of the editor.
  1958. */
  1959. getSelection(): Selection;
  1960. /**
  1961. * Returns all the selections of the editor.
  1962. */
  1963. getSelections(): Selection[];
  1964. /**
  1965. * Set the primary selection of the editor. This will remove any secondary cursors.
  1966. * @param selection The new selection
  1967. */
  1968. setSelection(selection: IRange): void;
  1969. /**
  1970. * Set the primary selection of the editor. This will remove any secondary cursors.
  1971. * @param selection The new selection
  1972. */
  1973. setSelection(selection: Range): void;
  1974. /**
  1975. * Set the primary selection of the editor. This will remove any secondary cursors.
  1976. * @param selection The new selection
  1977. */
  1978. setSelection(selection: ISelection): void;
  1979. /**
  1980. * Set the primary selection of the editor. This will remove any secondary cursors.
  1981. * @param selection The new selection
  1982. */
  1983. setSelection(selection: Selection): void;
  1984. /**
  1985. * Set the selections for all the cursors of the editor.
  1986. * Cursors will be removed or added, as necessary.
  1987. */
  1988. setSelections(selections: ISelection[]): void;
  1989. /**
  1990. * Scroll vertically as necessary and reveal lines.
  1991. */
  1992. revealLines(startLineNumber: number, endLineNumber: number): void;
  1993. /**
  1994. * Scroll vertically as necessary and reveal lines centered vertically.
  1995. */
  1996. revealLinesInCenter(lineNumber: number, endLineNumber: number): void;
  1997. /**
  1998. * Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport.
  1999. */
  2000. revealLinesInCenterIfOutsideViewport(lineNumber: number, endLineNumber: number): void;
  2001. /**
  2002. * Scroll vertically or horizontally as necessary and reveal a range.
  2003. */
  2004. revealRange(range: IRange): void;
  2005. /**
  2006. * Scroll vertically or horizontally as necessary and reveal a range centered vertically.
  2007. */
  2008. revealRangeInCenter(range: IRange): void;
  2009. /**
  2010. * Scroll vertically or horizontally as necessary and reveal a range at the top of the viewport.
  2011. */
  2012. revealRangeAtTop(range: IRange): void;
  2013. /**
  2014. * Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.
  2015. */
  2016. revealRangeInCenterIfOutsideViewport(range: IRange): void;
  2017. /**
  2018. * Directly trigger a handler or an editor action.
  2019. * @param source The source of the call.
  2020. * @param handlerId The id of the handler or the id of a contribution.
  2021. * @param payload Extra data to be sent to the handler.
  2022. */
  2023. trigger(source: string, handlerId: string, payload: any): void;
  2024. /**
  2025. * Gets the current model attached to this editor.
  2026. */
  2027. getModel(): IEditorModel;
  2028. /**
  2029. * Sets the current model attached to this editor.
  2030. * If the previous model was created by the editor via the value key in the options
  2031. * literal object, it will be destroyed. Otherwise, if the previous model was set
  2032. * via setModel, or the model key in the options literal object, the previous model
  2033. * will not be destroyed.
  2034. * It is safe to call setModel(null) to simply detach the current model from the editor.
  2035. */
  2036. setModel(model: IEditorModel): void;
  2037. }
  2038. /**
  2039. * An editor contribution that gets created every time a new editor gets created and gets disposed when the editor gets disposed.
  2040. */
  2041. export interface IEditorContribution {
  2042. /**
  2043. * Get a unique identifier for this contribution.
  2044. */
  2045. getId(): string;
  2046. /**
  2047. * Dispose this contribution.
  2048. */
  2049. dispose(): void;
  2050. /**
  2051. * Store view state.
  2052. */
  2053. saveViewState?(): any;
  2054. /**
  2055. * Restore view state.
  2056. */
  2057. restoreViewState?(state: any): void;
  2058. }
  2059. export interface ICommonCodeEditor extends IEditor {
  2060. /**
  2061. * An event emitted when the content of the current model has changed.
  2062. * @event
  2063. */
  2064. onDidChangeModelContent(listener: (e: IModelContentChangedEvent) => void): IDisposable;
  2065. /**
  2066. * An event emitted when the language of the current model has changed.
  2067. * @event
  2068. */
  2069. onDidChangeModelLanguage(listener: (e: IModelLanguageChangedEvent) => void): IDisposable;
  2070. /**
  2071. * An event emitted when the options of the current model has changed.
  2072. * @event
  2073. */
  2074. onDidChangeModelOptions(listener: (e: IModelOptionsChangedEvent) => void): IDisposable;
  2075. /**
  2076. * An event emitted when the configuration of the editor has changed. (e.g. `editor.updateOptions()`)
  2077. * @event
  2078. */
  2079. onDidChangeConfiguration(listener: (e: IConfigurationChangedEvent) => void): IDisposable;
  2080. /**
  2081. * An event emitted when the cursor position has changed.
  2082. * @event
  2083. */
  2084. onDidChangeCursorPosition(listener: (e: ICursorPositionChangedEvent) => void): IDisposable;
  2085. /**
  2086. * An event emitted when the cursor selection has changed.
  2087. * @event
  2088. */
  2089. onDidChangeCursorSelection(listener: (e: ICursorSelectionChangedEvent) => void): IDisposable;
  2090. /**
  2091. * An event emitted when the model of this editor has changed (e.g. `editor.setModel()`).
  2092. * @event
  2093. */
  2094. onDidChangeModel(listener: (e: IModelChangedEvent) => void): IDisposable;
  2095. /**
  2096. * An event emitted when the decorations of the current model have changed.
  2097. * @event
  2098. */
  2099. onDidChangeModelDecorations(listener: (e: IModelDecorationsChangedEvent) => void): IDisposable;
  2100. /**
  2101. * An event emitted when the text inside this editor gained focus (i.e. cursor blinking).
  2102. * @event
  2103. */
  2104. onDidFocusEditorText(listener: () => void): IDisposable;
  2105. /**
  2106. * An event emitted when the text inside this editor lost focus.
  2107. * @event
  2108. */
  2109. onDidBlurEditorText(listener: () => void): IDisposable;
  2110. /**
  2111. * An event emitted when the text inside this editor or an editor widget gained focus.
  2112. * @event
  2113. */
  2114. onDidFocusEditor(listener: () => void): IDisposable;
  2115. /**
  2116. * An event emitted when the text inside this editor or an editor widget lost focus.
  2117. * @event
  2118. */
  2119. onDidBlurEditor(listener: () => void): IDisposable;
  2120. /**
  2121. * Saves current view state of the editor in a serializable object.
  2122. */
  2123. saveViewState(): ICodeEditorViewState;
  2124. /**
  2125. * Restores the view state of the editor from a serializable object generated by `saveViewState`.
  2126. */
  2127. restoreViewState(state: ICodeEditorViewState): void;
  2128. /**
  2129. * Returns true if this editor or one of its widgets has keyboard focus.
  2130. */
  2131. hasWidgetFocus(): boolean;
  2132. /**
  2133. * Get a contribution of this editor.
  2134. * @id Unique identifier of the contribution.
  2135. * @return The contribution or null if contribution not found.
  2136. */
  2137. getContribution<T extends IEditorContribution>(id: string): T;
  2138. /**
  2139. * Type the getModel() of IEditor.
  2140. */
  2141. getModel(): IModel;
  2142. /**
  2143. * Returns the current editor's configuration
  2144. */
  2145. getConfiguration(): InternalEditorOptions;
  2146. /**
  2147. * Get value of the current model attached to this editor.
  2148. * @see IModel.getValue
  2149. */
  2150. getValue(options?: {
  2151. preserveBOM: boolean;
  2152. lineEnding: string;
  2153. }): string;
  2154. /**
  2155. * Set the value of the current model attached to this editor.
  2156. * @see IModel.setValue
  2157. */
  2158. setValue(newValue: string): void;
  2159. /**
  2160. * Get the scrollWidth of the editor's viewport.
  2161. */
  2162. getScrollWidth(): number;
  2163. /**
  2164. * Get the scrollLeft of the editor's viewport.
  2165. */
  2166. getScrollLeft(): number;
  2167. /**
  2168. * Get the scrollHeight of the editor's viewport.
  2169. */
  2170. getScrollHeight(): number;
  2171. /**
  2172. * Get the scrollTop of the editor's viewport.
  2173. */
  2174. getScrollTop(): number;
  2175. /**
  2176. * Change the scrollLeft of the editor's viewport.
  2177. */
  2178. setScrollLeft(newScrollLeft: number): void;
  2179. /**
  2180. * Change the scrollTop of the editor's viewport.
  2181. */
  2182. setScrollTop(newScrollTop: number): void;
  2183. /**
  2184. * Change the scroll position of the editor's viewport.
  2185. */
  2186. setScrollPosition(position: INewScrollPosition): void;
  2187. /**
  2188. * Get an action that is a contribution to this editor.
  2189. * @id Unique identifier of the contribution.
  2190. * @return The action or null if action not found.
  2191. */
  2192. getAction(id: string): IEditorAction;
  2193. /**
  2194. * Execute a command on the editor.
  2195. * The edits will land on the undo-redo stack, but no "undo stop" will be pushed.
  2196. * @param source The source of the call.
  2197. * @param command The command to execute
  2198. */
  2199. executeCommand(source: string, command: ICommand): void;
  2200. /**
  2201. * Push an "undo stop" in the undo-redo stack.
  2202. */
  2203. pushUndoStop(): boolean;
  2204. /**
  2205. * Execute edits on the editor.
  2206. * The edits will land on the undo-redo stack, but no "undo stop" will be pushed.
  2207. * @param source The source of the call.
  2208. * @param edits The edits to execute.
  2209. * @param endCursoState Cursor state after the edits were applied.
  2210. */
  2211. executeEdits(source: string, edits: IIdentifiedSingleEditOperation[], endCursoState?: Selection[]): boolean;
  2212. /**
  2213. * Execute multiple (concommitent) commands on the editor.
  2214. * @param source The source of the call.
  2215. * @param command The commands to execute
  2216. */
  2217. executeCommands(source: string, commands: ICommand[]): void;
  2218. /**
  2219. * Get all the decorations on a line (filtering out decorations from other editors).
  2220. */
  2221. getLineDecorations(lineNumber: number): IModelDecoration[];
  2222. /**
  2223. * All decorations added through this call will get the ownerId of this editor.
  2224. * @see IModel.deltaDecorations
  2225. */
  2226. deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[];
  2227. /**
  2228. * Get the layout info for the editor.
  2229. */
  2230. getLayoutInfo(): EditorLayoutInfo;
  2231. }
  2232. export interface ICommonDiffEditor extends IEditor {
  2233. /**
  2234. * An event emitted when the diff information computed by this diff editor has been updated.
  2235. * @event
  2236. */
  2237. onDidUpdateDiff(listener: () => void): IDisposable;
  2238. /**
  2239. * Saves current view state of the editor in a serializable object.
  2240. */
  2241. saveViewState(): IDiffEditorViewState;
  2242. /**
  2243. * Restores the view state of the editor from a serializable object generated by `saveViewState`.
  2244. */
  2245. restoreViewState(state: IDiffEditorViewState): void;
  2246. /**
  2247. * Type the getModel() of IEditor.
  2248. */
  2249. getModel(): IDiffEditorModel;
  2250. /**
  2251. * Get the `original` editor.
  2252. */
  2253. getOriginalEditor(): ICommonCodeEditor;
  2254. /**
  2255. * Get the `modified` editor.
  2256. */
  2257. getModifiedEditor(): ICommonCodeEditor;
  2258. /**
  2259. * Get the computed diff information.
  2260. */
  2261. getLineChanges(): ILineChange[];
  2262. /**
  2263. * Get information based on computed diff about a line number from the original model.
  2264. * If the diff computation is not finished or the model is missing, will return null.
  2265. */
  2266. getDiffLineInformationForOriginal(lineNumber: number): IDiffLineInformation;
  2267. /**
  2268. * Get information based on computed diff about a line number from the modified model.
  2269. * If the diff computation is not finished or the model is missing, will return null.
  2270. */
  2271. getDiffLineInformationForModified(lineNumber: number): IDiffLineInformation;
  2272. /**
  2273. * @see ICodeEditor.getValue
  2274. */
  2275. getValue(options?: {
  2276. preserveBOM: boolean;
  2277. lineEnding: string;
  2278. }): string;
  2279. }
  2280. /**
  2281. * The type of the `IEditor`.
  2282. */
  2283. export var EditorType: {
  2284. ICodeEditor: string;
  2285. IDiffEditor: string;
  2286. };
  2287. /**
  2288. * An event describing that the current mode associated with a model has changed.
  2289. */
  2290. export interface IModelLanguageChangedEvent {
  2291. /**
  2292. * Previous language
  2293. */
  2294. readonly oldLanguage: string;
  2295. /**
  2296. * New language
  2297. */
  2298. readonly newLanguage: string;
  2299. }
  2300. export interface IModelContentChange {
  2301. /**
  2302. * The range that got replaced.
  2303. */
  2304. readonly range: IRange;
  2305. /**
  2306. * The length of the range that got replaced.
  2307. */
  2308. readonly rangeLength: number;
  2309. /**
  2310. * The new text for the range.
  2311. */
  2312. readonly text: string;
  2313. }
  2314. /**
  2315. * An event describing a change in the text of a model.
  2316. */
  2317. export interface IModelContentChangedEvent {
  2318. readonly changes: IModelContentChange[];
  2319. /**
  2320. * The (new) end-of-line character.
  2321. */
  2322. readonly eol: string;
  2323. /**
  2324. * The new version id the model has transitioned to.
  2325. */
  2326. readonly versionId: number;
  2327. /**
  2328. * Flag that indicates that this event was generated while undoing.
  2329. */
  2330. readonly isUndoing: boolean;
  2331. /**
  2332. * Flag that indicates that this event was generated while redoing.
  2333. */
  2334. readonly isRedoing: boolean;
  2335. /**
  2336. * Flag that indicates that all decorations were lost with this edit.
  2337. * The model has been reset to a new value.
  2338. */
  2339. readonly isFlush: boolean;
  2340. }
  2341. /**
  2342. * An event describing that model decorations have changed.
  2343. */
  2344. export interface IModelDecorationsChangedEvent {
  2345. /**
  2346. * Lists of ids for added decorations.
  2347. */
  2348. readonly addedDecorations: string[];
  2349. /**
  2350. * Lists of ids for changed decorations.
  2351. */
  2352. readonly changedDecorations: string[];
  2353. /**
  2354. * List of ids for removed decorations.
  2355. */
  2356. readonly removedDecorations: string[];
  2357. }
  2358. /**
  2359. * An event describing that some ranges of lines have been tokenized (their tokens have changed).
  2360. */
  2361. export interface IModelTokensChangedEvent {
  2362. readonly ranges: {
  2363. /**
  2364. * The start of the range (inclusive)
  2365. */
  2366. readonly fromLineNumber: number;
  2367. /**
  2368. * The end of the range (inclusive)
  2369. */
  2370. readonly toLineNumber: number;
  2371. }[];
  2372. }
  2373. export interface IModelOptionsChangedEvent {
  2374. readonly tabSize: boolean;
  2375. readonly insertSpaces: boolean;
  2376. readonly trimAutoWhitespace: boolean;
  2377. }
  2378. /**
  2379. * Describes the reason the cursor has changed its position.
  2380. */
  2381. export enum CursorChangeReason {
  2382. /**
  2383. * Unknown or not set.
  2384. */
  2385. NotSet = 0,
  2386. /**
  2387. * A `model.setValue()` was called.
  2388. */
  2389. ContentFlush = 1,
  2390. /**
  2391. * The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers.
  2392. */
  2393. RecoverFromMarkers = 2,
  2394. /**
  2395. * There was an explicit user gesture.
  2396. */
  2397. Explicit = 3,
  2398. /**
  2399. * There was a Paste.
  2400. */
  2401. Paste = 4,
  2402. /**
  2403. * There was an Undo.
  2404. */
  2405. Undo = 5,
  2406. /**
  2407. * There was a Redo.
  2408. */
  2409. Redo = 6,
  2410. }
  2411. /**
  2412. * An event describing that the cursor position has changed.
  2413. */
  2414. export interface ICursorPositionChangedEvent {
  2415. /**
  2416. * Primary cursor's position.
  2417. */
  2418. readonly position: Position;
  2419. /**
  2420. * Secondary cursors' position.
  2421. */
  2422. readonly secondaryPositions: Position[];
  2423. /**
  2424. * Reason.
  2425. */
  2426. readonly reason: CursorChangeReason;
  2427. /**
  2428. * Source of the call that caused the event.
  2429. */
  2430. readonly source: string;
  2431. }
  2432. /**
  2433. * An event describing that the cursor selection has changed.
  2434. */
  2435. export interface ICursorSelectionChangedEvent {
  2436. /**
  2437. * The primary selection.
  2438. */
  2439. readonly selection: Selection;
  2440. /**
  2441. * The secondary selections.
  2442. */
  2443. readonly secondarySelections: Selection[];
  2444. /**
  2445. * Source of the call that caused the event.
  2446. */
  2447. readonly source: string;
  2448. /**
  2449. * Reason.
  2450. */
  2451. readonly reason: CursorChangeReason;
  2452. }
  2453. /**
  2454. * Configuration options for editor scrollbars
  2455. */
  2456. export interface IEditorScrollbarOptions {
  2457. /**
  2458. * The size of arrows (if displayed).
  2459. * Defaults to 11.
  2460. */
  2461. arrowSize?: number;
  2462. /**
  2463. * Render vertical scrollbar.
  2464. * Accepted values: 'auto', 'visible', 'hidden'.
  2465. * Defaults to 'auto'.
  2466. */
  2467. vertical?: string;
  2468. /**
  2469. * Render horizontal scrollbar.
  2470. * Accepted values: 'auto', 'visible', 'hidden'.
  2471. * Defaults to 'auto'.
  2472. */
  2473. horizontal?: string;
  2474. /**
  2475. * Cast horizontal and vertical shadows when the content is scrolled.
  2476. * Defaults to true.
  2477. */
  2478. useShadows?: boolean;
  2479. /**
  2480. * Render arrows at the top and bottom of the vertical scrollbar.
  2481. * Defaults to false.
  2482. */
  2483. verticalHasArrows?: boolean;
  2484. /**
  2485. * Render arrows at the left and right of the horizontal scrollbar.
  2486. * Defaults to false.
  2487. */
  2488. horizontalHasArrows?: boolean;
  2489. /**
  2490. * Listen to mouse wheel events and react to them by scrolling.
  2491. * Defaults to true.
  2492. */
  2493. handleMouseWheel?: boolean;
  2494. /**
  2495. * Height in pixels for the horizontal scrollbar.
  2496. * Defaults to 10 (px).
  2497. */
  2498. horizontalScrollbarSize?: number;
  2499. /**
  2500. * Width in pixels for the vertical scrollbar.
  2501. * Defaults to 10 (px).
  2502. */
  2503. verticalScrollbarSize?: number;
  2504. /**
  2505. * Width in pixels for the vertical slider.
  2506. * Defaults to `verticalScrollbarSize`.
  2507. */
  2508. verticalSliderSize?: number;
  2509. /**
  2510. * Height in pixels for the horizontal slider.
  2511. * Defaults to `horizontalScrollbarSize`.
  2512. */
  2513. horizontalSliderSize?: number;
  2514. }
  2515. /**
  2516. * Configuration options for editor find widget
  2517. */
  2518. export interface IEditorFindOptions {
  2519. /**
  2520. * Controls if we seed search string in the Find Widget with editor selection.
  2521. */
  2522. seedSearchStringFromSelection?: boolean;
  2523. /**
  2524. * Controls if Find in Selection flag is turned on when multiple lines of text are selected in the editor.
  2525. */
  2526. autoFindInSelection: boolean;
  2527. }
  2528. /**
  2529. * Configuration options for editor minimap
  2530. */
  2531. export interface IEditorMinimapOptions {
  2532. /**
  2533. * Enable the rendering of the minimap.
  2534. * Defaults to false.
  2535. */
  2536. enabled?: boolean;
  2537. /**
  2538. * Control the rendering of the minimap slider.
  2539. * Defaults to 'mouseover'.
  2540. */
  2541. showSlider?: 'always' | 'mouseover';
  2542. /**
  2543. * Render the actual text on a line (as opposed to color blocks).
  2544. * Defaults to true.
  2545. */
  2546. renderCharacters?: boolean;
  2547. /**
  2548. * Limit the width of the minimap to render at most a certain number of columns.
  2549. * Defaults to 120.
  2550. */
  2551. maxColumn?: number;
  2552. }
  2553. /**
  2554. * Configuration options for the editor.
  2555. */
  2556. export interface IEditorOptions {
  2557. /**
  2558. * The aria label for the editor's textarea (when it is focused).
  2559. */
  2560. ariaLabel?: string;
  2561. /**
  2562. * Render vertical lines at the specified columns.
  2563. * Defaults to empty array.
  2564. */
  2565. rulers?: number[];
  2566. /**
  2567. * A string containing the word separators used when doing word navigation.
  2568. * Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?
  2569. */
  2570. wordSeparators?: string;
  2571. /**
  2572. * Enable Linux primary clipboard.
  2573. * Defaults to true.
  2574. */
  2575. selectionClipboard?: boolean;
  2576. /**
  2577. * Control the rendering of line numbers.
  2578. * If it is a function, it will be invoked when rendering a line number and the return value will be rendered.
  2579. * Otherwise, if it is a truey, line numbers will be rendered normally (equivalent of using an identity function).
  2580. * Otherwise, line numbers will not be rendered.
  2581. * Defaults to true.
  2582. */
  2583. lineNumbers?: 'on' | 'off' | 'relative' | ((lineNumber: number) => string);
  2584. /**
  2585. * Should the corresponding line be selected when clicking on the line number?
  2586. * Defaults to true.
  2587. */
  2588. selectOnLineNumbers?: boolean;
  2589. /**
  2590. * Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits.
  2591. * Defaults to 5.
  2592. */
  2593. lineNumbersMinChars?: number;
  2594. /**
  2595. * Enable the rendering of the glyph margin.
  2596. * Defaults to true in vscode and to false in monaco-editor.
  2597. */
  2598. glyphMargin?: boolean;
  2599. /**
  2600. * The width reserved for line decorations (in px).
  2601. * Line decorations are placed between line numbers and the editor content.
  2602. * You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch.
  2603. * Defaults to 10.
  2604. */
  2605. lineDecorationsWidth?: number | string;
  2606. /**
  2607. * When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle.
  2608. * This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport.
  2609. * Defaults to 30 (px).
  2610. */
  2611. revealHorizontalRightPadding?: number;
  2612. /**
  2613. * Render the editor selection with rounded borders.
  2614. * Defaults to true.
  2615. */
  2616. roundedSelection?: boolean;
  2617. /**
  2618. * Class name to be added to the editor.
  2619. */
  2620. extraEditorClassName?: string;
  2621. /**
  2622. * Should the editor be read only.
  2623. * Defaults to false.
  2624. */
  2625. readOnly?: boolean;
  2626. /**
  2627. * Control the behavior and rendering of the scrollbars.
  2628. */
  2629. scrollbar?: IEditorScrollbarOptions;
  2630. /**
  2631. * Control the behavior and rendering of the minimap.
  2632. */
  2633. minimap?: IEditorMinimapOptions;
  2634. /**
  2635. * Control the behavior of the find widget.
  2636. */
  2637. find?: IEditorFindOptions;
  2638. /**
  2639. * Display overflow widgets as `fixed`.
  2640. * Defaults to `false`.
  2641. */
  2642. fixedOverflowWidgets?: boolean;
  2643. /**
  2644. * The number of vertical lanes the overview ruler should render.
  2645. * Defaults to 2.
  2646. */
  2647. overviewRulerLanes?: number;
  2648. /**
  2649. * Controls if a border should be drawn around the overview ruler.
  2650. * Defaults to `true`.
  2651. */
  2652. overviewRulerBorder?: boolean;
  2653. /**
  2654. * Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'.
  2655. * Defaults to 'blink'.
  2656. */
  2657. cursorBlinking?: string;
  2658. /**
  2659. * Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl.
  2660. * Defaults to false.
  2661. */
  2662. mouseWheelZoom?: boolean;
  2663. /**
  2664. * Control the cursor style, either 'block' or 'line'.
  2665. * Defaults to 'line'.
  2666. */
  2667. cursorStyle?: string;
  2668. /**
  2669. * Enable font ligatures.
  2670. * Defaults to false.
  2671. */
  2672. fontLigatures?: boolean;
  2673. /**
  2674. * Disable the use of `will-change` for the editor margin and lines layers.
  2675. * The usage of `will-change` acts as a hint for browsers to create an extra layer.
  2676. * Defaults to false.
  2677. */
  2678. disableLayerHinting?: boolean;
  2679. /**
  2680. * Disable the optimizations for monospace fonts.
  2681. * Defaults to false.
  2682. */
  2683. disableMonospaceOptimizations?: boolean;
  2684. /**
  2685. * Should the cursor be hidden in the overview ruler.
  2686. * Defaults to false.
  2687. */
  2688. hideCursorInOverviewRuler?: boolean;
  2689. /**
  2690. * Enable that scrolling can go one screen size after the last line.
  2691. * Defaults to true.
  2692. */
  2693. scrollBeyondLastLine?: boolean;
  2694. /**
  2695. * Enable that the editor will install an interval to check if its container dom node size has changed.
  2696. * Enabling this might have a severe performance impact.
  2697. * Defaults to false.
  2698. */
  2699. automaticLayout?: boolean;
  2700. /**
  2701. * Control the wrapping of the editor.
  2702. * When `wordWrap` = "off", the lines will never wrap.
  2703. * When `wordWrap` = "on", the lines will wrap at the viewport width.
  2704. * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
  2705. * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
  2706. * Defaults to "off".
  2707. */
  2708. wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded';
  2709. /**
  2710. * Control the wrapping of the editor.
  2711. * When `wordWrap` = "off", the lines will never wrap.
  2712. * When `wordWrap` = "on", the lines will wrap at the viewport width.
  2713. * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
  2714. * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
  2715. * Defaults to 80.
  2716. */
  2717. wordWrapColumn?: number;
  2718. /**
  2719. * Force word wrapping when the text appears to be of a minified/generated file.
  2720. * Defaults to true.
  2721. */
  2722. wordWrapMinified?: boolean;
  2723. /**
  2724. * Control indentation of wrapped lines. Can be: 'none', 'same' or 'indent'.
  2725. * Defaults to 'same' in vscode and to 'none' in monaco-editor.
  2726. */
  2727. wrappingIndent?: string;
  2728. /**
  2729. * Configure word wrapping characters. A break will be introduced before these characters.
  2730. * Defaults to '{([+'.
  2731. */
  2732. wordWrapBreakBeforeCharacters?: string;
  2733. /**
  2734. * Configure word wrapping characters. A break will be introduced after these characters.
  2735. * Defaults to ' \t})]?|&,;'.
  2736. */
  2737. wordWrapBreakAfterCharacters?: string;
  2738. /**
  2739. * Configure word wrapping characters. A break will be introduced after these characters only if no `wordWrapBreakBeforeCharacters` or `wordWrapBreakAfterCharacters` were found.
  2740. * Defaults to '.'.
  2741. */
  2742. wordWrapBreakObtrusiveCharacters?: string;
  2743. /**
  2744. * Performance guard: Stop rendering a line after x characters.
  2745. * Defaults to 10000.
  2746. * Use -1 to never stop rendering
  2747. */
  2748. stopRenderingLineAfter?: number;
  2749. /**
  2750. * Enable hover.
  2751. * Defaults to true.
  2752. */
  2753. hover?: boolean;
  2754. /**
  2755. * Enable detecting links and making them clickable.
  2756. * Defaults to true.
  2757. */
  2758. links?: boolean;
  2759. /**
  2760. * Enable custom contextmenu.
  2761. * Defaults to true.
  2762. */
  2763. contextmenu?: boolean;
  2764. /**
  2765. * A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.
  2766. * Defaults to 1.
  2767. */
  2768. mouseWheelScrollSensitivity?: number;
  2769. /**
  2770. * The modifier to be used to add multiple cursors with the mouse.
  2771. * Defaults to 'alt'
  2772. */
  2773. multiCursorModifier?: 'ctrlCmd' | 'alt';
  2774. /**
  2775. * Configure the editor's accessibility support.
  2776. * Defaults to 'auto'. It is best to leave this to 'auto'.
  2777. */
  2778. accessibilitySupport?: 'auto' | 'off' | 'on';
  2779. /**
  2780. * Enable quick suggestions (shadow suggestions)
  2781. * Defaults to true.
  2782. */
  2783. quickSuggestions?: boolean | {
  2784. other: boolean;
  2785. comments: boolean;
  2786. strings: boolean;
  2787. };
  2788. /**
  2789. * Quick suggestions show delay (in ms)
  2790. * Defaults to 500 (ms)
  2791. */
  2792. quickSuggestionsDelay?: number;
  2793. /**
  2794. * Enables parameter hints
  2795. */
  2796. parameterHints?: boolean;
  2797. /**
  2798. * Render icons in suggestions box.
  2799. * Defaults to true.
  2800. */
  2801. iconsInSuggestions?: boolean;
  2802. /**
  2803. * Enable auto closing brackets.
  2804. * Defaults to true.
  2805. */
  2806. autoClosingBrackets?: boolean;
  2807. /**
  2808. * Enable auto indentation adjustment.
  2809. * Defaults to false.
  2810. */
  2811. autoIndent?: boolean;
  2812. /**
  2813. * Enable format on type.
  2814. * Defaults to false.
  2815. */
  2816. formatOnType?: boolean;
  2817. /**
  2818. * Enable format on paste.
  2819. * Defaults to false.
  2820. */
  2821. formatOnPaste?: boolean;
  2822. /**
  2823. * Controls if the editor should allow to move selections via drag and drop.
  2824. * Defaults to false.
  2825. */
  2826. dragAndDrop?: boolean;
  2827. /**
  2828. * Enable the suggestion box to pop-up on trigger characters.
  2829. * Defaults to true.
  2830. */
  2831. suggestOnTriggerCharacters?: boolean;
  2832. /**
  2833. * Accept suggestions on ENTER.
  2834. * Defaults to 'on'.
  2835. */
  2836. acceptSuggestionOnEnter?: 'on' | 'smart' | 'off';
  2837. /**
  2838. * Accept suggestions on provider defined characters.
  2839. * Defaults to true.
  2840. */
  2841. acceptSuggestionOnCommitCharacter?: boolean;
  2842. /**
  2843. * Enable snippet suggestions. Default to 'true'.
  2844. */
  2845. snippetSuggestions?: 'top' | 'bottom' | 'inline' | 'none';
  2846. /**
  2847. * Copying without a selection copies the current line.
  2848. */
  2849. emptySelectionClipboard?: boolean;
  2850. /**
  2851. * Enable word based suggestions. Defaults to 'true'
  2852. */
  2853. wordBasedSuggestions?: boolean;
  2854. /**
  2855. * The font size for the suggest widget.
  2856. * Defaults to the editor font size.
  2857. */
  2858. suggestFontSize?: number;
  2859. /**
  2860. * The line height for the suggest widget.
  2861. * Defaults to the editor line height.
  2862. */
  2863. suggestLineHeight?: number;
  2864. /**
  2865. * Enable selection highlight.
  2866. * Defaults to true.
  2867. */
  2868. selectionHighlight?: boolean;
  2869. /**
  2870. * Enable semantic occurrences highlight.
  2871. * Defaults to true.
  2872. */
  2873. occurrencesHighlight?: boolean;
  2874. /**
  2875. * Show code lens
  2876. * Defaults to true.
  2877. */
  2878. codeLens?: boolean;
  2879. /**
  2880. * Enable code folding
  2881. * Defaults to true in vscode and to false in monaco-editor.
  2882. */
  2883. folding?: boolean;
  2884. /**
  2885. * Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter.
  2886. * Defaults to 'mouseover'.
  2887. */
  2888. showFoldingControls?: 'always' | 'mouseover';
  2889. /**
  2890. * Enable highlighting of matching brackets.
  2891. * Defaults to true.
  2892. */
  2893. matchBrackets?: boolean;
  2894. /**
  2895. * Enable rendering of whitespace.
  2896. * Defaults to none.
  2897. */
  2898. renderWhitespace?: 'none' | 'boundary' | 'all';
  2899. /**
  2900. * Enable rendering of control characters.
  2901. * Defaults to false.
  2902. */
  2903. renderControlCharacters?: boolean;
  2904. /**
  2905. * Enable rendering of indent guides.
  2906. * Defaults to false.
  2907. */
  2908. renderIndentGuides?: boolean;
  2909. /**
  2910. * Enable rendering of current line highlight.
  2911. * Defaults to all.
  2912. */
  2913. renderLineHighlight?: 'none' | 'gutter' | 'line' | 'all';
  2914. /**
  2915. * Inserting and deleting whitespace follows tab stops.
  2916. */
  2917. useTabStops?: boolean;
  2918. /**
  2919. * The font family
  2920. */
  2921. fontFamily?: string;
  2922. /**
  2923. * The font weight
  2924. */
  2925. fontWeight?: 'normal' | 'bold' | 'bolder' | 'lighter' | 'initial' | 'inherit' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
  2926. /**
  2927. * The font size
  2928. */
  2929. fontSize?: number;
  2930. /**
  2931. * The line height
  2932. */
  2933. lineHeight?: number;
  2934. /**
  2935. * The letter spacing
  2936. */
  2937. letterSpacing?: number;
  2938. }
  2939. /**
  2940. * Configuration options for the diff editor.
  2941. */
  2942. export interface IDiffEditorOptions extends IEditorOptions {
  2943. /**
  2944. * Allow the user to resize the diff editor split view.
  2945. * Defaults to true.
  2946. */
  2947. enableSplitViewResizing?: boolean;
  2948. /**
  2949. * Render the differences in two side-by-side editors.
  2950. * Defaults to true.
  2951. */
  2952. renderSideBySide?: boolean;
  2953. /**
  2954. * Compute the diff by ignoring leading/trailing whitespace
  2955. * Defaults to true.
  2956. */
  2957. ignoreTrimWhitespace?: boolean;
  2958. /**
  2959. * Render +/- indicators for added/deleted changes.
  2960. * Defaults to true.
  2961. */
  2962. renderIndicators?: boolean;
  2963. /**
  2964. * Original model should be editable?
  2965. * Defaults to false.
  2966. */
  2967. originalEditable?: boolean;
  2968. }
  2969. export enum RenderMinimap {
  2970. None = 0,
  2971. Small = 1,
  2972. Large = 2,
  2973. SmallBlocks = 3,
  2974. LargeBlocks = 4,
  2975. }
  2976. /**
  2977. * Describes how to indent wrapped lines.
  2978. */
  2979. export enum WrappingIndent {
  2980. /**
  2981. * No indentation => wrapped lines begin at column 1.
  2982. */
  2983. None = 0,
  2984. /**
  2985. * Same => wrapped lines get the same indentation as the parent.
  2986. */
  2987. Same = 1,
  2988. /**
  2989. * Indent => wrapped lines get +1 indentation as the parent.
  2990. */
  2991. Indent = 2,
  2992. }
  2993. /**
  2994. * The kind of animation in which the editor's cursor should be rendered.
  2995. */
  2996. export enum TextEditorCursorBlinkingStyle {
  2997. /**
  2998. * Hidden
  2999. */
  3000. Hidden = 0,
  3001. /**
  3002. * Blinking
  3003. */
  3004. Blink = 1,
  3005. /**
  3006. * Blinking with smooth fading
  3007. */
  3008. Smooth = 2,
  3009. /**
  3010. * Blinking with prolonged filled state and smooth fading
  3011. */
  3012. Phase = 3,
  3013. /**
  3014. * Expand collapse animation on the y axis
  3015. */
  3016. Expand = 4,
  3017. /**
  3018. * No-Blinking
  3019. */
  3020. Solid = 5,
  3021. }
  3022. /**
  3023. * The style in which the editor's cursor should be rendered.
  3024. */
  3025. export enum TextEditorCursorStyle {
  3026. /**
  3027. * As a vertical line (sitting between two characters).
  3028. */
  3029. Line = 1,
  3030. /**
  3031. * As a block (sitting on top of a character).
  3032. */
  3033. Block = 2,
  3034. /**
  3035. * As a horizontal line (sitting under a character).
  3036. */
  3037. Underline = 3,
  3038. /**
  3039. * As a thin vertical line (sitting between two characters).
  3040. */
  3041. LineThin = 4,
  3042. /**
  3043. * As an outlined block (sitting on top of a character).
  3044. */
  3045. BlockOutline = 5,
  3046. /**
  3047. * As a thin horizontal line (sitting under a character).
  3048. */
  3049. UnderlineThin = 6,
  3050. }
  3051. export interface InternalEditorScrollbarOptions {
  3052. readonly arrowSize: number;
  3053. readonly vertical: ScrollbarVisibility;
  3054. readonly horizontal: ScrollbarVisibility;
  3055. readonly useShadows: boolean;
  3056. readonly verticalHasArrows: boolean;
  3057. readonly horizontalHasArrows: boolean;
  3058. readonly handleMouseWheel: boolean;
  3059. readonly horizontalScrollbarSize: number;
  3060. readonly horizontalSliderSize: number;
  3061. readonly verticalScrollbarSize: number;
  3062. readonly verticalSliderSize: number;
  3063. readonly mouseWheelScrollSensitivity: number;
  3064. }
  3065. export interface InternalEditorMinimapOptions {
  3066. readonly enabled: boolean;
  3067. readonly showSlider: 'always' | 'mouseover';
  3068. readonly renderCharacters: boolean;
  3069. readonly maxColumn: number;
  3070. }
  3071. export interface InternalEditorFindOptions {
  3072. readonly seedSearchStringFromSelection: boolean;
  3073. readonly autoFindInSelection: boolean;
  3074. }
  3075. export interface EditorWrappingInfo {
  3076. readonly inDiffEditor: boolean;
  3077. readonly isDominatedByLongLines: boolean;
  3078. readonly isWordWrapMinified: boolean;
  3079. readonly isViewportWrapping: boolean;
  3080. readonly wrappingColumn: number;
  3081. readonly wrappingIndent: WrappingIndent;
  3082. readonly wordWrapBreakBeforeCharacters: string;
  3083. readonly wordWrapBreakAfterCharacters: string;
  3084. readonly wordWrapBreakObtrusiveCharacters: string;
  3085. }
  3086. export interface InternalEditorViewOptions {
  3087. readonly extraEditorClassName: string;
  3088. readonly disableMonospaceOptimizations: boolean;
  3089. readonly rulers: number[];
  3090. readonly ariaLabel: string;
  3091. readonly renderLineNumbers: boolean;
  3092. readonly renderCustomLineNumbers: (lineNumber: number) => string;
  3093. readonly renderRelativeLineNumbers: boolean;
  3094. readonly selectOnLineNumbers: boolean;
  3095. readonly glyphMargin: boolean;
  3096. readonly revealHorizontalRightPadding: number;
  3097. readonly roundedSelection: boolean;
  3098. readonly overviewRulerLanes: number;
  3099. readonly overviewRulerBorder: boolean;
  3100. readonly cursorBlinking: TextEditorCursorBlinkingStyle;
  3101. readonly mouseWheelZoom: boolean;
  3102. readonly cursorStyle: TextEditorCursorStyle;
  3103. readonly hideCursorInOverviewRuler: boolean;
  3104. readonly scrollBeyondLastLine: boolean;
  3105. readonly stopRenderingLineAfter: number;
  3106. readonly renderWhitespace: 'none' | 'boundary' | 'all';
  3107. readonly renderControlCharacters: boolean;
  3108. readonly fontLigatures: boolean;
  3109. readonly renderIndentGuides: boolean;
  3110. readonly renderLineHighlight: 'none' | 'gutter' | 'line' | 'all';
  3111. readonly scrollbar: InternalEditorScrollbarOptions;
  3112. readonly minimap: InternalEditorMinimapOptions;
  3113. readonly fixedOverflowWidgets: boolean;
  3114. }
  3115. export interface EditorContribOptions {
  3116. readonly selectionClipboard: boolean;
  3117. readonly hover: boolean;
  3118. readonly links: boolean;
  3119. readonly contextmenu: boolean;
  3120. readonly quickSuggestions: boolean | {
  3121. other: boolean;
  3122. comments: boolean;
  3123. strings: boolean;
  3124. };
  3125. readonly quickSuggestionsDelay: number;
  3126. readonly parameterHints: boolean;
  3127. readonly iconsInSuggestions: boolean;
  3128. readonly formatOnType: boolean;
  3129. readonly formatOnPaste: boolean;
  3130. readonly suggestOnTriggerCharacters: boolean;
  3131. readonly acceptSuggestionOnEnter: 'on' | 'smart' | 'off';
  3132. readonly acceptSuggestionOnCommitCharacter: boolean;
  3133. readonly snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none';
  3134. readonly wordBasedSuggestions: boolean;
  3135. readonly suggestFontSize: number;
  3136. readonly suggestLineHeight: number;
  3137. readonly selectionHighlight: boolean;
  3138. readonly occurrencesHighlight: boolean;
  3139. readonly codeLens: boolean;
  3140. readonly folding: boolean;
  3141. readonly showFoldingControls: 'always' | 'mouseover';
  3142. readonly matchBrackets: boolean;
  3143. readonly find: InternalEditorFindOptions;
  3144. }
  3145. /**
  3146. * Internal configuration options (transformed or computed) for the editor.
  3147. */
  3148. export class InternalEditorOptions {
  3149. readonly _internalEditorOptionsBrand: void;
  3150. readonly canUseLayerHinting: boolean;
  3151. readonly pixelRatio: number;
  3152. readonly editorClassName: string;
  3153. readonly lineHeight: number;
  3154. readonly readOnly: boolean;
  3155. readonly multiCursorModifier: 'altKey' | 'ctrlKey' | 'metaKey';
  3156. readonly wordSeparators: string;
  3157. readonly autoClosingBrackets: boolean;
  3158. readonly autoIndent: boolean;
  3159. readonly useTabStops: boolean;
  3160. readonly tabFocusMode: boolean;
  3161. readonly dragAndDrop: boolean;
  3162. readonly emptySelectionClipboard: boolean;
  3163. readonly layoutInfo: EditorLayoutInfo;
  3164. readonly fontInfo: FontInfo;
  3165. readonly viewInfo: InternalEditorViewOptions;
  3166. readonly wrappingInfo: EditorWrappingInfo;
  3167. readonly contribInfo: EditorContribOptions;
  3168. }
  3169. /**
  3170. * A description for the overview ruler position.
  3171. */
  3172. export interface OverviewRulerPosition {
  3173. /**
  3174. * Width of the overview ruler
  3175. */
  3176. readonly width: number;
  3177. /**
  3178. * Height of the overview ruler
  3179. */
  3180. readonly height: number;
  3181. /**
  3182. * Top position for the overview ruler
  3183. */
  3184. readonly top: number;
  3185. /**
  3186. * Right position for the overview ruler
  3187. */
  3188. readonly right: number;
  3189. }
  3190. /**
  3191. * The internal layout details of the editor.
  3192. */
  3193. export interface EditorLayoutInfo {
  3194. /**
  3195. * Full editor width.
  3196. */
  3197. readonly width: number;
  3198. /**
  3199. * Full editor height.
  3200. */
  3201. readonly height: number;
  3202. /**
  3203. * Left position for the glyph margin.
  3204. */
  3205. readonly glyphMarginLeft: number;
  3206. /**
  3207. * The width of the glyph margin.
  3208. */
  3209. readonly glyphMarginWidth: number;
  3210. /**
  3211. * The height of the glyph margin.
  3212. */
  3213. readonly glyphMarginHeight: number;
  3214. /**
  3215. * Left position for the line numbers.
  3216. */
  3217. readonly lineNumbersLeft: number;
  3218. /**
  3219. * The width of the line numbers.
  3220. */
  3221. readonly lineNumbersWidth: number;
  3222. /**
  3223. * The height of the line numbers.
  3224. */
  3225. readonly lineNumbersHeight: number;
  3226. /**
  3227. * Left position for the line decorations.
  3228. */
  3229. readonly decorationsLeft: number;
  3230. /**
  3231. * The width of the line decorations.
  3232. */
  3233. readonly decorationsWidth: number;
  3234. /**
  3235. * The height of the line decorations.
  3236. */
  3237. readonly decorationsHeight: number;
  3238. /**
  3239. * Left position for the content (actual text)
  3240. */
  3241. readonly contentLeft: number;
  3242. /**
  3243. * The width of the content (actual text)
  3244. */
  3245. readonly contentWidth: number;
  3246. /**
  3247. * The height of the content (actual height)
  3248. */
  3249. readonly contentHeight: number;
  3250. /**
  3251. * The width of the minimap
  3252. */
  3253. readonly minimapWidth: number;
  3254. /**
  3255. * Minimap render type
  3256. */
  3257. readonly renderMinimap: RenderMinimap;
  3258. /**
  3259. * The number of columns (of typical characters) fitting on a viewport line.
  3260. */
  3261. readonly viewportColumn: number;
  3262. /**
  3263. * The width of the vertical scrollbar.
  3264. */
  3265. readonly verticalScrollbarWidth: number;
  3266. /**
  3267. * The height of the horizontal scrollbar.
  3268. */
  3269. readonly horizontalScrollbarHeight: number;
  3270. /**
  3271. * The position of the overview ruler.
  3272. */
  3273. readonly overviewRuler: OverviewRulerPosition;
  3274. }
  3275. /**
  3276. * An event describing that the configuration of the editor has changed.
  3277. */
  3278. export interface IConfigurationChangedEvent {
  3279. readonly canUseLayerHinting: boolean;
  3280. readonly pixelRatio: boolean;
  3281. readonly editorClassName: boolean;
  3282. readonly lineHeight: boolean;
  3283. readonly readOnly: boolean;
  3284. readonly accessibilitySupport: boolean;
  3285. readonly multiCursorModifier: boolean;
  3286. readonly wordSeparators: boolean;
  3287. readonly autoClosingBrackets: boolean;
  3288. readonly autoIndent: boolean;
  3289. readonly useTabStops: boolean;
  3290. readonly tabFocusMode: boolean;
  3291. readonly dragAndDrop: boolean;
  3292. readonly emptySelectionClipboard: boolean;
  3293. readonly layoutInfo: boolean;
  3294. readonly fontInfo: boolean;
  3295. readonly viewInfo: boolean;
  3296. readonly wrappingInfo: boolean;
  3297. readonly contribInfo: boolean;
  3298. }
  3299. /**
  3300. * A view zone is a full horizontal rectangle that 'pushes' text down.
  3301. * The editor reserves space for view zones when rendering.
  3302. */
  3303. export interface IViewZone {
  3304. /**
  3305. * The line number after which this zone should appear.
  3306. * Use 0 to place a view zone before the first line number.
  3307. */
  3308. afterLineNumber: number;
  3309. /**
  3310. * The column after which this zone should appear.
  3311. * If not set, the maxLineColumn of `afterLineNumber` will be used.
  3312. */
  3313. afterColumn?: number;
  3314. /**
  3315. * Suppress mouse down events.
  3316. * If set, the editor will attach a mouse down listener to the view zone and .preventDefault on it.
  3317. * Defaults to false
  3318. */
  3319. suppressMouseDown?: boolean;
  3320. /**
  3321. * The height in lines of the view zone.
  3322. * If specified, `heightInPx` will be used instead of this.
  3323. * If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen.
  3324. */
  3325. heightInLines?: number;
  3326. /**
  3327. * The height in px of the view zone.
  3328. * If this is set, the editor will give preference to it rather than `heightInLines` above.
  3329. * If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen.
  3330. */
  3331. heightInPx?: number;
  3332. /**
  3333. * The dom node of the view zone
  3334. */
  3335. domNode: HTMLElement;
  3336. /**
  3337. * An optional dom node for the view zone that will be placed in the margin area.
  3338. */
  3339. marginDomNode?: HTMLElement;
  3340. /**
  3341. * Callback which gives the relative top of the view zone as it appears (taking scrolling into account).
  3342. */
  3343. onDomNodeTop?: (top: number) => void;
  3344. /**
  3345. * Callback which gives the height in pixels of the view zone.
  3346. */
  3347. onComputedHeight?: (height: number) => void;
  3348. }
  3349. /**
  3350. * An accessor that allows for zones to be added or removed.
  3351. */
  3352. export interface IViewZoneChangeAccessor {
  3353. /**
  3354. * Create a new view zone.
  3355. * @param zone Zone to create
  3356. * @return A unique identifier to the view zone.
  3357. */
  3358. addZone(zone: IViewZone): number;
  3359. /**
  3360. * Remove a zone
  3361. * @param id A unique identifier to the view zone, as returned by the `addZone` call.
  3362. */
  3363. removeZone(id: number): void;
  3364. /**
  3365. * Change a zone's position.
  3366. * The editor will rescan the `afterLineNumber` and `afterColumn` properties of a view zone.
  3367. */
  3368. layoutZone(id: number): void;
  3369. }
  3370. /**
  3371. * A positioning preference for rendering content widgets.
  3372. */
  3373. export enum ContentWidgetPositionPreference {
  3374. /**
  3375. * Place the content widget exactly at a position
  3376. */
  3377. EXACT = 0,
  3378. /**
  3379. * Place the content widget above a position
  3380. */
  3381. ABOVE = 1,
  3382. /**
  3383. * Place the content widget below a position
  3384. */
  3385. BELOW = 2,
  3386. }
  3387. /**
  3388. * A position for rendering content widgets.
  3389. */
  3390. export interface IContentWidgetPosition {
  3391. /**
  3392. * Desired position for the content widget.
  3393. * `preference` will also affect the placement.
  3394. */
  3395. position: IPosition;
  3396. /**
  3397. * Placement preference for position, in order of preference.
  3398. */
  3399. preference: ContentWidgetPositionPreference[];
  3400. }
  3401. /**
  3402. * A content widget renders inline with the text and can be easily placed 'near' an editor position.
  3403. */
  3404. export interface IContentWidget {
  3405. /**
  3406. * Render this content widget in a location where it could overflow the editor's view dom node.
  3407. */
  3408. allowEditorOverflow?: boolean;
  3409. suppressMouseDown?: boolean;
  3410. /**
  3411. * Get a unique identifier of the content widget.
  3412. */
  3413. getId(): string;
  3414. /**
  3415. * Get the dom node of the content widget.
  3416. */
  3417. getDomNode(): HTMLElement;
  3418. /**
  3419. * Get the placement of the content widget.
  3420. * If null is returned, the content widget will be placed off screen.
  3421. */
  3422. getPosition(): IContentWidgetPosition;
  3423. }
  3424. /**
  3425. * A positioning preference for rendering overlay widgets.
  3426. */
  3427. export enum OverlayWidgetPositionPreference {
  3428. /**
  3429. * Position the overlay widget in the top right corner
  3430. */
  3431. TOP_RIGHT_CORNER = 0,
  3432. /**
  3433. * Position the overlay widget in the bottom right corner
  3434. */
  3435. BOTTOM_RIGHT_CORNER = 1,
  3436. /**
  3437. * Position the overlay widget in the top center
  3438. */
  3439. TOP_CENTER = 2,
  3440. }
  3441. /**
  3442. * A position for rendering overlay widgets.
  3443. */
  3444. export interface IOverlayWidgetPosition {
  3445. /**
  3446. * The position preference for the overlay widget.
  3447. */
  3448. preference: OverlayWidgetPositionPreference;
  3449. }
  3450. /**
  3451. * An overlay widgets renders on top of the text.
  3452. */
  3453. export interface IOverlayWidget {
  3454. /**
  3455. * Get a unique identifier of the overlay widget.
  3456. */
  3457. getId(): string;
  3458. /**
  3459. * Get the dom node of the overlay widget.
  3460. */
  3461. getDomNode(): HTMLElement;
  3462. /**
  3463. * Get the placement of the overlay widget.
  3464. * If null is returned, the overlay widget is responsible to place itself.
  3465. */
  3466. getPosition(): IOverlayWidgetPosition;
  3467. }
  3468. /**
  3469. * Type of hit element with the mouse in the editor.
  3470. */
  3471. export enum MouseTargetType {
  3472. /**
  3473. * Mouse is on top of an unknown element.
  3474. */
  3475. UNKNOWN = 0,
  3476. /**
  3477. * Mouse is on top of the textarea used for input.
  3478. */
  3479. TEXTAREA = 1,
  3480. /**
  3481. * Mouse is on top of the glyph margin
  3482. */
  3483. GUTTER_GLYPH_MARGIN = 2,
  3484. /**
  3485. * Mouse is on top of the line numbers
  3486. */
  3487. GUTTER_LINE_NUMBERS = 3,
  3488. /**
  3489. * Mouse is on top of the line decorations
  3490. */
  3491. GUTTER_LINE_DECORATIONS = 4,
  3492. /**
  3493. * Mouse is on top of the whitespace left in the gutter by a view zone.
  3494. */
  3495. GUTTER_VIEW_ZONE = 5,
  3496. /**
  3497. * Mouse is on top of text in the content.
  3498. */
  3499. CONTENT_TEXT = 6,
  3500. /**
  3501. * Mouse is on top of empty space in the content (e.g. after line text or below last line)
  3502. */
  3503. CONTENT_EMPTY = 7,
  3504. /**
  3505. * Mouse is on top of a view zone in the content.
  3506. */
  3507. CONTENT_VIEW_ZONE = 8,
  3508. /**
  3509. * Mouse is on top of a content widget.
  3510. */
  3511. CONTENT_WIDGET = 9,
  3512. /**
  3513. * Mouse is on top of the decorations overview ruler.
  3514. */
  3515. OVERVIEW_RULER = 10,
  3516. /**
  3517. * Mouse is on top of a scrollbar.
  3518. */
  3519. SCROLLBAR = 11,
  3520. /**
  3521. * Mouse is on top of an overlay widget.
  3522. */
  3523. OVERLAY_WIDGET = 12,
  3524. /**
  3525. * Mouse is outside of the editor.
  3526. */
  3527. OUTSIDE_EDITOR = 13,
  3528. }
  3529. /**
  3530. * Target hit with the mouse in the editor.
  3531. */
  3532. export interface IMouseTarget {
  3533. /**
  3534. * The target element
  3535. */
  3536. readonly element: Element;
  3537. /**
  3538. * The target type
  3539. */
  3540. readonly type: MouseTargetType;
  3541. /**
  3542. * The 'approximate' editor position
  3543. */
  3544. readonly position: Position;
  3545. /**
  3546. * Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line).
  3547. */
  3548. readonly mouseColumn: number;
  3549. /**
  3550. * The 'approximate' editor range
  3551. */
  3552. readonly range: Range;
  3553. /**
  3554. * Some extra detail.
  3555. */
  3556. readonly detail: any;
  3557. }
  3558. /**
  3559. * A mouse event originating from the editor.
  3560. */
  3561. export interface IEditorMouseEvent {
  3562. readonly event: IMouseEvent;
  3563. readonly target: IMouseTarget;
  3564. }
  3565. /**
  3566. * A rich code editor.
  3567. */
  3568. export interface ICodeEditor extends ICommonCodeEditor {
  3569. /**
  3570. * An event emitted on a "mouseup".
  3571. * @event
  3572. */
  3573. onMouseUp(listener: (e: IEditorMouseEvent) => void): IDisposable;
  3574. /**
  3575. * An event emitted on a "mousedown".
  3576. * @event
  3577. */
  3578. onMouseDown(listener: (e: IEditorMouseEvent) => void): IDisposable;
  3579. /**
  3580. * An event emitted on a "contextmenu".
  3581. * @event
  3582. */
  3583. onContextMenu(listener: (e: IEditorMouseEvent) => void): IDisposable;
  3584. /**
  3585. * An event emitted on a "mousemove".
  3586. * @event
  3587. */
  3588. onMouseMove(listener: (e: IEditorMouseEvent) => void): IDisposable;
  3589. /**
  3590. * An event emitted on a "mouseleave".
  3591. * @event
  3592. */
  3593. onMouseLeave(listener: (e: IEditorMouseEvent) => void): IDisposable;
  3594. /**
  3595. * An event emitted on a "keyup".
  3596. * @event
  3597. */
  3598. onKeyUp(listener: (e: IKeyboardEvent) => void): IDisposable;
  3599. /**
  3600. * An event emitted on a "keydown".
  3601. * @event
  3602. */
  3603. onKeyDown(listener: (e: IKeyboardEvent) => void): IDisposable;
  3604. /**
  3605. * An event emitted when the layout of the editor has changed.
  3606. * @event
  3607. */
  3608. onDidLayoutChange(listener: (e: EditorLayoutInfo) => void): IDisposable;
  3609. /**
  3610. * An event emitted when the scroll in the editor has changed.
  3611. * @event
  3612. */
  3613. onDidScrollChange(listener: (e: IScrollEvent) => void): IDisposable;
  3614. /**
  3615. * Returns the editor's dom node
  3616. */
  3617. getDomNode(): HTMLElement;
  3618. /**
  3619. * Add a content widget. Widgets must have unique ids, otherwise they will be overwritten.
  3620. */
  3621. addContentWidget(widget: IContentWidget): void;
  3622. /**
  3623. * Layout/Reposition a content widget. This is a ping to the editor to call widget.getPosition()
  3624. * and update appropiately.
  3625. */
  3626. layoutContentWidget(widget: IContentWidget): void;
  3627. /**
  3628. * Remove a content widget.
  3629. */
  3630. removeContentWidget(widget: IContentWidget): void;
  3631. /**
  3632. * Add an overlay widget. Widgets must have unique ids, otherwise they will be overwritten.
  3633. */
  3634. addOverlayWidget(widget: IOverlayWidget): void;
  3635. /**
  3636. * Layout/Reposition an overlay widget. This is a ping to the editor to call widget.getPosition()
  3637. * and update appropiately.
  3638. */
  3639. layoutOverlayWidget(widget: IOverlayWidget): void;
  3640. /**
  3641. * Remove an overlay widget.
  3642. */
  3643. removeOverlayWidget(widget: IOverlayWidget): void;
  3644. /**
  3645. * Change the view zones. View zones are lost when a new model is attached to the editor.
  3646. */
  3647. changeViewZones(callback: (accessor: IViewZoneChangeAccessor) => void): void;
  3648. /**
  3649. * Returns the range that is currently centered in the view port.
  3650. */
  3651. getCenteredRangeInViewport(): Range;
  3652. /**
  3653. * Get the horizontal position (left offset) for the column w.r.t to the beginning of the line.
  3654. * This method works only if the line `lineNumber` is currently rendered (in the editor's viewport).
  3655. * Use this method with caution.
  3656. */
  3657. getOffsetForColumn(lineNumber: number, column: number): number;
  3658. /**
  3659. * Force an editor render now.
  3660. */
  3661. render(): void;
  3662. /**
  3663. * Get the vertical position (top offset) for the line w.r.t. to the first line.
  3664. */
  3665. getTopForLineNumber(lineNumber: number): number;
  3666. /**
  3667. * Get the vertical position (top offset) for the position w.r.t. to the first line.
  3668. */
  3669. getTopForPosition(lineNumber: number, column: number): number;
  3670. /**
  3671. * Get the hit test target at coordinates `clientX` and `clientY`.
  3672. * The coordinates are relative to the top-left of the viewport.
  3673. *
  3674. * @returns Hit test target or null if the coordinates fall outside the editor or the editor has no model.
  3675. */
  3676. getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget;
  3677. /**
  3678. * Get the visible position for `position`.
  3679. * The result position takes scrolling into account and is relative to the top left corner of the editor.
  3680. * Explanation 1: the results of this method will change for the same `position` if the user scrolls the editor.
  3681. * Explanation 2: the results of this method will not change if the container of the editor gets repositioned.
  3682. * Warning: the results of this method are innacurate for positions that are outside the current editor viewport.
  3683. */
  3684. getScrolledVisiblePosition(position: IPosition): {
  3685. top: number;
  3686. left: number;
  3687. height: number;
  3688. };
  3689. /**
  3690. * Apply the same font settings as the editor to `target`.
  3691. */
  3692. applyFontInfo(target: HTMLElement): void;
  3693. }
  3694. /**
  3695. * A rich diff editor.
  3696. */
  3697. export interface IDiffEditor extends ICommonDiffEditor {
  3698. /**
  3699. * @see ICodeEditor.getDomNode
  3700. */
  3701. getDomNode(): HTMLElement;
  3702. }
  3703. export class FontInfo extends BareFontInfo {
  3704. readonly _editorStylingBrand: void;
  3705. readonly isTrusted: boolean;
  3706. readonly isMonospace: boolean;
  3707. readonly typicalHalfwidthCharacterWidth: number;
  3708. readonly typicalFullwidthCharacterWidth: number;
  3709. readonly spaceWidth: number;
  3710. readonly maxDigitWidth: number;
  3711. }
  3712. export class BareFontInfo {
  3713. readonly _bareFontInfoBrand: void;
  3714. readonly zoomLevel: number;
  3715. readonly fontFamily: string;
  3716. readonly fontWeight: string;
  3717. readonly fontSize: number;
  3718. readonly lineHeight: number;
  3719. readonly letterSpacing: number;
  3720. }
  3721. }
  3722. declare module monaco.languages {
  3723. /**
  3724. * Register information about a new language.
  3725. */
  3726. export function register(language: ILanguageExtensionPoint): void;
  3727. /**
  3728. * Get the information of all the registered languages.
  3729. */
  3730. export function getLanguages(): ILanguageExtensionPoint[];
  3731. /**
  3732. * An event emitted when a language is first time needed (e.g. a model has it set).
  3733. * @event
  3734. */
  3735. export function onLanguage(languageId: string, callback: () => void): IDisposable;
  3736. /**
  3737. * Set the editing configuration for a language.
  3738. */
  3739. export function setLanguageConfiguration(languageId: string, configuration: LanguageConfiguration): IDisposable;
  3740. /**
  3741. * A token.
  3742. */
  3743. export interface IToken {
  3744. startIndex: number;
  3745. scopes: string;
  3746. }
  3747. /**
  3748. * The result of a line tokenization.
  3749. */
  3750. export interface ILineTokens {
  3751. /**
  3752. * The list of tokens on the line.
  3753. */
  3754. tokens: IToken[];
  3755. /**
  3756. * The tokenization end state.
  3757. * A pointer will be held to this and the object should not be modified by the tokenizer after the pointer is returned.
  3758. */
  3759. endState: IState;
  3760. }
  3761. /**
  3762. * A "manual" provider of tokens.
  3763. */
  3764. export interface TokensProvider {
  3765. /**
  3766. * The initial state of a language. Will be the state passed in to tokenize the first line.
  3767. */
  3768. getInitialState(): IState;
  3769. /**
  3770. * Tokenize a line given the state at the beginning of the line.
  3771. */
  3772. tokenize(line: string, state: IState): ILineTokens;
  3773. }
  3774. /**
  3775. * Set the tokens provider for a language (manual implementation).
  3776. */
  3777. export function setTokensProvider(languageId: string, provider: TokensProvider): IDisposable;
  3778. /**
  3779. * Set the tokens provider for a language (monarch implementation).
  3780. */
  3781. export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage): IDisposable;
  3782. /**
  3783. * Register a reference provider (used by e.g. reference search).
  3784. */
  3785. export function registerReferenceProvider(languageId: string, provider: ReferenceProvider): IDisposable;
  3786. /**
  3787. * Register a rename provider (used by e.g. rename symbol).
  3788. */
  3789. export function registerRenameProvider(languageId: string, provider: RenameProvider): IDisposable;
  3790. /**
  3791. * Register a signature help provider (used by e.g. paremeter hints).
  3792. */
  3793. export function registerSignatureHelpProvider(languageId: string, provider: SignatureHelpProvider): IDisposable;
  3794. /**
  3795. * Register a hover provider (used by e.g. editor hover).
  3796. */
  3797. export function registerHoverProvider(languageId: string, provider: HoverProvider): IDisposable;
  3798. /**
  3799. * Register a document symbol provider (used by e.g. outline).
  3800. */
  3801. export function registerDocumentSymbolProvider(languageId: string, provider: DocumentSymbolProvider): IDisposable;
  3802. /**
  3803. * Register a document highlight provider (used by e.g. highlight occurrences).
  3804. */
  3805. export function registerDocumentHighlightProvider(languageId: string, provider: DocumentHighlightProvider): IDisposable;
  3806. /**
  3807. * Register a definition provider (used by e.g. go to definition).
  3808. */
  3809. export function registerDefinitionProvider(languageId: string, provider: DefinitionProvider): IDisposable;
  3810. /**
  3811. * Register a implementation provider (used by e.g. go to implementation).
  3812. */
  3813. export function registerImplementationProvider(languageId: string, provider: ImplementationProvider): IDisposable;
  3814. /**
  3815. * Register a type definition provider (used by e.g. go to type definition).
  3816. */
  3817. export function registerTypeDefinitionProvider(languageId: string, provider: TypeDefinitionProvider): IDisposable;
  3818. /**
  3819. * Register a code lens provider (used by e.g. inline code lenses).
  3820. */
  3821. export function registerCodeLensProvider(languageId: string, provider: CodeLensProvider): IDisposable;
  3822. /**
  3823. * Register a code action provider (used by e.g. quick fix).
  3824. */
  3825. export function registerCodeActionProvider(languageId: string, provider: CodeActionProvider): IDisposable;
  3826. /**
  3827. * Register a formatter that can handle only entire models.
  3828. */
  3829. export function registerDocumentFormattingEditProvider(languageId: string, provider: DocumentFormattingEditProvider): IDisposable;
  3830. /**
  3831. * Register a formatter that can handle a range inside a model.
  3832. */
  3833. export function registerDocumentRangeFormattingEditProvider(languageId: string, provider: DocumentRangeFormattingEditProvider): IDisposable;
  3834. /**
  3835. * Register a formatter than can do formatting as the user types.
  3836. */
  3837. export function registerOnTypeFormattingEditProvider(languageId: string, provider: OnTypeFormattingEditProvider): IDisposable;
  3838. /**
  3839. * Register a link provider that can find links in text.
  3840. */
  3841. export function registerLinkProvider(languageId: string, provider: LinkProvider): IDisposable;
  3842. /**
  3843. * Register a completion item provider (use by e.g. suggestions).
  3844. */
  3845. export function registerCompletionItemProvider(languageId: string, provider: CompletionItemProvider): IDisposable;
  3846. /**
  3847. * Contains additional diagnostic information about the context in which
  3848. * a [code action](#CodeActionProvider.provideCodeActions) is run.
  3849. */
  3850. export interface CodeActionContext {
  3851. /**
  3852. * An array of diagnostics.
  3853. *
  3854. * @readonly
  3855. */
  3856. readonly markers: editor.IMarkerData[];
  3857. }
  3858. /**
  3859. * The code action interface defines the contract between extensions and
  3860. * the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature.
  3861. */
  3862. export interface CodeActionProvider {
  3863. /**
  3864. * Provide commands for the given document and range.
  3865. */
  3866. provideCodeActions(model: editor.IReadOnlyModel, range: Range, context: CodeActionContext, token: CancellationToken): CodeAction[] | Thenable<CodeAction[]>;
  3867. }
  3868. /**
  3869. * Completion item kinds.
  3870. */
  3871. export enum CompletionItemKind {
  3872. Text = 0,
  3873. Method = 1,
  3874. Function = 2,
  3875. Constructor = 3,
  3876. Field = 4,
  3877. Variable = 5,
  3878. Class = 6,
  3879. Interface = 7,
  3880. Module = 8,
  3881. Property = 9,
  3882. Unit = 10,
  3883. Value = 11,
  3884. Enum = 12,
  3885. Keyword = 13,
  3886. Snippet = 14,
  3887. Color = 15,
  3888. File = 16,
  3889. Reference = 17,
  3890. Folder = 18,
  3891. }
  3892. /**
  3893. * A snippet string is a template which allows to insert text
  3894. * and to control the editor cursor when insertion happens.
  3895. *
  3896. * A snippet can define tab stops and placeholders with `$1`, `$2`
  3897. * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
  3898. * the end of the snippet. Variables are defined with `$name` and
  3899. * `${name:default value}`. The full snippet syntax is documented
  3900. * [here](http://code.visualstudio.com/docs/editor/userdefinedsnippets#_creating-your-own-snippets).
  3901. */
  3902. export interface SnippetString {
  3903. /**
  3904. * The snippet string.
  3905. */
  3906. value: string;
  3907. }
  3908. /**
  3909. * A completion item represents a text snippet that is
  3910. * proposed to complete text that is being typed.
  3911. */
  3912. export interface CompletionItem {
  3913. /**
  3914. * The label of this completion item. By default
  3915. * this is also the text that is inserted when selecting
  3916. * this completion.
  3917. */
  3918. label: string;
  3919. /**
  3920. * The kind of this completion item. Based on the kind
  3921. * an icon is chosen by the editor.
  3922. */
  3923. kind: CompletionItemKind;
  3924. /**
  3925. * A human-readable string with additional information
  3926. * about this item, like type or symbol information.
  3927. */
  3928. detail?: string;
  3929. /**
  3930. * A human-readable string that represents a doc-comment.
  3931. */
  3932. documentation?: string;
  3933. /**
  3934. * A string that should be used when comparing this item
  3935. * with other items. When `falsy` the [label](#CompletionItem.label)
  3936. * is used.
  3937. */
  3938. sortText?: string;
  3939. /**
  3940. * A string that should be used when filtering a set of
  3941. * completion items. When `falsy` the [label](#CompletionItem.label)
  3942. * is used.
  3943. */
  3944. filterText?: string;
  3945. /**
  3946. * A string or snippet that should be inserted in a document when selecting
  3947. * this completion. When `falsy` the [label](#CompletionItem.label)
  3948. * is used.
  3949. */
  3950. insertText?: string | SnippetString;
  3951. /**
  3952. * A range of text that should be replaced by this completion item.
  3953. *
  3954. * Defaults to a range from the start of the [current word](#TextDocument.getWordRangeAtPosition) to the
  3955. * current position.
  3956. *
  3957. * *Note:* The range must be a [single line](#Range.isSingleLine) and it must
  3958. * [contain](#Range.contains) the position at which completion has been [requested](#CompletionItemProvider.provideCompletionItems).
  3959. */
  3960. range?: Range;
  3961. /**
  3962. * @deprecated **Deprecated** in favor of `CompletionItem.insertText` and `CompletionItem.range`.
  3963. *
  3964. * ~~An [edit](#TextEdit) which is applied to a document when selecting
  3965. * this completion. When an edit is provided the value of
  3966. * [insertText](#CompletionItem.insertText) is ignored.~~
  3967. *
  3968. * ~~The [range](#Range) of the edit must be single-line and on the same
  3969. * line completions were [requested](#CompletionItemProvider.provideCompletionItems) at.~~
  3970. */
  3971. textEdit?: editor.ISingleEditOperation;
  3972. }
  3973. /**
  3974. * Represents a collection of [completion items](#CompletionItem) to be presented
  3975. * in the editor.
  3976. */
  3977. export interface CompletionList {
  3978. /**
  3979. * This list it not complete. Further typing should result in recomputing
  3980. * this list.
  3981. */
  3982. isIncomplete?: boolean;
  3983. /**
  3984. * The completion items.
  3985. */
  3986. items: CompletionItem[];
  3987. }
  3988. /**
  3989. * The completion item provider interface defines the contract between extensions and
  3990. * the [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense).
  3991. *
  3992. * When computing *complete* completion items is expensive, providers can optionally implement
  3993. * the `resolveCompletionItem`-function. In that case it is enough to return completion
  3994. * items with a [label](#CompletionItem.label) from the
  3995. * [provideCompletionItems](#CompletionItemProvider.provideCompletionItems)-function. Subsequently,
  3996. * when a completion item is shown in the UI and gains focus this provider is asked to resolve
  3997. * the item, like adding [doc-comment](#CompletionItem.documentation) or [details](#CompletionItem.detail).
  3998. */
  3999. export interface CompletionItemProvider {
  4000. triggerCharacters?: string[];
  4001. /**
  4002. * Provide completion items for the given position and document.
  4003. */
  4004. provideCompletionItems(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): CompletionItem[] | Thenable<CompletionItem[]> | CompletionList | Thenable<CompletionList>;
  4005. /**
  4006. * Given a completion item fill in more data, like [doc-comment](#CompletionItem.documentation)
  4007. * or [details](#CompletionItem.detail).
  4008. *
  4009. * The editor will only resolve a completion item once.
  4010. */
  4011. resolveCompletionItem?(item: CompletionItem, token: CancellationToken): CompletionItem | Thenable<CompletionItem>;
  4012. }
  4013. /**
  4014. * Describes how comments for a language work.
  4015. */
  4016. export interface CommentRule {
  4017. /**
  4018. * The line comment token, like `// this is a comment`
  4019. */
  4020. lineComment?: string;
  4021. /**
  4022. * The block comment character pair, like `/* block comment *&#47;`
  4023. */
  4024. blockComment?: CharacterPair;
  4025. }
  4026. /**
  4027. * The language configuration interface defines the contract between extensions and
  4028. * various editor features, like automatic bracket insertion, automatic indentation etc.
  4029. */
  4030. export interface LanguageConfiguration {
  4031. /**
  4032. * The language's comment settings.
  4033. */
  4034. comments?: CommentRule;
  4035. /**
  4036. * The language's brackets.
  4037. * This configuration implicitly affects pressing Enter around these brackets.
  4038. */
  4039. brackets?: CharacterPair[];
  4040. /**
  4041. * The language's word definition.
  4042. * If the language supports Unicode identifiers (e.g. JavaScript), it is preferable
  4043. * to provide a word definition that uses exclusion of known separators.
  4044. * e.g.: A regex that matches anything except known separators (and dot is allowed to occur in a floating point number):
  4045. * /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
  4046. */
  4047. wordPattern?: RegExp;
  4048. /**
  4049. * The language's indentation settings.
  4050. */
  4051. indentationRules?: IndentationRule;
  4052. /**
  4053. * The language's rules to be evaluated when pressing Enter.
  4054. */
  4055. onEnterRules?: OnEnterRule[];
  4056. /**
  4057. * The language's auto closing pairs. The 'close' character is automatically inserted with the
  4058. * 'open' character is typed. If not set, the configured brackets will be used.
  4059. */
  4060. autoClosingPairs?: IAutoClosingPairConditional[];
  4061. /**
  4062. * The language's surrounding pairs. When the 'open' character is typed on a selection, the
  4063. * selected string is surrounded by the open and close characters. If not set, the autoclosing pairs
  4064. * settings will be used.
  4065. */
  4066. surroundingPairs?: IAutoClosingPair[];
  4067. /**
  4068. * **Deprecated** Do not use.
  4069. *
  4070. * @deprecated Will be replaced by a better API soon.
  4071. */
  4072. __electricCharacterSupport?: IBracketElectricCharacterContribution;
  4073. }
  4074. /**
  4075. * Describes indentation rules for a language.
  4076. */
  4077. export interface IndentationRule {
  4078. /**
  4079. * If a line matches this pattern, then all the lines after it should be unindendented once (until another rule matches).
  4080. */
  4081. decreaseIndentPattern: RegExp;
  4082. /**
  4083. * If a line matches this pattern, then all the lines after it should be indented once (until another rule matches).
  4084. */
  4085. increaseIndentPattern: RegExp;
  4086. /**
  4087. * If a line matches this pattern, then **only the next line** after it should be indented once.
  4088. */
  4089. indentNextLinePattern?: RegExp;
  4090. /**
  4091. * If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules.
  4092. */
  4093. unIndentedLinePattern?: RegExp;
  4094. }
  4095. /**
  4096. * Describes a rule to be evaluated when pressing Enter.
  4097. */
  4098. export interface OnEnterRule {
  4099. /**
  4100. * This rule will only execute if the text before the cursor matches this regular expression.
  4101. */
  4102. beforeText: RegExp;
  4103. /**
  4104. * This rule will only execute if the text after the cursor matches this regular expression.
  4105. */
  4106. afterText?: RegExp;
  4107. /**
  4108. * The action to execute.
  4109. */
  4110. action: EnterAction;
  4111. }
  4112. export interface IBracketElectricCharacterContribution {
  4113. docComment?: IDocComment;
  4114. }
  4115. /**
  4116. * Definition of documentation comments (e.g. Javadoc/JSdoc)
  4117. */
  4118. export interface IDocComment {
  4119. /**
  4120. * The string that starts a doc comment (e.g. '/**')
  4121. */
  4122. open: string;
  4123. /**
  4124. * The string that appears on the last line and closes the doc comment (e.g. ' * /').
  4125. */
  4126. close: string;
  4127. }
  4128. /**
  4129. * A tuple of two characters, like a pair of
  4130. * opening and closing brackets.
  4131. */
  4132. export type CharacterPair = [string, string];
  4133. export interface IAutoClosingPair {
  4134. open: string;
  4135. close: string;
  4136. }
  4137. export interface IAutoClosingPairConditional extends IAutoClosingPair {
  4138. notIn?: string[];
  4139. }
  4140. /**
  4141. * Describes what to do with the indentation when pressing Enter.
  4142. */
  4143. export enum IndentAction {
  4144. /**
  4145. * Insert new line and copy the previous line's indentation.
  4146. */
  4147. None = 0,
  4148. /**
  4149. * Insert new line and indent once (relative to the previous line's indentation).
  4150. */
  4151. Indent = 1,
  4152. /**
  4153. * Insert two new lines:
  4154. * - the first one indented which will hold the cursor
  4155. * - the second one at the same indentation level
  4156. */
  4157. IndentOutdent = 2,
  4158. /**
  4159. * Insert new line and outdent once (relative to the previous line's indentation).
  4160. */
  4161. Outdent = 3,
  4162. }
  4163. /**
  4164. * Describes what to do when pressing Enter.
  4165. */
  4166. export interface EnterAction {
  4167. /**
  4168. * Describe what to do with the indentation.
  4169. */
  4170. indentAction: IndentAction;
  4171. /**
  4172. * Describe whether to outdent current line.
  4173. */
  4174. outdentCurrentLine?: boolean;
  4175. /**
  4176. * Describes text to be appended after the new line and after the indentation.
  4177. */
  4178. appendText?: string;
  4179. /**
  4180. * Describes the number of characters to remove from the new line's indentation.
  4181. */
  4182. removeText?: number;
  4183. }
  4184. /**
  4185. * The state of the tokenizer between two lines.
  4186. * It is useful to store flags such as in multiline comment, etc.
  4187. * The model will clone the previous line's state and pass it in to tokenize the next line.
  4188. */
  4189. export interface IState {
  4190. clone(): IState;
  4191. equals(other: IState): boolean;
  4192. }
  4193. /**
  4194. * A hover represents additional information for a symbol or word. Hovers are
  4195. * rendered in a tooltip-like widget.
  4196. */
  4197. export interface Hover {
  4198. /**
  4199. * The contents of this hover.
  4200. */
  4201. contents: MarkedString[];
  4202. /**
  4203. * The range to which this hover applies. When missing, the
  4204. * editor will use the range at the current position or the
  4205. * current position itself.
  4206. */
  4207. range: IRange;
  4208. }
  4209. /**
  4210. * The hover provider interface defines the contract between extensions and
  4211. * the [hover](https://code.visualstudio.com/docs/editor/intellisense)-feature.
  4212. */
  4213. export interface HoverProvider {
  4214. /**
  4215. * Provide a hover for the given position and document. Multiple hovers at the same
  4216. * position will be merged by the editor. A hover can have a range which defaults
  4217. * to the word range at the position when omitted.
  4218. */
  4219. provideHover(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): Hover | Thenable<Hover>;
  4220. }
  4221. /**
  4222. * Interface used to quick fix typing errors while accesing member fields.
  4223. */
  4224. export interface CodeAction {
  4225. command: Command;
  4226. score: number;
  4227. }
  4228. /**
  4229. * Represents a parameter of a callable-signature. A parameter can
  4230. * have a label and a doc-comment.
  4231. */
  4232. export interface ParameterInformation {
  4233. /**
  4234. * The label of this signature. Will be shown in
  4235. * the UI.
  4236. */
  4237. label: string;
  4238. /**
  4239. * The human-readable doc-comment of this signature. Will be shown
  4240. * in the UI but can be omitted.
  4241. */
  4242. documentation?: string;
  4243. }
  4244. /**
  4245. * Represents the signature of something callable. A signature
  4246. * can have a label, like a function-name, a doc-comment, and
  4247. * a set of parameters.
  4248. */
  4249. export interface SignatureInformation {
  4250. /**
  4251. * The label of this signature. Will be shown in
  4252. * the UI.
  4253. */
  4254. label: string;
  4255. /**
  4256. * The human-readable doc-comment of this signature. Will be shown
  4257. * in the UI but can be omitted.
  4258. */
  4259. documentation?: string;
  4260. /**
  4261. * The parameters of this signature.
  4262. */
  4263. parameters: ParameterInformation[];
  4264. }
  4265. /**
  4266. * Signature help represents the signature of something
  4267. * callable. There can be multiple signatures but only one
  4268. * active and only one active parameter.
  4269. */
  4270. export interface SignatureHelp {
  4271. /**
  4272. * One or more signatures.
  4273. */
  4274. signatures: SignatureInformation[];
  4275. /**
  4276. * The active signature.
  4277. */
  4278. activeSignature: number;
  4279. /**
  4280. * The active parameter of the active signature.
  4281. */
  4282. activeParameter: number;
  4283. }
  4284. /**
  4285. * The signature help provider interface defines the contract between extensions and
  4286. * the [parameter hints](https://code.visualstudio.com/docs/editor/intellisense)-feature.
  4287. */
  4288. export interface SignatureHelpProvider {
  4289. signatureHelpTriggerCharacters: string[];
  4290. /**
  4291. * Provide help for the signature at the given position and document.
  4292. */
  4293. provideSignatureHelp(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): SignatureHelp | Thenable<SignatureHelp>;
  4294. }
  4295. /**
  4296. * A document highlight kind.
  4297. */
  4298. export enum DocumentHighlightKind {
  4299. /**
  4300. * A textual occurrence.
  4301. */
  4302. Text = 0,
  4303. /**
  4304. * Read-access of a symbol, like reading a variable.
  4305. */
  4306. Read = 1,
  4307. /**
  4308. * Write-access of a symbol, like writing to a variable.
  4309. */
  4310. Write = 2,
  4311. }
  4312. /**
  4313. * A document highlight is a range inside a text document which deserves
  4314. * special attention. Usually a document highlight is visualized by changing
  4315. * the background color of its range.
  4316. */
  4317. export interface DocumentHighlight {
  4318. /**
  4319. * The range this highlight applies to.
  4320. */
  4321. range: IRange;
  4322. /**
  4323. * The highlight kind, default is [text](#DocumentHighlightKind.Text).
  4324. */
  4325. kind: DocumentHighlightKind;
  4326. }
  4327. /**
  4328. * The document highlight provider interface defines the contract between extensions and
  4329. * the word-highlight-feature.
  4330. */
  4331. export interface DocumentHighlightProvider {
  4332. /**
  4333. * Provide a set of document highlights, like all occurrences of a variable or
  4334. * all exit-points of a function.
  4335. */
  4336. provideDocumentHighlights(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): DocumentHighlight[] | Thenable<DocumentHighlight[]>;
  4337. }
  4338. /**
  4339. * Value-object that contains additional information when
  4340. * requesting references.
  4341. */
  4342. export interface ReferenceContext {
  4343. /**
  4344. * Include the declaration of the current symbol.
  4345. */
  4346. includeDeclaration: boolean;
  4347. }
  4348. /**
  4349. * The reference provider interface defines the contract between extensions and
  4350. * the [find references](https://code.visualstudio.com/docs/editor/editingevolved#_peek)-feature.
  4351. */
  4352. export interface ReferenceProvider {
  4353. /**
  4354. * Provide a set of project-wide references for the given position and document.
  4355. */
  4356. provideReferences(model: editor.IReadOnlyModel, position: Position, context: ReferenceContext, token: CancellationToken): Location[] | Thenable<Location[]>;
  4357. }
  4358. /**
  4359. * Represents a location inside a resource, such as a line
  4360. * inside a text file.
  4361. */
  4362. export interface Location {
  4363. /**
  4364. * The resource identifier of this location.
  4365. */
  4366. uri: Uri;
  4367. /**
  4368. * The document range of this locations.
  4369. */
  4370. range: IRange;
  4371. }
  4372. /**
  4373. * The definition of a symbol represented as one or many [locations](#Location).
  4374. * For most programming languages there is only one location at which a symbol is
  4375. * defined.
  4376. */
  4377. export type Definition = Location | Location[];
  4378. /**
  4379. * The definition provider interface defines the contract between extensions and
  4380. * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)
  4381. * and peek definition features.
  4382. */
  4383. export interface DefinitionProvider {
  4384. /**
  4385. * Provide the definition of the symbol at the given position and document.
  4386. */
  4387. provideDefinition(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
  4388. }
  4389. /**
  4390. * The implementation provider interface defines the contract between extensions and
  4391. * the go to implementation feature.
  4392. */
  4393. export interface ImplementationProvider {
  4394. /**
  4395. * Provide the implementation of the symbol at the given position and document.
  4396. */
  4397. provideImplementation(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
  4398. }
  4399. /**
  4400. * The type definition provider interface defines the contract between extensions and
  4401. * the go to type definition feature.
  4402. */
  4403. export interface TypeDefinitionProvider {
  4404. /**
  4405. * Provide the type definition of the symbol at the given position and document.
  4406. */
  4407. provideTypeDefinition(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): Definition | Thenable<Definition>;
  4408. }
  4409. /**
  4410. * A symbol kind.
  4411. */
  4412. export enum SymbolKind {
  4413. File = 0,
  4414. Module = 1,
  4415. Namespace = 2,
  4416. Package = 3,
  4417. Class = 4,
  4418. Method = 5,
  4419. Property = 6,
  4420. Field = 7,
  4421. Constructor = 8,
  4422. Enum = 9,
  4423. Interface = 10,
  4424. Function = 11,
  4425. Variable = 12,
  4426. Constant = 13,
  4427. String = 14,
  4428. Number = 15,
  4429. Boolean = 16,
  4430. Array = 17,
  4431. Object = 18,
  4432. Key = 19,
  4433. Null = 20,
  4434. EnumMember = 21,
  4435. Struct = 22,
  4436. Event = 23,
  4437. Operator = 24,
  4438. TypeParameter = 25,
  4439. }
  4440. /**
  4441. * Represents information about programming constructs like variables, classes,
  4442. * interfaces etc.
  4443. */
  4444. export interface SymbolInformation {
  4445. /**
  4446. * The name of this symbol.
  4447. */
  4448. name: string;
  4449. /**
  4450. * The name of the symbol containing this symbol.
  4451. */
  4452. containerName?: string;
  4453. /**
  4454. * The kind of this symbol.
  4455. */
  4456. kind: SymbolKind;
  4457. /**
  4458. * The location of this symbol.
  4459. */
  4460. location: Location;
  4461. }
  4462. /**
  4463. * The document symbol provider interface defines the contract between extensions and
  4464. * the [go to symbol](https://code.visualstudio.com/docs/editor/editingevolved#_goto-symbol)-feature.
  4465. */
  4466. export interface DocumentSymbolProvider {
  4467. /**
  4468. * Provide symbol information for the given document.
  4469. */
  4470. provideDocumentSymbols(model: editor.IReadOnlyModel, token: CancellationToken): SymbolInformation[] | Thenable<SymbolInformation[]>;
  4471. }
  4472. export interface TextEdit {
  4473. range: IRange;
  4474. text: string;
  4475. eol?: editor.EndOfLineSequence;
  4476. }
  4477. /**
  4478. * Interface used to format a model
  4479. */
  4480. export interface FormattingOptions {
  4481. /**
  4482. * Size of a tab in spaces.
  4483. */
  4484. tabSize: number;
  4485. /**
  4486. * Prefer spaces over tabs.
  4487. */
  4488. insertSpaces: boolean;
  4489. }
  4490. /**
  4491. * The document formatting provider interface defines the contract between extensions and
  4492. * the formatting-feature.
  4493. */
  4494. export interface DocumentFormattingEditProvider {
  4495. /**
  4496. * Provide formatting edits for a whole document.
  4497. */
  4498. provideDocumentFormattingEdits(model: editor.IReadOnlyModel, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
  4499. }
  4500. /**
  4501. * The document formatting provider interface defines the contract between extensions and
  4502. * the formatting-feature.
  4503. */
  4504. export interface DocumentRangeFormattingEditProvider {
  4505. /**
  4506. * Provide formatting edits for a range in a document.
  4507. *
  4508. * The given range is a hint and providers can decide to format a smaller
  4509. * or larger range. Often this is done by adjusting the start and end
  4510. * of the range to full syntax nodes.
  4511. */
  4512. provideDocumentRangeFormattingEdits(model: editor.IReadOnlyModel, range: Range, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
  4513. }
  4514. /**
  4515. * The document formatting provider interface defines the contract between extensions and
  4516. * the formatting-feature.
  4517. */
  4518. export interface OnTypeFormattingEditProvider {
  4519. autoFormatTriggerCharacters: string[];
  4520. /**
  4521. * Provide formatting edits after a character has been typed.
  4522. *
  4523. * The given position and character should hint to the provider
  4524. * what range the position to expand to, like find the matching `{`
  4525. * when `}` has been entered.
  4526. */
  4527. provideOnTypeFormattingEdits(model: editor.IReadOnlyModel, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): TextEdit[] | Thenable<TextEdit[]>;
  4528. }
  4529. /**
  4530. * A link inside the editor.
  4531. */
  4532. export interface ILink {
  4533. range: IRange;
  4534. url: string;
  4535. }
  4536. /**
  4537. * A provider of links.
  4538. */
  4539. export interface LinkProvider {
  4540. provideLinks(model: editor.IReadOnlyModel, token: CancellationToken): ILink[] | Thenable<ILink[]>;
  4541. resolveLink?: (link: ILink, token: CancellationToken) => ILink | Thenable<ILink>;
  4542. }
  4543. export interface IResourceEdit {
  4544. resource: Uri;
  4545. range: IRange;
  4546. newText: string;
  4547. }
  4548. export interface WorkspaceEdit {
  4549. edits: IResourceEdit[];
  4550. rejectReason?: string;
  4551. }
  4552. export interface RenameProvider {
  4553. provideRenameEdits(model: editor.IReadOnlyModel, position: Position, newName: string, token: CancellationToken): WorkspaceEdit | Thenable<WorkspaceEdit>;
  4554. }
  4555. export interface Command {
  4556. id: string;
  4557. title: string;
  4558. tooltip?: string;
  4559. arguments?: any[];
  4560. }
  4561. export interface ICodeLensSymbol {
  4562. range: IRange;
  4563. id?: string;
  4564. command?: Command;
  4565. }
  4566. export interface CodeLensProvider {
  4567. onDidChange?: IEvent<this>;
  4568. provideCodeLenses(model: editor.IReadOnlyModel, token: CancellationToken): ICodeLensSymbol[] | Thenable<ICodeLensSymbol[]>;
  4569. resolveCodeLens?(model: editor.IReadOnlyModel, codeLens: ICodeLensSymbol, token: CancellationToken): ICodeLensSymbol | Thenable<ICodeLensSymbol>;
  4570. }
  4571. export interface ILanguageExtensionPoint {
  4572. id: string;
  4573. extensions?: string[];
  4574. filenames?: string[];
  4575. filenamePatterns?: string[];
  4576. firstLine?: string;
  4577. aliases?: string[];
  4578. mimetypes?: string[];
  4579. configuration?: string;
  4580. }
  4581. /**
  4582. * A Monarch language definition
  4583. */
  4584. export interface IMonarchLanguage {
  4585. /**
  4586. * map from string to ILanguageRule[]
  4587. */
  4588. tokenizer: {
  4589. [name: string]: IMonarchLanguageRule[];
  4590. };
  4591. /**
  4592. * is the language case insensitive?
  4593. */
  4594. ignoreCase?: boolean;
  4595. /**
  4596. * if no match in the tokenizer assign this token class (default 'source')
  4597. */
  4598. defaultToken?: string;
  4599. /**
  4600. * for example [['{','}','delimiter.curly']]
  4601. */
  4602. brackets?: IMonarchLanguageBracket[];
  4603. /**
  4604. * start symbol in the tokenizer (by default the first entry is used)
  4605. */
  4606. start?: string;
  4607. /**
  4608. * attach this to every token class (by default '.' + name)
  4609. */
  4610. tokenPostfix: string;
  4611. }
  4612. /**
  4613. * A rule is either a regular expression and an action
  4614. * shorthands: [reg,act] == { regex: reg, action: act}
  4615. * and : [reg,act,nxt] == { regex: reg, action: act{ next: nxt }}
  4616. */
  4617. export interface IMonarchLanguageRule {
  4618. /**
  4619. * match tokens
  4620. */
  4621. regex?: string | RegExp;
  4622. /**
  4623. * action to take on match
  4624. */
  4625. action?: IMonarchLanguageAction;
  4626. /**
  4627. * or an include rule. include all rules from the included state
  4628. */
  4629. include?: string;
  4630. }
  4631. /**
  4632. * An action is either an array of actions...
  4633. * ... or a case statement with guards...
  4634. * ... or a basic action with a token value.
  4635. */
  4636. export interface IMonarchLanguageAction {
  4637. /**
  4638. * array of actions for each parenthesized match group
  4639. */
  4640. group?: IMonarchLanguageAction[];
  4641. /**
  4642. * map from string to ILanguageAction
  4643. */
  4644. cases?: Object;
  4645. /**
  4646. * token class (ie. css class) (or "@brackets" or "@rematch")
  4647. */
  4648. token?: string;
  4649. /**
  4650. * the next state to push, or "@push", "@pop", "@popall"
  4651. */
  4652. next?: string;
  4653. /**
  4654. * switch to this state
  4655. */
  4656. switchTo?: string;
  4657. /**
  4658. * go back n characters in the stream
  4659. */
  4660. goBack?: number;
  4661. /**
  4662. * @open or @close
  4663. */
  4664. bracket?: string;
  4665. /**
  4666. * switch to embedded language (useing the mimetype) or get out using "@pop"
  4667. */
  4668. nextEmbedded?: string;
  4669. /**
  4670. * log a message to the browser console window
  4671. */
  4672. log?: string;
  4673. }
  4674. /**
  4675. * This interface can be shortened as an array, ie. ['{','}','delimiter.curly']
  4676. */
  4677. export interface IMonarchLanguageBracket {
  4678. /**
  4679. * open bracket
  4680. */
  4681. open: string;
  4682. /**
  4683. * closeing bracket
  4684. */
  4685. close: string;
  4686. /**
  4687. * token class
  4688. */
  4689. token: string;
  4690. }
  4691. }
  4692. declare module monaco.worker {
  4693. export interface IMirrorModel {
  4694. readonly uri: Uri;
  4695. readonly version: number;
  4696. getValue(): string;
  4697. }
  4698. export interface IWorkerContext {
  4699. /**
  4700. * Get all available mirror models in this worker.
  4701. */
  4702. getMirrorModels(): IMirrorModel[];
  4703. }
  4704. }
  4705. declare module monaco.languages.typescript {
  4706. enum ModuleKind {
  4707. None = 0,
  4708. CommonJS = 1,
  4709. AMD = 2,
  4710. UMD = 3,
  4711. System = 4,
  4712. ES2015 = 5,
  4713. }
  4714. enum JsxEmit {
  4715. None = 0,
  4716. Preserve = 1,
  4717. React = 2,
  4718. }
  4719. enum NewLineKind {
  4720. CarriageReturnLineFeed = 0,
  4721. LineFeed = 1,
  4722. }
  4723. enum ScriptTarget {
  4724. ES3 = 0,
  4725. ES5 = 1,
  4726. ES2015 = 2,
  4727. ES2016 = 3,
  4728. ES2017 = 4,
  4729. ESNext = 5,
  4730. Latest = 5,
  4731. }
  4732. export enum ModuleResolutionKind {
  4733. Classic = 1,
  4734. NodeJs = 2,
  4735. }
  4736. type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[];
  4737. interface CompilerOptions {
  4738. allowJs?: boolean;
  4739. allowSyntheticDefaultImports?: boolean;
  4740. allowUnreachableCode?: boolean;
  4741. allowUnusedLabels?: boolean;
  4742. alwaysStrict?: boolean;
  4743. baseUrl?: string;
  4744. charset?: string;
  4745. declaration?: boolean;
  4746. declarationDir?: string;
  4747. disableSizeLimit?: boolean;
  4748. emitBOM?: boolean;
  4749. emitDecoratorMetadata?: boolean;
  4750. experimentalDecorators?: boolean;
  4751. forceConsistentCasingInFileNames?: boolean;
  4752. importHelpers?: boolean;
  4753. inlineSourceMap?: boolean;
  4754. inlineSources?: boolean;
  4755. isolatedModules?: boolean;
  4756. jsx?: JsxEmit;
  4757. lib?: string[];
  4758. locale?: string;
  4759. mapRoot?: string;
  4760. maxNodeModuleJsDepth?: number;
  4761. module?: ModuleKind;
  4762. moduleResolution?: ModuleResolutionKind;
  4763. newLine?: NewLineKind;
  4764. noEmit?: boolean;
  4765. noEmitHelpers?: boolean;
  4766. noEmitOnError?: boolean;
  4767. noErrorTruncation?: boolean;
  4768. noFallthroughCasesInSwitch?: boolean;
  4769. noImplicitAny?: boolean;
  4770. noImplicitReturns?: boolean;
  4771. noImplicitThis?: boolean;
  4772. noUnusedLocals?: boolean;
  4773. noUnusedParameters?: boolean;
  4774. noImplicitUseStrict?: boolean;
  4775. noLib?: boolean;
  4776. noResolve?: boolean;
  4777. out?: string;
  4778. outDir?: string;
  4779. outFile?: string;
  4780. preserveConstEnums?: boolean;
  4781. project?: string;
  4782. reactNamespace?: string;
  4783. jsxFactory?: string;
  4784. removeComments?: boolean;
  4785. rootDir?: string;
  4786. rootDirs?: string[];
  4787. skipLibCheck?: boolean;
  4788. skipDefaultLibCheck?: boolean;
  4789. sourceMap?: boolean;
  4790. sourceRoot?: string;
  4791. strictNullChecks?: boolean;
  4792. suppressExcessPropertyErrors?: boolean;
  4793. suppressImplicitAnyIndexErrors?: boolean;
  4794. target?: ScriptTarget;
  4795. traceResolution?: boolean;
  4796. types?: string[];
  4797. /** Paths used to compute primary types search locations */
  4798. typeRoots?: string[];
  4799. [option: string]: CompilerOptionsValue | undefined;
  4800. }
  4801. export interface DiagnosticsOptions {
  4802. noSemanticValidation?: boolean;
  4803. noSyntaxValidation?: boolean;
  4804. }
  4805. export interface LanguageServiceDefaults {
  4806. /**
  4807. * Add an additional source file to the language service. Use this
  4808. * for typescript (definition) files that won't be loaded as editor
  4809. * document, like `jquery.d.ts`.
  4810. *
  4811. * @param content The file content
  4812. * @param filePath An optional file path
  4813. * @returns A disposabled which will remove the file from the
  4814. * language service upon disposal.
  4815. */
  4816. addExtraLib(content: string, filePath?: string): IDisposable;
  4817. /**
  4818. * Set TypeScript compiler options.
  4819. */
  4820. setCompilerOptions(options: CompilerOptions): void;
  4821. /**
  4822. * Configure whether syntactic and/or semantic validation should
  4823. * be performed
  4824. */
  4825. setDiagnosticsOptions(options: DiagnosticsOptions): void;
  4826. /**
  4827. * Configure when the worker shuts down. By default that is 2mins.
  4828. *
  4829. * @param value The maximun idle time in milliseconds. Values less than one
  4830. * mean never shut down.
  4831. */
  4832. setMaximunWorkerIdleTime(value: number): void;
  4833. /**
  4834. * Configure if all existing models should be eagerly sync'd
  4835. * to the worker on start or restart.
  4836. */
  4837. setEagerModelSync(value: boolean): void;
  4838. }
  4839. export var typescriptDefaults: LanguageServiceDefaults;
  4840. export var javascriptDefaults: LanguageServiceDefaults;
  4841. export var getTypeScriptWorker: () => monaco.Promise<any>;
  4842. export var getJavaScriptWorker: () => monaco.Promise<any>;
  4843. }
  4844. /*---------------------------------------------------------------------------------------------
  4845. * Copyright (c) Microsoft Corporation. All rights reserved.
  4846. * Licensed under the MIT License. See License.txt in the project root for license information.
  4847. *--------------------------------------------------------------------------------------------*/
  4848. declare module monaco.languages.css {
  4849. export interface DiagnosticsOptions {
  4850. readonly validate?: boolean;
  4851. readonly lint?: {
  4852. readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error',
  4853. readonly vendorPrefix?: 'ignore' | 'warning' | 'error',
  4854. readonly duplicateProperties?: 'ignore' | 'warning' | 'error',
  4855. readonly emptyRules?: 'ignore' | 'warning' | 'error',
  4856. readonly importStatement?: 'ignore' | 'warning' | 'error',
  4857. readonly boxModel?: 'ignore' | 'warning' | 'error',
  4858. readonly universalSelector?: 'ignore' | 'warning' | 'error',
  4859. readonly zeroUnits?: 'ignore' | 'warning' | 'error',
  4860. readonly fontFaceProperties?: 'ignore' | 'warning' | 'error',
  4861. readonly hexColorLength?: 'ignore' | 'warning' | 'error',
  4862. readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error',
  4863. readonly unknownProperties?: 'ignore' | 'warning' | 'error',
  4864. readonly ieHack?: 'ignore' | 'warning' | 'error',
  4865. readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error',
  4866. readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error',
  4867. readonly important?: 'ignore' | 'warning' | 'error',
  4868. readonly float?: 'ignore' | 'warning' | 'error',
  4869. readonly idSelector?: 'ignore' | 'warning' | 'error'
  4870. }
  4871. }
  4872. export interface LanguageServiceDefaults {
  4873. readonly onDidChange: IEvent<LanguageServiceDefaults>;
  4874. readonly diagnosticsOptions: DiagnosticsOptions;
  4875. setDiagnosticsOptions(options: DiagnosticsOptions): void;
  4876. }
  4877. export var cssDefaults: LanguageServiceDefaults;
  4878. export var lessDefaults: LanguageServiceDefaults;
  4879. export var scssDefaults: LanguageServiceDefaults;
  4880. }
  4881. /*---------------------------------------------------------------------------------------------
  4882. * Copyright (c) Microsoft Corporation. All rights reserved.
  4883. * Licensed under the MIT License. See License.txt in the project root for license information.
  4884. *--------------------------------------------------------------------------------------------*/
  4885. declare module monaco.languages.json {
  4886. export interface DiagnosticsOptions {
  4887. /**
  4888. * If set, the validator will be enabled and perform syntax validation as well as schema based validation.
  4889. */
  4890. readonly validate?: boolean;
  4891. /**
  4892. * If set, comments are tolerated. If set to false, syntax errors will be emmited for comments.
  4893. */
  4894. readonly allowComments?: boolean;
  4895. /**
  4896. * A list of known schemas and/or associations of schemas to file names.
  4897. */
  4898. readonly schemas?: {
  4899. /**
  4900. * The URI of the schema, which is also the identifier of the schema.
  4901. */
  4902. readonly uri: string;
  4903. /**
  4904. * A list of file names that are associated to the schema. The '*' wildcard can be used. For example '*.schema.json', 'package.json'
  4905. */
  4906. readonly fileMatch?: string[];
  4907. /**
  4908. * The schema for the given URI.
  4909. */
  4910. readonly schema?: any;
  4911. }[];
  4912. }
  4913. export interface LanguageServiceDefaults {
  4914. readonly onDidChange: IEvent<LanguageServiceDefaults>;
  4915. readonly diagnosticsOptions: DiagnosticsOptions;
  4916. setDiagnosticsOptions(options: DiagnosticsOptions): void;
  4917. }
  4918. export var jsonDefaults: LanguageServiceDefaults;
  4919. }
  4920. /*---------------------------------------------------------------------------------------------
  4921. * Copyright (c) Microsoft Corporation. All rights reserved.
  4922. * Licensed under the MIT License. See License.txt in the project root for license information.
  4923. *--------------------------------------------------------------------------------------------*/
  4924. declare module monaco.languages.html {
  4925. export interface HTMLFormatConfiguration {
  4926. readonly tabSize: number;
  4927. readonly insertSpaces: boolean;
  4928. readonly wrapLineLength: number;
  4929. readonly unformatted: string;
  4930. readonly contentUnformatted: string;
  4931. readonly indentInnerHtml: boolean;
  4932. readonly preserveNewLines: boolean;
  4933. readonly maxPreserveNewLines: number;
  4934. readonly indentHandlebars: boolean;
  4935. readonly endWithNewline: boolean;
  4936. readonly extraLiners: string;
  4937. readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline';
  4938. }
  4939. export interface CompletionConfiguration {
  4940. [provider: string]: boolean;
  4941. }
  4942. export interface Options {
  4943. /**
  4944. * If set, comments are tolerated. If set to false, syntax errors will be emmited for comments.
  4945. */
  4946. readonly format?: HTMLFormatConfiguration;
  4947. /**
  4948. * A list of known schemas and/or associations of schemas to file names.
  4949. */
  4950. readonly suggest?: CompletionConfiguration;
  4951. }
  4952. export interface LanguageServiceDefaults {
  4953. readonly onDidChange: IEvent<LanguageServiceDefaults>;
  4954. readonly options: Options;
  4955. setOptions(options: Options): void;
  4956. }
  4957. export var htmlDefaults: LanguageServiceDefaults;
  4958. export var handlebarDefaults: LanguageServiceDefaults;
  4959. export var razorDefaults: LanguageServiceDefaults;
  4960. }