monaco.d.ts 271 KB

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