monaco.d.ts 288 KB

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