monaco.d.ts 235 KB

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