@master/css-language-service 2.0.0-rc.57 → 2.0.0-rc.59
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/dist/features/inspect-syntax.cjs +1 -1
- package/dist/features/inspect-syntax.mjs +1 -1
- package/dist/utils/get-color-completion-items.cjs +2 -3
- package/dist/utils/get-color-completion-items.mjs +2 -3
- package/dist/utils/get-main-completion-items.cjs +8 -7
- package/dist/utils/get-main-completion-items.mjs +8 -7
- package/dist/utils/get-query-completion-items.cjs +1 -1
- package/dist/utils/get-query-completion-items.mjs +1 -1
- package/dist/utils/get-value-completion-items.cjs +4 -5
- package/dist/utils/get-value-completion-items.mjs +4 -5
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ function inspectSyntax(document, position) {
|
|
|
13
13
|
start: document.positionAt(classPosition.range.start),
|
|
14
14
|
end: document.positionAt(classPosition.range.end)
|
|
15
15
|
};
|
|
16
|
-
const componentClasses = this.css.components
|
|
16
|
+
const componentClasses = this.css.components.get(token);
|
|
17
17
|
if (componentClasses) {
|
|
18
18
|
const documentation = getCssDataDocumentation.getCSSDataDocumentation({}, {
|
|
19
19
|
generatedCSS: css.generateCSS([
|
|
@@ -11,7 +11,7 @@ function inspectSyntax(document, position) {
|
|
|
11
11
|
start: document.positionAt(classPosition.range.start),
|
|
12
12
|
end: document.positionAt(classPosition.range.end)
|
|
13
13
|
};
|
|
14
|
-
const componentClasses = this.css.components
|
|
14
|
+
const componentClasses = this.css.components.get(token);
|
|
15
15
|
if (componentClasses) {
|
|
16
16
|
const documentation = getCSSDataDocumentation({}, {
|
|
17
17
|
generatedCSS: generateCSS([
|
|
@@ -6,8 +6,7 @@ var sortCompletionItems = require('./sort-completion-items.cjs');
|
|
|
6
6
|
|
|
7
7
|
function getColorCompletionItems(css$1 = new css.MasterCSS()) {
|
|
8
8
|
const completionItems = [];
|
|
9
|
-
|
|
10
|
-
const eachVariable = css$1.variables[eachVariableName];
|
|
9
|
+
css$1.variables.forEach((eachVariable, eachVariableName)=>{
|
|
11
10
|
if (eachVariable.type === 'color') {
|
|
12
11
|
// todo: packages/core should support getTextByVariable(variable)
|
|
13
12
|
const valueToken = eachVariable.space && eachVariable.value ? `${eachVariable.space}(${eachVariable.value})` : eachVariable.value;
|
|
@@ -23,7 +22,7 @@ function getColorCompletionItems(css$1 = new css.MasterCSS()) {
|
|
|
23
22
|
sortText: eachVariableName.replace(/(.+?)-(\d+)/, (match, prefix, num)=>prefix + '-' + ('00000' + num).slice(-5))
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
|
-
}
|
|
25
|
+
});
|
|
27
26
|
return sortCompletionItems(completionItems);
|
|
28
27
|
}
|
|
29
28
|
|
|
@@ -4,8 +4,7 @@ import sortCompletionItems from './sort-completion-items.mjs';
|
|
|
4
4
|
|
|
5
5
|
function getColorCompletionItems(css = new MasterCSS()) {
|
|
6
6
|
const completionItems = [];
|
|
7
|
-
|
|
8
|
-
const eachVariable = css.variables[eachVariableName];
|
|
7
|
+
css.variables.forEach((eachVariable, eachVariableName)=>{
|
|
9
8
|
if (eachVariable.type === 'color') {
|
|
10
9
|
// todo: packages/core should support getTextByVariable(variable)
|
|
11
10
|
const valueToken = eachVariable.space && eachVariable.value ? `${eachVariable.space}(${eachVariable.value})` : eachVariable.value;
|
|
@@ -21,7 +20,7 @@ function getColorCompletionItems(css = new MasterCSS()) {
|
|
|
21
20
|
sortText: eachVariableName.replace(/(.+?)-(\d+)/, (match, prefix, num)=>prefix + '-' + ('00000' + num).slice(-5))
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
|
-
}
|
|
23
|
+
});
|
|
25
24
|
return sortCompletionItems(completionItems);
|
|
26
25
|
}
|
|
27
26
|
|
|
@@ -50,13 +50,13 @@ function getMainCompletionItems(css$1 = new css.MasterCSS()) {
|
|
|
50
50
|
/**
|
|
51
51
|
* @example @ animation and ~ transition
|
|
52
52
|
*/ if (eachDefinedRule.definition?.sign && eachDefinedRule.definition.includeAnimations) {
|
|
53
|
-
|
|
53
|
+
css$1.animations.forEach((animation, animationName)=>{
|
|
54
54
|
completionItems.push({
|
|
55
55
|
...eachCompletionItem,
|
|
56
56
|
label: eachDefinedRule.definition.sign + animationName + '|1s',
|
|
57
57
|
kind: vscodeLanguageserverProtocol.CompletionItemKind.Value
|
|
58
58
|
});
|
|
59
|
-
}
|
|
59
|
+
});
|
|
60
60
|
}
|
|
61
61
|
if (eachDefinedRule.definition?.ambiguousKeys?.length) {
|
|
62
62
|
for (const ambiguousKey of eachDefinedRule.definition.ambiguousKeys){
|
|
@@ -84,18 +84,19 @@ function getMainCompletionItems(css$1 = new css.MasterCSS()) {
|
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
86
|
if (css$1.config.components) {
|
|
87
|
-
for(const
|
|
88
|
-
const
|
|
87
|
+
for(const componentClass in css$1.config.components){
|
|
88
|
+
const componentTokens = css$1.components.get(componentClass);
|
|
89
|
+
if (!componentTokens) continue;
|
|
89
90
|
completionItems.push({
|
|
90
|
-
label:
|
|
91
|
+
label: componentClass,
|
|
91
92
|
kind: vscodeLanguageserverProtocol.CompletionItemKind.Value,
|
|
92
93
|
documentation: getCssDataDocumentation.getCSSDataDocumentation({}, {
|
|
93
94
|
generatedCSS: css.generateCSS([
|
|
94
|
-
|
|
95
|
+
componentClass
|
|
95
96
|
], css$1),
|
|
96
97
|
docs: '/guide/components'
|
|
97
98
|
}),
|
|
98
|
-
detail:
|
|
99
|
+
detail: componentTokens.join(' ') + ' (style)'
|
|
99
100
|
});
|
|
100
101
|
}
|
|
101
102
|
}
|
|
@@ -48,13 +48,13 @@ function getMainCompletionItems(css = new MasterCSS()) {
|
|
|
48
48
|
/**
|
|
49
49
|
* @example @ animation and ~ transition
|
|
50
50
|
*/ if (eachDefinedRule.definition?.sign && eachDefinedRule.definition.includeAnimations) {
|
|
51
|
-
|
|
51
|
+
css.animations.forEach((animation, animationName)=>{
|
|
52
52
|
completionItems.push({
|
|
53
53
|
...eachCompletionItem,
|
|
54
54
|
label: eachDefinedRule.definition.sign + animationName + '|1s',
|
|
55
55
|
kind: CompletionItemKind.Value
|
|
56
56
|
});
|
|
57
|
-
}
|
|
57
|
+
});
|
|
58
58
|
}
|
|
59
59
|
if (eachDefinedRule.definition?.ambiguousKeys?.length) {
|
|
60
60
|
for (const ambiguousKey of eachDefinedRule.definition.ambiguousKeys){
|
|
@@ -82,18 +82,19 @@ function getMainCompletionItems(css = new MasterCSS()) {
|
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
84
|
if (css.config.components) {
|
|
85
|
-
for(const
|
|
86
|
-
const
|
|
85
|
+
for(const componentClass in css.config.components){
|
|
86
|
+
const componentTokens = css.components.get(componentClass);
|
|
87
|
+
if (!componentTokens) continue;
|
|
87
88
|
completionItems.push({
|
|
88
|
-
label:
|
|
89
|
+
label: componentClass,
|
|
89
90
|
kind: CompletionItemKind.Value,
|
|
90
91
|
documentation: getCSSDataDocumentation({}, {
|
|
91
92
|
generatedCSS: generateCSS([
|
|
92
|
-
|
|
93
|
+
componentClass
|
|
93
94
|
], css),
|
|
94
95
|
docs: '/guide/components'
|
|
95
96
|
}),
|
|
96
|
-
detail:
|
|
97
|
+
detail: componentTokens.join(' ') + ' (style)'
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
100
|
}
|
|
@@ -34,7 +34,7 @@ function getQueryCompletionItems(css$1 = new css.MasterCSS(), triggerCharacter =
|
|
|
34
34
|
})
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
css$1.at.forEach((value, name)=>{
|
|
38
38
|
const completionItem = {
|
|
39
39
|
filterText: name,
|
|
40
40
|
insertText: name,
|
|
@@ -96,7 +96,7 @@ function getValueCompletionItems(css$1 = new css.MasterCSS(), ruleKey) {
|
|
|
96
96
|
/**
|
|
97
97
|
* @example animation:fade
|
|
98
98
|
*/ if (eachDefinedRule.keys.includes(ruleKey) && eachDefinedRule.definition.includeAnimations) {
|
|
99
|
-
|
|
99
|
+
css$1.animations.forEach((animation, animationName)=>{
|
|
100
100
|
const isNative = eachDefinedRule.definition.type && [
|
|
101
101
|
css.SyntaxRuleType.Native,
|
|
102
102
|
css.SyntaxRuleType.NativeShorthand
|
|
@@ -112,7 +112,7 @@ function getValueCompletionItems(css$1 = new css.MasterCSS(), ruleKey) {
|
|
|
112
112
|
}),
|
|
113
113
|
detail: isNative ? eachDefinedRule.id + ': ' + animationName : animationName
|
|
114
114
|
});
|
|
115
|
-
}
|
|
115
|
+
});
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* Ambiguous values
|
|
@@ -170,15 +170,14 @@ function getValueCompletionItems(css$1 = new css.MasterCSS(), ruleKey) {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
// global variables
|
|
173
|
-
|
|
174
|
-
const variable = css$1.variables[variableName];
|
|
173
|
+
css$1.variables.forEach((variable)=>{
|
|
175
174
|
const completionItem = generateVariableCompletionItem(variable);
|
|
176
175
|
if (completionItem) {
|
|
177
176
|
completionItem.sortText = GLOBAL_VARIABLE_PRIORITY + (completionItem.sortText || completionItem.label);
|
|
178
177
|
completionItem.detail = '(global) ' + completionItem.detail;
|
|
179
178
|
completionItems.push(completionItem);
|
|
180
179
|
}
|
|
181
|
-
}
|
|
180
|
+
});
|
|
182
181
|
return sortCompletionItems(completionItems);
|
|
183
182
|
}
|
|
184
183
|
|
|
@@ -94,7 +94,7 @@ function getValueCompletionItems(css = new MasterCSS(), ruleKey) {
|
|
|
94
94
|
/**
|
|
95
95
|
* @example animation:fade
|
|
96
96
|
*/ if (eachDefinedRule.keys.includes(ruleKey) && eachDefinedRule.definition.includeAnimations) {
|
|
97
|
-
|
|
97
|
+
css.animations.forEach((animation, animationName)=>{
|
|
98
98
|
const isNative = eachDefinedRule.definition.type && [
|
|
99
99
|
SyntaxRuleType.Native,
|
|
100
100
|
SyntaxRuleType.NativeShorthand
|
|
@@ -110,7 +110,7 @@ function getValueCompletionItems(css = new MasterCSS(), ruleKey) {
|
|
|
110
110
|
}),
|
|
111
111
|
detail: isNative ? eachDefinedRule.id + ': ' + animationName : animationName
|
|
112
112
|
});
|
|
113
|
-
}
|
|
113
|
+
});
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
116
|
* Ambiguous values
|
|
@@ -168,15 +168,14 @@ function getValueCompletionItems(css = new MasterCSS(), ruleKey) {
|
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
// global variables
|
|
171
|
-
|
|
172
|
-
const variable = css.variables[variableName];
|
|
171
|
+
css.variables.forEach((variable)=>{
|
|
173
172
|
const completionItem = generateVariableCompletionItem(variable);
|
|
174
173
|
if (completionItem) {
|
|
175
174
|
completionItem.sortText = GLOBAL_VARIABLE_PRIORITY + (completionItem.sortText || completionItem.label);
|
|
176
175
|
completionItem.detail = '(global) ' + completionItem.detail;
|
|
177
176
|
completionItems.push(completionItem);
|
|
178
177
|
}
|
|
179
|
-
}
|
|
178
|
+
});
|
|
180
179
|
return sortCompletionItems(completionItems);
|
|
181
180
|
}
|
|
182
181
|
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@master/css-language-service","type":"module","scripts":{"build":"techor build \"src/**/*.ts\"","dev":"pnpm build --watch","type-check":"tsc --noEmit","lint":"eslint","test":"vitest"},"description":"Master CSS Language Service","author":"Aoyue Design LLC.","license":"MIT","repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/language-service"},"dependencies":{"@babel/parser":"^7.26.3","@master/css":"^2.0.0-rc.
|
|
1
|
+
{"name":"@master/css-language-service","type":"module","scripts":{"build":"techor build \"src/**/*.ts\"","dev":"pnpm build --watch","type-check":"tsc --noEmit","lint":"eslint","test":"vitest"},"description":"Master CSS Language Service","author":"Aoyue Design LLC.","license":"MIT","repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/language-service"},"dependencies":{"@babel/parser":"^7.26.3","@master/css":"^2.0.0-rc.59","@techor/extend":"^3.2.0","color-convert":"^2.0.1","color-rgba":"^3.0.0","color-space":"^2.0.1","culori":"^4.0.1","js-beautify":"^1.15.1","lodash.escaperegexp":"^4.1.2","minimatch":"^10.0.1","pex-color":"^2.2.0","vscode-css-languageservice":"^6.3.2","vscode-languageserver-protocol":"^3.17.5","vscode-languageserver-textdocument":"^1.0.12"},"devDependencies":{"@types/chroma-js":"^2.4.5","@types/color-convert":"^2.0.4","@types/color-rgba":"^2.1.3","@types/culori":"^2.1.1","@types/lodash.escaperegexp":"^4.1.9","@types/vscode":"^1.96.0","shared":"^2.0.0-rc.59","vscode-languageserver":"^9.0.1"},"sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.mjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"version":"2.0.0-rc.59"}
|