@tailwindcss/language-server 0.14.7 → 0.14.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/css-language-server +1 -1
- package/bin/tailwindcss-language-server +144 -144
- package/package.json +2 -2
package/bin/css-language-server
CHANGED
@@ -113,4 +113,4 @@ A zoom factor of 1.0 or 100% corresponds to no zooming. Larger values are zoomed
|
|
113
113
|
|
114
114
|
In order to let ::-webkit-progress-value take effect, -webkit-appearance needs to be set to none on the <progress> element.`},{name:"::grammar-error",status:"experimental",references:[{name:"MDN Reference",url:"https://developer.mozilla.org/docs/Web/CSS/::grammar-error"}],description:"The ::grammar-error CSS pseudo-element represents a text segment which the user agent has flagged as grammatically incorrect."},{name:"::marker",browsers:["E86","FF68","S11.1","C86","O72"],references:[{name:"MDN Reference",url:"https://developer.mozilla.org/docs/Web/CSS/::marker"}],description:"The ::marker CSS pseudo-element selects the marker box of a list item, which typically contains a bullet or number. It works on any element or pseudo-element set to display: list-item, such as the <li> and <summary> elements."},{name:"::part",status:"experimental",browsers:["E79","FF72","S13.1","C73","O60"],references:[{name:"MDN Reference",url:"https://developer.mozilla.org/docs/Web/CSS/::part"}],description:"The ::part CSS pseudo-element represents any element within a shadow tree that has a matching part attribute."},{name:"::placeholder",browsers:["E79","FF51","S10.1","C57","O44"],references:[{name:"MDN Reference",url:"https://developer.mozilla.org/docs/Web/CSS/::placeholder"}],description:"The ::placeholder CSS pseudo-element represents the placeholder text of a form element."},{name:"::slotted",browsers:["E79","FF63","S10","C50","O37"],references:[{name:"MDN Reference",url:"https://developer.mozilla.org/docs/Web/CSS/::slotted"}],description:"The :slotted() CSS pseudo-element represents any element that has been placed into a slot inside an HTML template."},{name:"::spelling-error",status:"experimental",references:[{name:"MDN Reference",url:"https://developer.mozilla.org/docs/Web/CSS/::spelling-error"}],description:"The ::spelling-error CSS pseudo-element represents a text segment which the user agent has flagged as incorrectly spelled."},{name:"::view-transition",status:"experimental",browsers:["E111","C111","O97"],references:[{name:"MDN Reference",url:"https://developer.mozilla.org/docs/Web/CSS/::view-transition"}],description:"The ::view-transition CSS pseudo-element represents the root of the view transitions overlay, which contains all view transitions and sits over the top of all other page content."},{name:"::view-transition-group",status:"experimental",browsers:["E111","C111","O97"],references:[{name:"MDN Reference",url:"https://developer.mozilla.org/docs/Web/CSS/::view-transition-group"}],description:"The ::view-transition-group CSS pseudo-element represents a single view transition group."},{name:"::view-transition-image-pair",status:"experimental",browsers:["E111","C111","O97"],references:[{name:"MDN Reference",url:"https://developer.mozilla.org/docs/Web/CSS/::view-transition-image-pair"}],description:`The ::view-transition-image-pair CSS pseudo-element represents a container for a view transition's "old" and "new" view states \u2014 before and after the transition.`},{name:"::view-transition-new",status:"experimental",browsers:["E111","C111","O97"],references:[{name:"MDN Reference",url:"https://developer.mozilla.org/docs/Web/CSS/::view-transition-new"}],description:'The ::view-transition-new CSS pseudo-element represents the "new" view state of a view transition \u2014 a live representation of the new view, after the transition.'},{name:"::view-transition-old",status:"experimental",browsers:["E111","C111","O97"],references:[{name:"MDN Reference",url:"https://developer.mozilla.org/docs/Web/CSS/::view-transition-old"}],description:'The ::view-transition-old CSS pseudo-element represents the "old" view state of a view transition \u2014 a static screenshot of the old view, before the transition.'}]};var Vi=class{constructor(e){this._properties=[],this._atDirectives=[],this._pseudoClasses=[],this._pseudoElements=[],this.addData(e)}provideProperties(){return this._properties}provideAtDirectives(){return this._atDirectives}providePseudoClasses(){return this._pseudoClasses}providePseudoElements(){return this._pseudoElements}addData(e){if(Array.isArray(e.properties))for(let n of e.properties)Rv(n)&&this._properties.push(n);if(Array.isArray(e.atDirectives))for(let n of e.atDirectives)Tv(n)&&this._atDirectives.push(n);if(Array.isArray(e.pseudoClasses))for(let n of e.pseudoClasses)Iv(n)&&this._pseudoClasses.push(n);if(Array.isArray(e.pseudoElements))for(let n of e.pseudoElements)Pv(n)&&this._pseudoElements.push(n)}};function Rv(t){return typeof t.name=="string"}function Tv(t){return typeof t.name=="string"}function Iv(t){return typeof t.name=="string"}function Pv(t){return typeof t.name=="string"}var $o=class{constructor(e){this.dataProviders=[],this._propertySet={},this._atDirectiveSet={},this._pseudoClassSet={},this._pseudoElementSet={},this._properties=[],this._atDirectives=[],this._pseudoClasses=[],this._pseudoElements=[],this.setDataProviders(e?.useDefaultDataProvider!==!1,e?.customDataProviders||[])}setDataProviders(e,n){this.dataProviders=[],e&&this.dataProviders.push(new Vi(Dl)),this.dataProviders.push(...n),this.collectData()}collectData(){this._propertySet={},this._atDirectiveSet={},this._pseudoClassSet={},this._pseudoElementSet={},this.dataProviders.forEach(e=>{e.provideProperties().forEach(n=>{this._propertySet[n.name]||(this._propertySet[n.name]=n)}),e.provideAtDirectives().forEach(n=>{this._atDirectiveSet[n.name]||(this._atDirectiveSet[n.name]=n)}),e.providePseudoClasses().forEach(n=>{this._pseudoClassSet[n.name]||(this._pseudoClassSet[n.name]=n)}),e.providePseudoElements().forEach(n=>{this._pseudoElementSet[n.name]||(this._pseudoElementSet[n.name]=n)})}),this._properties=Fi(this._propertySet),this._atDirectives=Fi(this._atDirectiveSet),this._pseudoClasses=Fi(this._pseudoClassSet),this._pseudoElements=Fi(this._pseudoElementSet)}getProperty(e){return this._propertySet[e]}getAtDirective(e){return this._atDirectiveSet[e]}getPseudoClass(e){return this._pseudoClassSet[e]}getPseudoElement(e){return this._pseudoElementSet[e]}getProperties(){return this._properties}getAtDirectives(){return this._atDirectives}getPseudoClasses(){return this._pseudoClasses}getPseudoElements(){return this._pseudoElements}isKnownProperty(e){return e.toLowerCase()in this._propertySet}isStandardProperty(e){return this.isKnownProperty(e)&&(!this._propertySet[e.toLowerCase()].status||this._propertySet[e.toLowerCase()].status==="standard")}};function cu(t,e,n){function r(s){let o=i(s),c;for(let a=o.length-1;a>=0;a--)c=x.SelectionRange.create(x.Range.create(t.positionAt(o[a][0]),t.positionAt(o[a][1])),c);return c||(c=x.SelectionRange.create(x.Range.create(s,s))),c}return e.map(r);function i(s){let o=t.offsetAt(s),c=n.findChildAtOffset(o,!0);if(!c)return[];let a=[];for(;c;){if(c.parent&&c.offset===c.parent.offset&&c.end===c.parent.end){c=c.parent;continue}c.type===R.Declarations&&o>c.offset&&o<c.end&&a.push([c.offset+1,c.end-1]),a.push([c.offset,c.end]),c=c.parent}return a}}function Mv(t,e,n,r,i,s,o){return{configure:c=>{s.configure(c),e.configure(c?.completion),n.configure(c?.hover)},setDataProviders:o.setDataProviders.bind(o),doValidation:s.doValidation.bind(s),parseStylesheet:t.parseStylesheet.bind(t),doComplete:e.doComplete.bind(e),doComplete2:e.doComplete2.bind(e),setCompletionParticipants:e.setCompletionParticipants.bind(e),doHover:n.doHover.bind(n),format:au,findDefinition:r.findDefinition.bind(r),findReferences:r.findReferences.bind(r),findDocumentHighlights:r.findDocumentHighlights.bind(r),findDocumentLinks:r.findDocumentLinks.bind(r),findDocumentLinks2:r.findDocumentLinks2.bind(r),findDocumentSymbols:r.findSymbolInformations.bind(r),findDocumentSymbols2:r.findDocumentSymbols.bind(r),doCodeActions:i.doCodeActions.bind(i),doCodeActions2:i.doCodeActions2.bind(i),findDocumentColors:r.findDocumentColors.bind(r),getColorPresentations:r.getColorPresentations.bind(r),prepareRename:r.prepareRename.bind(r),doRename:r.doRename.bind(r),getFoldingRanges:tu,getSelectionRanges:cu}}var zv={};function lu(t=zv){let e=new $o(t);return Mv(new Lr,new Nn(null,t,e),new Mo(t&&t.clientCapabilities,e),new Ni(t&&t.fileSystemProvider,!1),new No(e),new qo(e),e)}var An=st(Bc());var Hi=st(du());function hu(t,e,n){let r={},i=0,s;return e>0&&(s=setInterval(()=>{let o=Date.now()-e*1e3,c=Object.keys(r);for(let a of c)r[a].cTime<o&&(delete r[a],i--)},e*1e3)),{get(o){let c=o.version,a=o.languageId,l=r[o.uri];if(l&&l.version===c&&l.languageId===a)return l.cTime=Date.now(),l.languageModel;let d=n(o);if(r[o.uri]={languageModel:d,version:c,languageId:a,cTime:Date.now()},l||i++,i===t){let p=Number.MAX_VALUE,g=null;for(let C in r){let O=r[C];O.cTime<p&&(g=C,p=O.cTime)}g&&(delete r[g],i--)}return d},onDocumentRemoved(o){let c=o.uri;r[c]&&(delete r[c],i--)},dispose(){typeof s<"u"&&(clearInterval(s),s=void 0,r={},i=0)}}}var fu=st(uu());var Bo="\u2118";function Uo(t=0){return(e,n)=>{let r=n.split(`
|
115
115
|
`);return r.length>1?`@media(${Bo})${`
|
116
|
-
`.repeat(r.length-1)}${" ".repeat(r[r.length-1].length)}{`:`@media(${Bo})${" ".repeat(n.length+t)}{`}}function Vo(t=0){return(e,n)
|
116
|
+
`.repeat(r.length-1)}${" ".repeat(r[r.length-1].length)}{`:`@media(${Bo})${" ".repeat(n.length+t)}{`}}function Vo(t=0){return(e,n,r)=>{let i="_".repeat(n.length),s=" ".repeat(r.length+t);return`.${i}${s}{`}}function mu(t){return t=t.replace(/@layer\s+[^;{]+(;|$)/g,""),t=t.replace(/@screen(\s+[^{]+){/g,Uo(-2)),t=t.replace(/@variants(\s+[^{]+){/g,Uo()),t=t.replace(/@responsive(\s*){/g,Uo()),t=t.replace(/@(utility)(\s+[^{]+){/g,Vo()),t=t.replace(/@(theme)(\s+[^{]*){/g,Vo()),t=t.replace(/@(custom-variant)(\s+[^;{]+);/g,(e,n)=>{let r=" ".repeat(e.length-n.length+3);return`@media(${Bo})${r}{}`}),t=t.replace(/@(custom-variant)(\s+[^{]+){/g,Vo()),t=t.replace(/@(variant)(\s+[^{]+){/g,Vo()),t=t.replace(/@layer(\s+[^{]{2,}){/g,Uo(-3)),t=t.replace(/@reference\s*([^;]{2,})/g,"@import $1"),t=t.replace(/@media(\s+screen\s*\([^)]+\))/g,(e,n)=>`@media (${Bo})${" ".repeat(n.length-4)}`),t=t.replace(/@import(\s*)("(?:[^"]+)"|'(?:[^']+)')\s*(.*?)(?=;|$)/g,(e,n,r,i)=>(i=i.replace(/((source|theme|prefix)\([^)]+\)\s*)+?/g,""),`@import${n}"${r.slice(1,-1)}" ${i}`)),t=t.replace(/(?<=\b(?:theme|config)\([^)]*)[.[\]]/g,"_"),t=t.replace(/--(value|modifier)\((.*?)\)/g,e=>e.replace(/[*]/g,"_")),t=t.replace(/--([a-zA-Z0-9-*]*)/g,e=>e.replace(/[*]/g,"_")),t}var Ho=class{constructor(e){this.connection=e;this.documents=new An.TextDocuments(qr)}setup(){let e=this.connection,n=this.documents,r=lu(),i,s=Number.MAX_VALUE,o="\u2118",c=hu(10,60,b=>r.parseStylesheet(b));n.onDidOpen(({document:b})=>{e.sendNotification("@/tailwindCSS/documentReady",{uri:b.uri})}),n.onDidClose(({document:b})=>{c.onDocumentRemoved(b)}),e.onShutdown(()=>{c.dispose()}),e.onInitialize(b=>(i=b.workspaceFolders,Array.isArray(i)||(i=[],b.rootPath&&i.push({name:"",uri:Hi.URI.file(b.rootPath).toString()})),s=(0,fu.default)(b.capabilities,"textDocument.foldingRange.rangeLimit",Number.MAX_VALUE),{capabilities:{textDocumentSync:An.TextDocumentSyncKind.Full,completionProvider:{resolveProvider:!1,triggerCharacters:["/","-",":"]},hoverProvider:!0,foldingRangeProvider:!0,colorProvider:{},definitionProvider:!0,documentHighlightProvider:!0,documentSymbolProvider:!0,selectionRangeProvider:!0,referencesProvider:!0,codeActionProvider:!0,documentLinkProvider:{resolveProvider:!1},renameProvider:!0}}));function a(b,I){function A(){for(let K of I){let B=K.uri;if(B.endsWith("/")||(B=B+"/"),b.startsWith(B))return B}}return{resolveReference:(K,B=b)=>{if(K[0]==="/"){let W=A();if(W)return W+K.substr(1)}return B=B.substr(0,B.lastIndexOf("/")+1),Hi.Utils.resolvePath(Hi.URI.parse(B),K).toString()}}}async function l(b,I){let A=n.get(b);return A?await I({document:F(A),settings:await p(A)}):null}e.onCompletion(async({textDocument:b,position:I},A)=>l(b.uri,async({document:K,settings:B})=>{let W=await r.doComplete2(K,I,c.get(K),a(K.uri,i),B?.completion);return{isIncomplete:W.isIncomplete,items:W.items.flatMap(_=>_.kind===An.CompletionItemKind.Function&&_.label==="calc()"?[_,{..._,label:"theme()",filterText:"theme",documentation:{kind:"markdown",value:"Use the `theme()` function to access your Tailwind config values using dot notation."},command:{title:"",command:"editor.action.triggerSuggest"},textEdit:{..._.textEdit,newText:_.textEdit.newText.replace(/^calc\(/,"theme(")}}]:_)}})),e.onHover(({textDocument:b,position:I},A)=>l(b.uri,({document:K,settings:B})=>r.doHover(K,I,c.get(K),B?.hover))),e.onFoldingRanges(({textDocument:b},I)=>l(b.uri,({document:A})=>r.getFoldingRanges(A,{rangeLimit:s}))),e.onDocumentColor(({textDocument:b})=>l(b.uri,({document:I})=>r.findDocumentColors(I,c.get(I)))),e.onColorPresentation(({textDocument:b,color:I,range:A})=>l(b.uri,({document:K})=>r.getColorPresentations(K,c.get(K),I,A))),e.onDefinition(({textDocument:b,position:I})=>l(b.uri,({document:A})=>r.findDefinition(A,I,c.get(A)))),e.onDocumentHighlight(({textDocument:b,position:I})=>l(b.uri,({document:A})=>r.findDocumentHighlights(A,I,c.get(A)))),e.onDocumentSymbol(({textDocument:b})=>l(b.uri,({document:I})=>r.findDocumentSymbols(I,c.get(I)).map(A=>{if(A.name===`@media (${o})`){let W=n.get(A.location.uri).getText(A.location.range).trim().match(/^(@[^\s]+)(?:([^{]+)[{]|([^;{]+);)/);W&&(A.name=`${W[1]} ${W[2]?.trim()??W[3]?.trim()}`)}else if(/^\._+$/.test(A.name)){let W=n.get(A.location.uri).getText(A.location.range).trim().match(/^(@[^\s]+)(?:([^{]+)[{]|([^;{]+);)/);W&&(A.name=`${W[1]} ${W[2]?.trim()??W[3]?.trim()}`)}return A}))),e.onSelectionRanges(({textDocument:b,positions:I})=>l(b.uri,({document:A})=>r.getSelectionRanges(A,I,c.get(A)))),e.onReferences(({textDocument:b,position:I})=>l(b.uri,({document:A})=>r.findReferences(A,I,c.get(A)))),e.onCodeAction(({textDocument:b,range:I,context:A})=>l(b.uri,({document:K})=>r.doCodeActions2(K,I,A,c.get(K)))),e.onDocumentLinks(({textDocument:b})=>l(b.uri,({document:I})=>r.findDocumentLinks2(I,c.get(I),a(I.uri,i)))),e.onRenameRequest(({textDocument:b,position:I,newName:A})=>l(b.uri,({document:K})=>r.doRename(K,I,A,c.get(K))));let d={};n.onDidClose(b=>{delete d[b.document.uri]});function p(b){let I=d[b.uri];if(!I){let A={items:[{scopeUri:b.uri,section:"css"}]};I=e.sendRequest(An.ConfigurationRequest.type,A).then(K=>K[0]),d[b.uri]=I}return I}e.onDidChangeConfiguration(b=>{g(b.settings.css)});function g(b){r.configure(b),d={},n.all().forEach(j)}let C={},O=500,P={setTimeout(b,I,...A){let K=setTimeout(b,I,...A);return{dispose:()=>clearTimeout(K)}}};n.onDidChangeContent(b=>{j(b.document)}),n.onDidClose(b=>{H(b.document),e.sendDiagnostics({uri:b.document.uri,diagnostics:[]})});function H(b){let I=C[b.uri];I&&(I.dispose(),delete C[b.uri])}function j(b){H(b),C[b.uri]=P.setTimeout(()=>{delete C[b.uri],y(b)},O)}function F(b){let I=mu(b.getText());return qr.create(b.uri,b.languageId,b.version,I)}async function y(b){b=F(b);let I=await p(b),A=r.doValidation(b,r.parseStylesheet(b),I).filter(K=>!(K.code==="unknownAtRules"&&/Unknown at rule @(tailwind|apply|config|theme|plugin|source|utility|variant|custom-variant|slot)/.test(K.message)));e.sendDiagnostics({uri:b.uri,diagnostics:A})}}listen(){this.documents.listen(this.connection),this.connection.listen()}};var gu=process.argv.length<=2?(0,Vr.createConnection)(Vr.ProposedFeatures.all,process.stdin,process.stdout):(0,Vr.createConnection)(Vr.ProposedFeatures.all);$h(console,gu);process.on("unhandledRejection",t=>{console.error("Unhandled exception",t)});var bu=new Ho(gu);bu.setup();bu.listen();
|