monaco.d.ts 154 KB

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