editor.api.d.ts 307 KB

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