@master/css-language-service 2.0.0-rc.28 → 2.0.0-rc.29
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/core.cjs +66 -6
- package/dist/core.mjs +66 -6
- package/dist/settings.cjs +29 -83
- package/dist/settings.d.ts +4 -2
- package/dist/settings.mjs +29 -83
- package/dist/utils/get-color-completion-items.cjs +1 -1
- package/dist/utils/get-color-completion-items.mjs +1 -1
- package/dist/utils/get-value-completion-items.cjs +1 -1
- package/dist/utils/get-value-completion-items.mjs +1 -1
- package/package.json +1 -1
package/dist/core.cjs
CHANGED
|
@@ -45,7 +45,7 @@ class CSSLanguageService extends EventEmitter {
|
|
|
45
45
|
character: 0
|
|
46
46
|
}) ?? undefined;
|
|
47
47
|
const text = textDocument.getText().substring(startIndex, endIndex);
|
|
48
|
-
const {
|
|
48
|
+
const { classAttributeBindings, classAttributes, classDeclarations, classFunctions } = this.settings;
|
|
49
49
|
const normalizeClassNamePosition = (className, attrStart, escapeCharacter)=>{
|
|
50
50
|
/**
|
|
51
51
|
* Matching classes, including empty string after white space
|
|
@@ -82,7 +82,7 @@ class CSSLanguageService extends EventEmitter {
|
|
|
82
82
|
// eslint-disable-next-line prefer-const
|
|
83
83
|
let [eachPattern, start, end] = eachClassMatcher;
|
|
84
84
|
end = end ?? start;
|
|
85
|
-
for (const eachClassPostioinMatch of text.matchAll(new RegExp(
|
|
85
|
+
for (const eachClassPostioinMatch of text.matchAll(new RegExp(`(?:\\s|\\.)${eachPattern}${escapeRegexp(start)}`, 'g'))){
|
|
86
86
|
if (eachClassPostioinMatch.index === undefined) continue;
|
|
87
87
|
const eachClassAttributeString = eachClassPostioinMatch[0];
|
|
88
88
|
const eachAttrStart = eachClassPostioinMatch.index + eachClassAttributeString.length;
|
|
@@ -97,10 +97,59 @@ class CSSLanguageService extends EventEmitter {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
+
const stringExpressions = [];
|
|
101
|
+
const assignmentExpressions = [];
|
|
102
|
+
classAttributes?.forEach((eachClassAttribute)=>{
|
|
103
|
+
stringExpressions.push([
|
|
104
|
+
eachClassAttribute + '=',
|
|
105
|
+
'"',
|
|
106
|
+
'"'
|
|
107
|
+
], [
|
|
108
|
+
eachClassAttribute + '=',
|
|
109
|
+
'\'',
|
|
110
|
+
'\''
|
|
111
|
+
]);
|
|
112
|
+
});
|
|
113
|
+
classDeclarations?.forEach((eachClassDeclaration)=>{
|
|
114
|
+
stringExpressions.push([
|
|
115
|
+
eachClassDeclaration + '(?:\\s+)?(?::|=)(?:\\s+)?',
|
|
116
|
+
'"',
|
|
117
|
+
'"'
|
|
118
|
+
], [
|
|
119
|
+
eachClassDeclaration + '(?:\\s+)?(?::|=)(?:\\s+)?',
|
|
120
|
+
'`',
|
|
121
|
+
'`'
|
|
122
|
+
], [
|
|
123
|
+
eachClassDeclaration + '(?:\\s+)?(?::|=)(?:\\s+)?',
|
|
124
|
+
'\'',
|
|
125
|
+
'\''
|
|
126
|
+
]);
|
|
127
|
+
assignmentExpressions.push([
|
|
128
|
+
eachClassDeclaration + '(?:\\s+)?(?::|=)(?:\\s+)?',
|
|
129
|
+
'{',
|
|
130
|
+
'}'
|
|
131
|
+
]);
|
|
132
|
+
});
|
|
133
|
+
classFunctions?.forEach((eachClassFunction)=>{
|
|
134
|
+
/**
|
|
135
|
+
* @example clsx`class-a class-b`
|
|
136
|
+
*/ stringExpressions.push([
|
|
137
|
+
eachClassFunction,
|
|
138
|
+
'`',
|
|
139
|
+
'`'
|
|
140
|
+
]);
|
|
141
|
+
/**
|
|
142
|
+
* @example clsx('class-a class-b')
|
|
143
|
+
*/ assignmentExpressions.push([
|
|
144
|
+
eachClassFunction,
|
|
145
|
+
'(',
|
|
146
|
+
')'
|
|
147
|
+
]);
|
|
148
|
+
});
|
|
100
149
|
/**
|
|
101
150
|
* @example <div class=""></div>
|
|
102
|
-
* */ if (
|
|
103
|
-
const classPosition = resolve(
|
|
151
|
+
* */ if (stringExpressions?.length) {
|
|
152
|
+
const classPosition = resolve(stringExpressions, (eachAttrStart, eachClassPositionEnd, [eachPattern, pair])=>{
|
|
104
153
|
const eachClassName = text.substring(eachAttrStart, eachClassPositionEnd);
|
|
105
154
|
/**
|
|
106
155
|
* @example <div class=""></div>
|
|
@@ -120,12 +169,23 @@ class CSSLanguageService extends EventEmitter {
|
|
|
120
169
|
});
|
|
121
170
|
if (classPosition) return classPosition;
|
|
122
171
|
}
|
|
172
|
+
if (classAttributeBindings) {
|
|
173
|
+
for(const eachClassAttribute in classAttributeBindings){
|
|
174
|
+
const eachClassAttributeBinding = classAttributeBindings[eachClassAttribute];
|
|
175
|
+
if (eachClassAttributeBinding === false) continue;
|
|
176
|
+
assignmentExpressions.push([
|
|
177
|
+
eachClassAttribute + '=',
|
|
178
|
+
eachClassAttributeBinding[0],
|
|
179
|
+
eachClassAttributeBinding[1]
|
|
180
|
+
]);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
123
183
|
/**
|
|
124
184
|
* attribute binding
|
|
125
185
|
* @example <div className={''}></div>
|
|
126
186
|
* @example <div :class="isActive ? 'block' : 'hidden'"></div>
|
|
127
|
-
* */ if (
|
|
128
|
-
const classPosition = resolve(
|
|
187
|
+
* */ if (assignmentExpressions?.length) {
|
|
188
|
+
const classPosition = resolve(assignmentExpressions, (eachAttrStart, eachClassPositionEnd, eachClassMatcher)=>{
|
|
129
189
|
const eachClassPositionExpression = text.substring(eachAttrStart, eachClassPositionEnd);
|
|
130
190
|
/**
|
|
131
191
|
* @example <div className={""}></div>
|
package/dist/core.mjs
CHANGED
|
@@ -43,7 +43,7 @@ class CSSLanguageService extends EventEmitter {
|
|
|
43
43
|
character: 0
|
|
44
44
|
}) ?? undefined;
|
|
45
45
|
const text = textDocument.getText().substring(startIndex, endIndex);
|
|
46
|
-
const {
|
|
46
|
+
const { classAttributeBindings, classAttributes, classDeclarations, classFunctions } = this.settings;
|
|
47
47
|
const normalizeClassNamePosition = (className, attrStart, escapeCharacter)=>{
|
|
48
48
|
/**
|
|
49
49
|
* Matching classes, including empty string after white space
|
|
@@ -80,7 +80,7 @@ class CSSLanguageService extends EventEmitter {
|
|
|
80
80
|
// eslint-disable-next-line prefer-const
|
|
81
81
|
let [eachPattern, start, end] = eachClassMatcher;
|
|
82
82
|
end = end ?? start;
|
|
83
|
-
for (const eachClassPostioinMatch of text.matchAll(new RegExp(
|
|
83
|
+
for (const eachClassPostioinMatch of text.matchAll(new RegExp(`(?:\\s|\\.)${eachPattern}${escapeRegexp(start)}`, 'g'))){
|
|
84
84
|
if (eachClassPostioinMatch.index === undefined) continue;
|
|
85
85
|
const eachClassAttributeString = eachClassPostioinMatch[0];
|
|
86
86
|
const eachAttrStart = eachClassPostioinMatch.index + eachClassAttributeString.length;
|
|
@@ -95,10 +95,59 @@ class CSSLanguageService extends EventEmitter {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
+
const stringExpressions = [];
|
|
99
|
+
const assignmentExpressions = [];
|
|
100
|
+
classAttributes?.forEach((eachClassAttribute)=>{
|
|
101
|
+
stringExpressions.push([
|
|
102
|
+
eachClassAttribute + '=',
|
|
103
|
+
'"',
|
|
104
|
+
'"'
|
|
105
|
+
], [
|
|
106
|
+
eachClassAttribute + '=',
|
|
107
|
+
'\'',
|
|
108
|
+
'\''
|
|
109
|
+
]);
|
|
110
|
+
});
|
|
111
|
+
classDeclarations?.forEach((eachClassDeclaration)=>{
|
|
112
|
+
stringExpressions.push([
|
|
113
|
+
eachClassDeclaration + '(?:\\s+)?(?::|=)(?:\\s+)?',
|
|
114
|
+
'"',
|
|
115
|
+
'"'
|
|
116
|
+
], [
|
|
117
|
+
eachClassDeclaration + '(?:\\s+)?(?::|=)(?:\\s+)?',
|
|
118
|
+
'`',
|
|
119
|
+
'`'
|
|
120
|
+
], [
|
|
121
|
+
eachClassDeclaration + '(?:\\s+)?(?::|=)(?:\\s+)?',
|
|
122
|
+
'\'',
|
|
123
|
+
'\''
|
|
124
|
+
]);
|
|
125
|
+
assignmentExpressions.push([
|
|
126
|
+
eachClassDeclaration + '(?:\\s+)?(?::|=)(?:\\s+)?',
|
|
127
|
+
'{',
|
|
128
|
+
'}'
|
|
129
|
+
]);
|
|
130
|
+
});
|
|
131
|
+
classFunctions?.forEach((eachClassFunction)=>{
|
|
132
|
+
/**
|
|
133
|
+
* @example clsx`class-a class-b`
|
|
134
|
+
*/ stringExpressions.push([
|
|
135
|
+
eachClassFunction,
|
|
136
|
+
'`',
|
|
137
|
+
'`'
|
|
138
|
+
]);
|
|
139
|
+
/**
|
|
140
|
+
* @example clsx('class-a class-b')
|
|
141
|
+
*/ assignmentExpressions.push([
|
|
142
|
+
eachClassFunction,
|
|
143
|
+
'(',
|
|
144
|
+
')'
|
|
145
|
+
]);
|
|
146
|
+
});
|
|
98
147
|
/**
|
|
99
148
|
* @example <div class=""></div>
|
|
100
|
-
* */ if (
|
|
101
|
-
const classPosition = resolve(
|
|
149
|
+
* */ if (stringExpressions?.length) {
|
|
150
|
+
const classPosition = resolve(stringExpressions, (eachAttrStart, eachClassPositionEnd, [eachPattern, pair])=>{
|
|
102
151
|
const eachClassName = text.substring(eachAttrStart, eachClassPositionEnd);
|
|
103
152
|
/**
|
|
104
153
|
* @example <div class=""></div>
|
|
@@ -118,12 +167,23 @@ class CSSLanguageService extends EventEmitter {
|
|
|
118
167
|
});
|
|
119
168
|
if (classPosition) return classPosition;
|
|
120
169
|
}
|
|
170
|
+
if (classAttributeBindings) {
|
|
171
|
+
for(const eachClassAttribute in classAttributeBindings){
|
|
172
|
+
const eachClassAttributeBinding = classAttributeBindings[eachClassAttribute];
|
|
173
|
+
if (eachClassAttributeBinding === false) continue;
|
|
174
|
+
assignmentExpressions.push([
|
|
175
|
+
eachClassAttribute + '=',
|
|
176
|
+
eachClassAttributeBinding[0],
|
|
177
|
+
eachClassAttributeBinding[1]
|
|
178
|
+
]);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
121
181
|
/**
|
|
122
182
|
* attribute binding
|
|
123
183
|
* @example <div className={''}></div>
|
|
124
184
|
* @example <div :class="isActive ? 'block' : 'hidden'"></div>
|
|
125
|
-
* */ if (
|
|
126
|
-
const classPosition = resolve(
|
|
185
|
+
* */ if (assignmentExpressions?.length) {
|
|
186
|
+
const classPosition = resolve(assignmentExpressions, (eachAttrStart, eachClassPositionEnd, eachClassMatcher)=>{
|
|
127
187
|
const eachClassPositionExpression = text.substring(eachAttrStart, eachClassPositionEnd);
|
|
128
188
|
/**
|
|
129
189
|
* @example <div className={""}></div>
|
package/dist/settings.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var css = require('@master/css');
|
|
4
|
+
|
|
5
|
+
/**
|
|
4
6
|
* @example styles https://regex101.com/r/HLPdsw/1
|
|
5
7
|
**/ const settings = {
|
|
6
8
|
includedLanguages: [
|
|
@@ -18,112 +20,56 @@
|
|
|
18
20
|
"mdx",
|
|
19
21
|
"astro"
|
|
20
22
|
],
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
[
|
|
31
|
-
"\\sclassName=",
|
|
32
|
-
"\""
|
|
33
|
-
],
|
|
34
|
-
[
|
|
35
|
-
"\\sclassName=",
|
|
36
|
-
"'"
|
|
37
|
-
],
|
|
38
|
-
[
|
|
39
|
-
"\\sstyled(?:\\s+)?(?:\\.\\w+)?",
|
|
40
|
-
"`"
|
|
41
|
-
],
|
|
42
|
-
[
|
|
43
|
-
"\\sstyles(?:\\s+)?(?::|=)(?:\\s+)?",
|
|
44
|
-
"\""
|
|
45
|
-
],
|
|
46
|
-
[
|
|
47
|
-
"\\sstyles(?:\\s+)?(?::|=)(?:\\s+)?",
|
|
48
|
-
"'"
|
|
49
|
-
],
|
|
50
|
-
[
|
|
51
|
-
"\\sstyles(?:\\s+)?(?::|=)(?:\\s+)?",
|
|
52
|
-
"`"
|
|
53
|
-
]
|
|
54
|
-
],
|
|
55
|
-
classAssignments: [
|
|
56
|
-
[
|
|
57
|
-
"\\sclassName=",
|
|
58
|
-
"{",
|
|
59
|
-
"}"
|
|
60
|
-
],
|
|
61
|
-
[
|
|
62
|
-
"\\sclass=",
|
|
23
|
+
/**
|
|
24
|
+
* @example <div class="a b">
|
|
25
|
+
* @example <div className="a b">
|
|
26
|
+
*/ classAttributes: css.CLASS_ATTRIBUTES,
|
|
27
|
+
/**
|
|
28
|
+
* @example <div class={active ? 'a' : 'b'}>
|
|
29
|
+
* @example <div className={active ? 'a' : 'b'}>
|
|
30
|
+
*/ classAttributeBindings: {
|
|
31
|
+
"className": [
|
|
63
32
|
"{",
|
|
64
33
|
"}"
|
|
65
34
|
],
|
|
66
|
-
[
|
|
67
|
-
"\\sclass:list=",
|
|
35
|
+
"class": [
|
|
68
36
|
"{",
|
|
69
37
|
"}"
|
|
70
38
|
],
|
|
71
|
-
[
|
|
72
|
-
"\\sstyles(?:\\s+)?(?::|=)(?:\\s+)?",
|
|
39
|
+
"class:list": [
|
|
73
40
|
"{",
|
|
74
41
|
"}"
|
|
75
42
|
],
|
|
76
|
-
[
|
|
77
|
-
"\\s:class=",
|
|
43
|
+
":class": [
|
|
78
44
|
"\"",
|
|
79
45
|
"\""
|
|
80
46
|
],
|
|
81
|
-
[
|
|
82
|
-
"\\sv-bind:class=",
|
|
47
|
+
"v-bind:class": [
|
|
83
48
|
"\"",
|
|
84
49
|
"\""
|
|
85
50
|
],
|
|
86
|
-
[
|
|
87
|
-
"\\s[class]=",
|
|
51
|
+
"[class]": [
|
|
88
52
|
"\"",
|
|
89
53
|
"\""
|
|
90
54
|
],
|
|
91
|
-
[
|
|
92
|
-
"\\s[className]=",
|
|
55
|
+
"[className]": [
|
|
93
56
|
"\"",
|
|
94
57
|
"\""
|
|
95
58
|
],
|
|
96
|
-
[
|
|
97
|
-
"\\s[ngClass]=",
|
|
59
|
+
"[ngClass]": [
|
|
98
60
|
"\"",
|
|
99
61
|
"\""
|
|
100
|
-
],
|
|
101
|
-
[
|
|
102
|
-
"\\sclsx",
|
|
103
|
-
"(",
|
|
104
|
-
")"
|
|
105
|
-
],
|
|
106
|
-
[
|
|
107
|
-
"\\scva",
|
|
108
|
-
"(",
|
|
109
|
-
")"
|
|
110
|
-
],
|
|
111
|
-
[
|
|
112
|
-
"\\.class",
|
|
113
|
-
"(",
|
|
114
|
-
")"
|
|
115
|
-
],
|
|
116
|
-
[
|
|
117
|
-
"\\sstyled(?:\\s+)?(?:\\.\\w+)?",
|
|
118
|
-
"(",
|
|
119
|
-
")"
|
|
120
|
-
],
|
|
121
|
-
[
|
|
122
|
-
"\\.classList(?:\\s+)?(?:\\.(add|remove|toggle|replace))",
|
|
123
|
-
"(",
|
|
124
|
-
")"
|
|
125
62
|
]
|
|
126
|
-
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* @example const styles = 'a b'
|
|
66
|
+
* @example { styles: { btn: 'a b' } }
|
|
67
|
+
*/ classDeclarations: css.CLASS_DECLARATIONS,
|
|
68
|
+
/**
|
|
69
|
+
* @example clsx('a b')
|
|
70
|
+
* @example styled`a b`
|
|
71
|
+
* @example .classList.add('a')
|
|
72
|
+
*/ classFunctions: css.CLASS_FUNCTIONS,
|
|
127
73
|
exclude: [
|
|
128
74
|
"**/.git/**",
|
|
129
75
|
"**/node_modules/**",
|
package/dist/settings.d.ts
CHANGED
|
@@ -6,8 +6,10 @@ declare const settings: Settings;
|
|
|
6
6
|
export default settings;
|
|
7
7
|
export declare type Settings = {
|
|
8
8
|
includedLanguages?: string[];
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
classAttributes?: string[];
|
|
10
|
+
classFunctions?: string[];
|
|
11
|
+
classDeclarations?: string[];
|
|
12
|
+
classAttributeBindings?: Record<string, [string, string] | false>;
|
|
11
13
|
exclude?: string[];
|
|
12
14
|
config?: Config;
|
|
13
15
|
suggestSyntax?: boolean;
|
package/dist/settings.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { CLASS_ATTRIBUTES, CLASS_DECLARATIONS, CLASS_FUNCTIONS } from '@master/css';
|
|
2
|
+
|
|
3
|
+
/**
|
|
2
4
|
* @example styles https://regex101.com/r/HLPdsw/1
|
|
3
5
|
**/ const settings = {
|
|
4
6
|
includedLanguages: [
|
|
@@ -16,112 +18,56 @@
|
|
|
16
18
|
"mdx",
|
|
17
19
|
"astro"
|
|
18
20
|
],
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
[
|
|
29
|
-
"\\sclassName=",
|
|
30
|
-
"\""
|
|
31
|
-
],
|
|
32
|
-
[
|
|
33
|
-
"\\sclassName=",
|
|
34
|
-
"'"
|
|
35
|
-
],
|
|
36
|
-
[
|
|
37
|
-
"\\sstyled(?:\\s+)?(?:\\.\\w+)?",
|
|
38
|
-
"`"
|
|
39
|
-
],
|
|
40
|
-
[
|
|
41
|
-
"\\sstyles(?:\\s+)?(?::|=)(?:\\s+)?",
|
|
42
|
-
"\""
|
|
43
|
-
],
|
|
44
|
-
[
|
|
45
|
-
"\\sstyles(?:\\s+)?(?::|=)(?:\\s+)?",
|
|
46
|
-
"'"
|
|
47
|
-
],
|
|
48
|
-
[
|
|
49
|
-
"\\sstyles(?:\\s+)?(?::|=)(?:\\s+)?",
|
|
50
|
-
"`"
|
|
51
|
-
]
|
|
52
|
-
],
|
|
53
|
-
classAssignments: [
|
|
54
|
-
[
|
|
55
|
-
"\\sclassName=",
|
|
56
|
-
"{",
|
|
57
|
-
"}"
|
|
58
|
-
],
|
|
59
|
-
[
|
|
60
|
-
"\\sclass=",
|
|
21
|
+
/**
|
|
22
|
+
* @example <div class="a b">
|
|
23
|
+
* @example <div className="a b">
|
|
24
|
+
*/ classAttributes: CLASS_ATTRIBUTES,
|
|
25
|
+
/**
|
|
26
|
+
* @example <div class={active ? 'a' : 'b'}>
|
|
27
|
+
* @example <div className={active ? 'a' : 'b'}>
|
|
28
|
+
*/ classAttributeBindings: {
|
|
29
|
+
"className": [
|
|
61
30
|
"{",
|
|
62
31
|
"}"
|
|
63
32
|
],
|
|
64
|
-
[
|
|
65
|
-
"\\sclass:list=",
|
|
33
|
+
"class": [
|
|
66
34
|
"{",
|
|
67
35
|
"}"
|
|
68
36
|
],
|
|
69
|
-
[
|
|
70
|
-
"\\sstyles(?:\\s+)?(?::|=)(?:\\s+)?",
|
|
37
|
+
"class:list": [
|
|
71
38
|
"{",
|
|
72
39
|
"}"
|
|
73
40
|
],
|
|
74
|
-
[
|
|
75
|
-
"\\s:class=",
|
|
41
|
+
":class": [
|
|
76
42
|
"\"",
|
|
77
43
|
"\""
|
|
78
44
|
],
|
|
79
|
-
[
|
|
80
|
-
"\\sv-bind:class=",
|
|
45
|
+
"v-bind:class": [
|
|
81
46
|
"\"",
|
|
82
47
|
"\""
|
|
83
48
|
],
|
|
84
|
-
[
|
|
85
|
-
"\\s[class]=",
|
|
49
|
+
"[class]": [
|
|
86
50
|
"\"",
|
|
87
51
|
"\""
|
|
88
52
|
],
|
|
89
|
-
[
|
|
90
|
-
"\\s[className]=",
|
|
53
|
+
"[className]": [
|
|
91
54
|
"\"",
|
|
92
55
|
"\""
|
|
93
56
|
],
|
|
94
|
-
[
|
|
95
|
-
"\\s[ngClass]=",
|
|
57
|
+
"[ngClass]": [
|
|
96
58
|
"\"",
|
|
97
59
|
"\""
|
|
98
|
-
],
|
|
99
|
-
[
|
|
100
|
-
"\\sclsx",
|
|
101
|
-
"(",
|
|
102
|
-
")"
|
|
103
|
-
],
|
|
104
|
-
[
|
|
105
|
-
"\\scva",
|
|
106
|
-
"(",
|
|
107
|
-
")"
|
|
108
|
-
],
|
|
109
|
-
[
|
|
110
|
-
"\\.class",
|
|
111
|
-
"(",
|
|
112
|
-
")"
|
|
113
|
-
],
|
|
114
|
-
[
|
|
115
|
-
"\\sstyled(?:\\s+)?(?:\\.\\w+)?",
|
|
116
|
-
"(",
|
|
117
|
-
")"
|
|
118
|
-
],
|
|
119
|
-
[
|
|
120
|
-
"\\.classList(?:\\s+)?(?:\\.(add|remove|toggle|replace))",
|
|
121
|
-
"(",
|
|
122
|
-
")"
|
|
123
60
|
]
|
|
124
|
-
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* @example const styles = 'a b'
|
|
64
|
+
* @example { styles: { btn: 'a b' } }
|
|
65
|
+
*/ classDeclarations: CLASS_DECLARATIONS,
|
|
66
|
+
/**
|
|
67
|
+
* @example clsx('a b')
|
|
68
|
+
* @example styled`a b`
|
|
69
|
+
* @example .classList.add('a')
|
|
70
|
+
*/ classFunctions: CLASS_FUNCTIONS,
|
|
125
71
|
exclude: [
|
|
126
72
|
"**/.git/**",
|
|
127
73
|
"**/node_modules/**",
|
|
@@ -9,7 +9,7 @@ function getColorCompletionItems(css$1 = new css.MasterCSS()) {
|
|
|
9
9
|
for(const eachVariableName in css$1.variables){
|
|
10
10
|
const eachVariable = css$1.variables[eachVariableName];
|
|
11
11
|
if (eachVariable.type === 'color') {
|
|
12
|
-
// todo: packages/
|
|
12
|
+
// todo: packages/core should support getTextByVariable(variable)
|
|
13
13
|
const valueToken = eachVariable.space && eachVariable.value ? `${eachVariable.space}(${eachVariable.value})` : eachVariable.value;
|
|
14
14
|
completionItems.push({
|
|
15
15
|
label: eachVariableName,
|
|
@@ -7,7 +7,7 @@ function getColorCompletionItems(css = new MasterCSS()) {
|
|
|
7
7
|
for(const eachVariableName in css.variables){
|
|
8
8
|
const eachVariable = css.variables[eachVariableName];
|
|
9
9
|
if (eachVariable.type === 'color') {
|
|
10
|
-
// todo: packages/
|
|
10
|
+
// todo: packages/core should support getTextByVariable(variable)
|
|
11
11
|
const valueToken = eachVariable.space && eachVariable.value ? `${eachVariable.space}(${eachVariable.value})` : eachVariable.value;
|
|
12
12
|
completionItems.push({
|
|
13
13
|
label: eachVariableName,
|
|
@@ -52,7 +52,7 @@ function getValueCompletionItems(css$1 = new css.MasterCSS(), ruleKey) {
|
|
|
52
52
|
completionItem.kind = vscodeLanguageserverProtocol.CompletionItemKind.Color;
|
|
53
53
|
completionItem.detail = variable.name;
|
|
54
54
|
} else {
|
|
55
|
-
// todo: packages/
|
|
55
|
+
// todo: packages/core should support getTextByVariable(variable)
|
|
56
56
|
const configKey = 'variables.' + (variable.group ? variable.group + '.' + variable.key : variable.name);
|
|
57
57
|
const valueToken = variable.space && variable.value ? `${variable.space}(${variable.value.split(' ').join(',')})` : variable.value;
|
|
58
58
|
// detail is shown in the detail pane
|
|
@@ -50,7 +50,7 @@ function getValueCompletionItems(css = new MasterCSS(), ruleKey) {
|
|
|
50
50
|
completionItem.kind = CompletionItemKind.Color;
|
|
51
51
|
completionItem.detail = variable.name;
|
|
52
52
|
} else {
|
|
53
|
-
// todo: packages/
|
|
53
|
+
// todo: packages/core should support getTextByVariable(variable)
|
|
54
54
|
const configKey = 'variables.' + (variable.group ? variable.group + '.' + variable.key : variable.name);
|
|
55
55
|
const valueToken = variable.space && variable.value ? `${variable.space}(${variable.value.split(' ').join(',')})` : variable.value;
|
|
56
56
|
// detail is shown in the detail pane
|
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 src","test":"jest"},"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.24.1","@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 src","test":"jest"},"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.24.1","@master/css":"^2.0.0-rc.29","@techor/extend":"^3.0.18","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":"^9.0.3","pex-color":"^2.1.0","vscode-css-languageservice":"^6.2.13","vscode-languageserver-protocol":"^3.17.5","vscode-languageserver-textdocument":"^1.0.11"},"devDependencies":{"@types/chroma-js":"^2.4.4","@types/color-convert":"^2.0.3","@types/color-rgba":"^2.1.2","@types/culori":"^2.1.0","@types/lodash.escaperegexp":"^4.1.9","@types/vscode":"^1.87.0","@master/css-shared":"^2.0.0-rc.29","vscode-languageserver":"^7.0.0"},"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":{".":{"import":"./dist/index.mjs","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"version":"2.0.0-rc.29"}
|