monaco.d.ts 266 KB

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