tailwind-typescript-plugin 1.4.1-beta.2 → 1.4.1-beta.20
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/CHANGELOG.md +123 -0
- package/README.md +375 -77
- package/lib/core/interfaces.d.ts +23 -12
- package/lib/core/interfaces.d.ts.map +1 -1
- package/lib/core/types.d.ts +112 -1
- package/lib/core/types.d.ts.map +1 -1
- package/lib/extractors/BaseExtractor.d.ts +49 -2
- package/lib/extractors/BaseExtractor.d.ts.map +1 -1
- package/lib/extractors/BaseExtractor.js +184 -5
- package/lib/extractors/BaseExtractor.js.map +1 -1
- package/lib/extractors/CvaExtractor.js +1 -1
- package/lib/extractors/CvaExtractor.js.map +1 -1
- package/lib/extractors/ExpressionExtractor.d.ts.map +1 -1
- package/lib/extractors/ExpressionExtractor.js +35 -5
- package/lib/extractors/ExpressionExtractor.js.map +1 -1
- package/lib/extractors/JsxAttributeExtractor.d.ts +2 -1
- package/lib/extractors/JsxAttributeExtractor.d.ts.map +1 -1
- package/lib/extractors/JsxAttributeExtractor.js +15 -8
- package/lib/extractors/JsxAttributeExtractor.js.map +1 -1
- package/lib/extractors/SvelteAttributeExtractor.d.ts +17 -0
- package/lib/extractors/SvelteAttributeExtractor.d.ts.map +1 -0
- package/lib/extractors/SvelteAttributeExtractor.js +27 -0
- package/lib/extractors/SvelteAttributeExtractor.js.map +1 -0
- package/lib/extractors/TailwindVariantsExtractor.d.ts.map +1 -1
- package/lib/extractors/TailwindVariantsExtractor.js +1 -5
- package/lib/extractors/TailwindVariantsExtractor.js.map +1 -1
- package/lib/extractors/VariableReferenceExtractor.d.ts.map +1 -1
- package/lib/extractors/VariableReferenceExtractor.js +21 -0
- package/lib/extractors/VariableReferenceExtractor.js.map +1 -1
- package/lib/extractors/VueAttributeExtractor.d.ts +119 -0
- package/lib/extractors/VueAttributeExtractor.d.ts.map +1 -0
- package/lib/extractors/VueAttributeExtractor.js +911 -0
- package/lib/extractors/VueAttributeExtractor.js.map +1 -0
- package/lib/extractors/VueExpressionExtractor.d.ts +21 -0
- package/lib/extractors/VueExpressionExtractor.d.ts.map +1 -0
- package/lib/extractors/VueExpressionExtractor.js +51 -0
- package/lib/extractors/VueExpressionExtractor.js.map +1 -0
- package/lib/infrastructure/TailwindConflictDetector.d.ts +28 -18
- package/lib/infrastructure/TailwindConflictDetector.d.ts.map +1 -1
- package/lib/infrastructure/TailwindConflictDetector.js +216 -486
- package/lib/infrastructure/TailwindConflictDetector.js.map +1 -1
- package/lib/infrastructure/TailwindValidator.css-vars.spec.js +1 -11
- package/lib/infrastructure/TailwindValidator.css-vars.spec.js.map +1 -1
- package/lib/infrastructure/TailwindValidator.d.ts +16 -3
- package/lib/infrastructure/TailwindValidator.d.ts.map +1 -1
- package/lib/infrastructure/TailwindValidator.js +83 -24
- package/lib/infrastructure/TailwindValidator.js.map +1 -1
- package/lib/infrastructure/TailwindValidator.spec.js +50 -17
- package/lib/infrastructure/TailwindValidator.spec.js.map +1 -1
- package/lib/plugin/TailwindTypescriptPlugin.d.ts +18 -1
- package/lib/plugin/TailwindTypescriptPlugin.d.ts.map +1 -1
- package/lib/plugin/TailwindTypescriptPlugin.js +124 -55
- package/lib/plugin/TailwindTypescriptPlugin.js.map +1 -1
- package/lib/services/ClassNameExtractionService.d.ts +21 -5
- package/lib/services/ClassNameExtractionService.d.ts.map +1 -1
- package/lib/services/ClassNameExtractionService.js +76 -14
- package/lib/services/ClassNameExtractionService.js.map +1 -1
- package/lib/services/ClassNameExtractionService.spec.d.ts +2 -0
- package/lib/services/ClassNameExtractionService.spec.d.ts.map +1 -0
- package/lib/services/ClassNameExtractionService.spec.js +222 -0
- package/lib/services/ClassNameExtractionService.spec.js.map +1 -0
- package/lib/services/CodeActionService.spec.js +1 -2
- package/lib/services/CodeActionService.spec.js.map +1 -1
- package/lib/services/CompletionService.d.ts +121 -0
- package/lib/services/CompletionService.d.ts.map +1 -0
- package/lib/services/CompletionService.js +573 -0
- package/lib/services/CompletionService.js.map +1 -0
- package/lib/services/CompletionService.spec.d.ts +2 -0
- package/lib/services/CompletionService.spec.d.ts.map +1 -0
- package/lib/services/CompletionService.spec.js +1182 -0
- package/lib/services/CompletionService.spec.js.map +1 -0
- package/lib/services/ConflictClassDetection.spec.js +26 -21
- package/lib/services/ConflictClassDetection.spec.js.map +1 -1
- package/lib/services/DiagnosticService.d.ts +8 -8
- package/lib/services/DiagnosticService.d.ts.map +1 -1
- package/lib/services/DiagnosticService.js +29 -13
- package/lib/services/DiagnosticService.js.map +1 -1
- package/lib/services/DuplicateClassDetection.spec.js +61 -81
- package/lib/services/DuplicateClassDetection.spec.js.map +1 -1
- package/lib/services/PluginConfigService.d.ts +47 -15
- package/lib/services/PluginConfigService.d.ts.map +1 -1
- package/lib/services/PluginConfigService.js +203 -75
- package/lib/services/PluginConfigService.js.map +1 -1
- package/lib/services/PluginConfigService.spec.d.ts +2 -0
- package/lib/services/PluginConfigService.spec.d.ts.map +1 -0
- package/lib/services/PluginConfigService.spec.js +93 -0
- package/lib/services/PluginConfigService.spec.js.map +1 -0
- package/lib/services/ValidationService.d.ts +8 -5
- package/lib/services/ValidationService.d.ts.map +1 -1
- package/lib/services/ValidationService.js +49 -49
- package/lib/services/ValidationService.js.map +1 -1
- package/lib/utils/FrameworkDetector.d.ts +24 -0
- package/lib/utils/FrameworkDetector.d.ts.map +1 -0
- package/lib/utils/FrameworkDetector.js +52 -0
- package/lib/utils/FrameworkDetector.js.map +1 -0
- package/lib/utils/FrameworkDetector.spec.d.ts +2 -0
- package/lib/utils/FrameworkDetector.spec.d.ts.map +1 -0
- package/lib/utils/FrameworkDetector.spec.js +75 -0
- package/lib/utils/FrameworkDetector.spec.js.map +1 -0
- package/package.json +4 -2
- package/lib/extractors/StringLiteralExtractor.d.ts +0 -12
- package/lib/extractors/StringLiteralExtractor.d.ts.map +0 -1
- package/lib/extractors/StringLiteralExtractor.js +0 -21
- package/lib/extractors/StringLiteralExtractor.js.map +0 -1
- package/lib/services/ClassNameExtractionService.original.d.ts +0 -20
- package/lib/services/ClassNameExtractionService.original.d.ts.map +0 -1
- package/lib/services/ClassNameExtractionService.original.js +0 -48
- package/lib/services/ClassNameExtractionService.original.js.map +0 -1
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompletionService = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Service that provides autocompletion for Tailwind CSS class names
|
|
6
|
+
*
|
|
7
|
+
* Provides completions when:
|
|
8
|
+
* - Cursor is inside a className attribute's string literal
|
|
9
|
+
* - Cursor is inside a utility function argument (clsx, cn, classnames, etc.)
|
|
10
|
+
* - Cursor is inside tv() or cva() class strings
|
|
11
|
+
*
|
|
12
|
+
* Features:
|
|
13
|
+
* - Filters completions based on what's already typed
|
|
14
|
+
* - Excludes classes already present in the same className
|
|
15
|
+
* - Handles space-separated class lists properly
|
|
16
|
+
*/
|
|
17
|
+
class CompletionService {
|
|
18
|
+
constructor(validator, config) {
|
|
19
|
+
this.validator = validator;
|
|
20
|
+
this.config = config;
|
|
21
|
+
/** Cached sorted class list for faster completion generation */
|
|
22
|
+
this.cachedClassList = null;
|
|
23
|
+
// Build a set of utility function names for quick lookup
|
|
24
|
+
this.utilityFunctionNames = new Set(config.utilityFunctions.map(f => (typeof f === 'string' ? f : f.name)));
|
|
25
|
+
// Add variant functions based on config
|
|
26
|
+
if (config.tailwindVariantsEnabled) {
|
|
27
|
+
this.utilityFunctionNames.add('tv');
|
|
28
|
+
}
|
|
29
|
+
if (config.classVarianceAuthorityEnabled) {
|
|
30
|
+
this.utilityFunctionNames.add('cva');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get completions at the given position
|
|
35
|
+
*/
|
|
36
|
+
getCompletionsAtPosition(typescript, sourceFile, position, existingCompletions) {
|
|
37
|
+
const context = this.getCompletionContext(typescript, sourceFile, position);
|
|
38
|
+
if (!context.isInClassNameContext) {
|
|
39
|
+
return existingCompletions;
|
|
40
|
+
}
|
|
41
|
+
const tailwindCompletions = this.generateCompletions(typescript, context);
|
|
42
|
+
if (tailwindCompletions.length === 0) {
|
|
43
|
+
return existingCompletions;
|
|
44
|
+
}
|
|
45
|
+
// Create completion info with Tailwind classes
|
|
46
|
+
const completionInfo = {
|
|
47
|
+
isGlobalCompletion: false,
|
|
48
|
+
isMemberCompletion: false,
|
|
49
|
+
isNewIdentifierLocation: false,
|
|
50
|
+
entries: tailwindCompletions
|
|
51
|
+
};
|
|
52
|
+
return completionInfo;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get quick info (hover) at position for Tailwind class names
|
|
56
|
+
* Shows the CSS generated by the class when hovering over it
|
|
57
|
+
*/
|
|
58
|
+
getQuickInfoAtPosition(typescript, sourceFile, position) {
|
|
59
|
+
// Find the class name at the cursor position
|
|
60
|
+
const classInfo = this.findClassNameAtPosition(typescript, sourceFile, position);
|
|
61
|
+
if (!classInfo) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
const { className, start, length } = classInfo;
|
|
65
|
+
// Get the CSS for this class
|
|
66
|
+
const cssResults = this.validator.getCssForClasses([className]);
|
|
67
|
+
const css = cssResults[0];
|
|
68
|
+
if (!css) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
// Format the CSS with proper structure
|
|
72
|
+
const formattedCss = this.formatCssForDisplay(css);
|
|
73
|
+
// Extract just the declarations for the display (short summary)
|
|
74
|
+
const declarations = this.extractCssDeclarations(css);
|
|
75
|
+
// Check if this is a color class for the icon
|
|
76
|
+
const isColor = this.isColorClass(className);
|
|
77
|
+
return {
|
|
78
|
+
kind: typescript.ScriptElementKind.string,
|
|
79
|
+
kindModifiers: isColor ? 'color' : '',
|
|
80
|
+
textSpan: {
|
|
81
|
+
start,
|
|
82
|
+
length
|
|
83
|
+
},
|
|
84
|
+
displayParts: [{ kind: 'text', text: declarations }],
|
|
85
|
+
documentation: [
|
|
86
|
+
{
|
|
87
|
+
kind: 'text',
|
|
88
|
+
text: '```css\n' + formattedCss + '\n```'
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Find a Tailwind class name at the given position
|
|
95
|
+
* Returns the class name, its start position, and length if found
|
|
96
|
+
*/
|
|
97
|
+
findClassNameAtPosition(typescript, sourceFile, position) {
|
|
98
|
+
// Find the node at the current position
|
|
99
|
+
let node = this.findNodeAtPosition(typescript, sourceFile, position);
|
|
100
|
+
if (!node) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
// If we found a JsxAttribute, look for its string literal initializer
|
|
104
|
+
if (typescript.isJsxAttribute(node)) {
|
|
105
|
+
const initializer = node.initializer;
|
|
106
|
+
if (initializer && typescript.isStringLiteral(initializer)) {
|
|
107
|
+
node = initializer;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Check if we're in a string literal
|
|
111
|
+
if (!typescript.isStringLiteral(node) && !typescript.isNoSubstitutionTemplateLiteral(node)) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
// Check if this string is in a className context
|
|
115
|
+
if (!this.isClassNameContext(typescript, node)) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
// Get the string content and position info
|
|
119
|
+
const stringContent = node.text;
|
|
120
|
+
const stringStart = node.getStart(sourceFile) + 1; // +1 to skip the opening quote
|
|
121
|
+
const positionInString = position - stringStart;
|
|
122
|
+
// Handle cursor at or before string start
|
|
123
|
+
if (positionInString < 0 || positionInString > stringContent.length) {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
// Find word boundaries around the cursor position
|
|
127
|
+
// Classes are separated by whitespace
|
|
128
|
+
let wordStart = positionInString;
|
|
129
|
+
let wordEnd = positionInString;
|
|
130
|
+
// Find the start of the word
|
|
131
|
+
while (wordStart > 0 && stringContent[wordStart - 1] !== ' ') {
|
|
132
|
+
wordStart--;
|
|
133
|
+
}
|
|
134
|
+
// Find the end of the word
|
|
135
|
+
while (wordEnd < stringContent.length && stringContent[wordEnd] !== ' ') {
|
|
136
|
+
wordEnd++;
|
|
137
|
+
}
|
|
138
|
+
// Extract the class name
|
|
139
|
+
const className = stringContent.substring(wordStart, wordEnd);
|
|
140
|
+
// Validate it's a Tailwind class
|
|
141
|
+
if (!className || !this.isTailwindClass(className)) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
className,
|
|
146
|
+
start: stringStart + wordStart,
|
|
147
|
+
length: className.length
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get completion entry details for a specific completion item
|
|
152
|
+
* Formats the documentation with markdown CSS code blocks for syntax highlighting
|
|
153
|
+
*/
|
|
154
|
+
getCompletionEntryDetails(typescript, sourceFile, position, entryName) {
|
|
155
|
+
// Check if this is a Tailwind class completion
|
|
156
|
+
if (!this.isTailwindClass(entryName)) {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
// Get the CSS for this class
|
|
160
|
+
const cssResults = this.validator.getCssForClasses([entryName]);
|
|
161
|
+
const css = cssResults[0];
|
|
162
|
+
const documentation = [];
|
|
163
|
+
if (css) {
|
|
164
|
+
// Format the CSS with proper structure like Tailwind IntelliSense
|
|
165
|
+
const formattedCss = this.formatCssForDisplay(css);
|
|
166
|
+
// Use markdown code block for syntax highlighting
|
|
167
|
+
documentation.push({
|
|
168
|
+
kind: 'text',
|
|
169
|
+
text: '```css\n' + formattedCss + '\n```'
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
// Extract just the declarations for the detail (short summary)
|
|
173
|
+
const detail = css ? this.extractCssDeclarations(css) : undefined;
|
|
174
|
+
// Check if this is a color class for the icon
|
|
175
|
+
const isColor = this.isColorClass(entryName);
|
|
176
|
+
return {
|
|
177
|
+
name: entryName,
|
|
178
|
+
kind: typescript.ScriptElementKind.string,
|
|
179
|
+
// Set 'color' kindModifier for color classes so VS Code shows color icon
|
|
180
|
+
kindModifiers: isColor ? 'color' : '',
|
|
181
|
+
displayParts: detail ? [{ kind: 'text', text: detail }] : [{ kind: 'text', text: entryName }],
|
|
182
|
+
documentation
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Format CSS output for display in the completion documentation
|
|
187
|
+
* Transforms the raw Tailwind CSS output into a nicely formatted rule block
|
|
188
|
+
*/
|
|
189
|
+
formatCssForDisplay(css) {
|
|
190
|
+
// The CSS from Tailwind typically looks like:
|
|
191
|
+
// .flex { display: flex; }
|
|
192
|
+
// We want to format it nicely with proper indentation
|
|
193
|
+
// First, let's clean up and format the CSS
|
|
194
|
+
const formatted = css.trim();
|
|
195
|
+
// If it's already well-formatted, return as-is
|
|
196
|
+
if (formatted.includes('\n')) {
|
|
197
|
+
return formatted;
|
|
198
|
+
}
|
|
199
|
+
// Single-line CSS: format it nicely
|
|
200
|
+
// Match pattern: .selector { declarations }
|
|
201
|
+
const singleLineMatch = formatted.match(/^([^{]+)\{([^}]+)\}$/);
|
|
202
|
+
if (singleLineMatch) {
|
|
203
|
+
const selector = singleLineMatch[1].trim();
|
|
204
|
+
const declarations = singleLineMatch[2].trim();
|
|
205
|
+
// Split declarations and format each on its own line
|
|
206
|
+
const declParts = declarations
|
|
207
|
+
.split(';')
|
|
208
|
+
.map(d => d.trim())
|
|
209
|
+
.filter(d => d.length > 0);
|
|
210
|
+
if (declParts.length === 1) {
|
|
211
|
+
// Single declaration: keep on one line
|
|
212
|
+
return `${selector} {\n ${declParts[0]};\n}`;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
// Multiple declarations: each on its own line
|
|
216
|
+
const formattedDecls = declParts.map(d => ` ${d};`).join('\n');
|
|
217
|
+
return `${selector} {\n${formattedDecls}\n}`;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return formatted;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Extract just the CSS declarations from a CSS rule for the detail summary
|
|
224
|
+
* e.g., ".flex { display: flex; }" -> "display: flex;"
|
|
225
|
+
*/
|
|
226
|
+
extractCssDeclarations(css) {
|
|
227
|
+
// Match the content inside the curly braces
|
|
228
|
+
const match = css.match(/\{([^}]+)\}/);
|
|
229
|
+
if (match) {
|
|
230
|
+
// Clean up the declarations
|
|
231
|
+
return (match[1]
|
|
232
|
+
.trim()
|
|
233
|
+
.split(';')
|
|
234
|
+
.map(d => d.trim())
|
|
235
|
+
.filter(d => d.length > 0)
|
|
236
|
+
.join('; ') + ';');
|
|
237
|
+
}
|
|
238
|
+
return css.trim();
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Check if a name is a valid Tailwind class
|
|
242
|
+
*/
|
|
243
|
+
isTailwindClass(name) {
|
|
244
|
+
return this.validator.isValidClass(name);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Analyze the source file at the given position to determine completion context
|
|
248
|
+
*/
|
|
249
|
+
getCompletionContext(typescript, sourceFile, position) {
|
|
250
|
+
const defaultContext = {
|
|
251
|
+
isInClassNameContext: false,
|
|
252
|
+
currentPrefix: '',
|
|
253
|
+
prefixStart: position,
|
|
254
|
+
stringStart: position,
|
|
255
|
+
existingClasses: new Set()
|
|
256
|
+
};
|
|
257
|
+
// Find the node at the current position
|
|
258
|
+
let node = this.findNodeAtPosition(typescript, sourceFile, position);
|
|
259
|
+
if (!node) {
|
|
260
|
+
return defaultContext;
|
|
261
|
+
}
|
|
262
|
+
// If we found a JsxAttribute, look for its string literal initializer
|
|
263
|
+
if (typescript.isJsxAttribute(node)) {
|
|
264
|
+
const initializer = node.initializer;
|
|
265
|
+
if (initializer && typescript.isStringLiteral(initializer)) {
|
|
266
|
+
node = initializer;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
// Check if we're in a string literal
|
|
270
|
+
if (!typescript.isStringLiteral(node) && !typescript.isNoSubstitutionTemplateLiteral(node)) {
|
|
271
|
+
return defaultContext;
|
|
272
|
+
}
|
|
273
|
+
// Check if this string is in a className context
|
|
274
|
+
if (!this.isClassNameContext(typescript, node)) {
|
|
275
|
+
return defaultContext;
|
|
276
|
+
}
|
|
277
|
+
// We're in a className context! Now extract the completion details
|
|
278
|
+
const stringContent = node.text;
|
|
279
|
+
const stringStart = node.getStart(sourceFile) + 1; // +1 to skip the opening quote
|
|
280
|
+
const positionInString = position - stringStart;
|
|
281
|
+
// Handle cursor at or before string start
|
|
282
|
+
if (positionInString < 0) {
|
|
283
|
+
return defaultContext;
|
|
284
|
+
}
|
|
285
|
+
// Find the current "word" being typed (from last space to cursor)
|
|
286
|
+
const textBeforeCursor = stringContent.substring(0, positionInString);
|
|
287
|
+
const lastSpaceIndex = textBeforeCursor.lastIndexOf(' ');
|
|
288
|
+
const currentPrefix = lastSpaceIndex === -1 ? textBeforeCursor : textBeforeCursor.substring(lastSpaceIndex + 1);
|
|
289
|
+
const prefixStart = stringStart + (lastSpaceIndex === -1 ? 0 : lastSpaceIndex + 1);
|
|
290
|
+
// Get all existing classes in this attribute (for duplicate filtering)
|
|
291
|
+
const existingClasses = new Set(stringContent.split(/\s+/).filter(c => c.length > 0));
|
|
292
|
+
// Remove the current prefix from existing classes if it's a partial match
|
|
293
|
+
// (so we can still suggest completions for partially typed classes)
|
|
294
|
+
if (currentPrefix) {
|
|
295
|
+
existingClasses.delete(currentPrefix);
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
isInClassNameContext: true,
|
|
299
|
+
currentPrefix,
|
|
300
|
+
prefixStart,
|
|
301
|
+
stringStart,
|
|
302
|
+
existingClasses
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Find the deepest node at the given position
|
|
307
|
+
* Uses TypeScript's built-in method which handles edge cases better
|
|
308
|
+
*/
|
|
309
|
+
findNodeAtPosition(typescript, sourceFile, position) {
|
|
310
|
+
function find(node) {
|
|
311
|
+
// Use getStart without sourceFile to include trivia, which helps with edge positions
|
|
312
|
+
const start = node.getStart(sourceFile);
|
|
313
|
+
const end = node.getEnd();
|
|
314
|
+
// Position must be within the node's range (inclusive of end for completions)
|
|
315
|
+
if (position < start || position > end) {
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
// Check children first to find the deepest matching node
|
|
319
|
+
let result;
|
|
320
|
+
typescript.forEachChild(node, child => {
|
|
321
|
+
const found = find(child);
|
|
322
|
+
if (found) {
|
|
323
|
+
result = found;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
return result || node;
|
|
327
|
+
}
|
|
328
|
+
return find(sourceFile);
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Check if a string literal node is in a className-like context
|
|
332
|
+
*/
|
|
333
|
+
isClassNameContext(typescript, node) {
|
|
334
|
+
const parent = node.parent;
|
|
335
|
+
// Case 1: JSX attribute like className="..."
|
|
336
|
+
if (typescript.isJsxAttribute(parent)) {
|
|
337
|
+
const attrName = parent.name.getText();
|
|
338
|
+
return this.isClassNameAttribute(attrName);
|
|
339
|
+
}
|
|
340
|
+
// Case 2: Property assignment like { className: "..." }
|
|
341
|
+
// But only return true here - we need to fall through for properties inside tv()/cva() like base/variants
|
|
342
|
+
if (typescript.isPropertyAssignment(parent)) {
|
|
343
|
+
const propName = parent.name.getText();
|
|
344
|
+
if (this.isClassNameAttribute(propName)) {
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
// Fall through to check if this property is inside a utility function call
|
|
348
|
+
}
|
|
349
|
+
// Case 3: Inside a call expression (utility function like clsx, cn, etc.)
|
|
350
|
+
// Check parent chain for call expression
|
|
351
|
+
let current = node;
|
|
352
|
+
while (current.parent) {
|
|
353
|
+
current = current.parent;
|
|
354
|
+
if (typescript.isCallExpression(current)) {
|
|
355
|
+
const callName = this.getCallExpressionName(typescript, current);
|
|
356
|
+
if (callName && this.isUtilityFunction(callName)) {
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
// Case 4: Inside tv() or cva() variant definitions (property assignments within these calls)
|
|
361
|
+
if (typescript.isPropertyAssignment(current)) {
|
|
362
|
+
const parentCall = this.findParentCallExpression(typescript, current);
|
|
363
|
+
if (parentCall) {
|
|
364
|
+
const callName = this.getCallExpressionName(typescript, parentCall);
|
|
365
|
+
if (callName && this.isUtilityFunction(callName)) {
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// Stop at certain boundaries
|
|
371
|
+
if (typescript.isBlock(current) ||
|
|
372
|
+
typescript.isSourceFile(current) ||
|
|
373
|
+
typescript.isFunctionDeclaration(current) ||
|
|
374
|
+
typescript.isArrowFunction(current)) {
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return false;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Check if an attribute name is a className-like attribute
|
|
382
|
+
*/
|
|
383
|
+
isClassNameAttribute(name) {
|
|
384
|
+
const classNameAttributes = [
|
|
385
|
+
'className',
|
|
386
|
+
'class',
|
|
387
|
+
'classname', // case variations
|
|
388
|
+
'classList'
|
|
389
|
+
];
|
|
390
|
+
return classNameAttributes.includes(name) || classNameAttributes.includes(name.toLowerCase());
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Check if a function name is a configured utility function for class names
|
|
394
|
+
*/
|
|
395
|
+
isUtilityFunction(name) {
|
|
396
|
+
return this.utilityFunctionNames.has(name);
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Get the name of a call expression
|
|
400
|
+
*/
|
|
401
|
+
getCallExpressionName(typescript, callExpr) {
|
|
402
|
+
const expr = callExpr.expression;
|
|
403
|
+
if (typescript.isIdentifier(expr)) {
|
|
404
|
+
return expr.text;
|
|
405
|
+
}
|
|
406
|
+
if (typescript.isPropertyAccessExpression(expr)) {
|
|
407
|
+
return expr.name.text;
|
|
408
|
+
}
|
|
409
|
+
return undefined;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Find the parent call expression of a node
|
|
413
|
+
*/
|
|
414
|
+
findParentCallExpression(typescript, node) {
|
|
415
|
+
let current = node.parent;
|
|
416
|
+
while (current) {
|
|
417
|
+
if (typescript.isCallExpression(current)) {
|
|
418
|
+
return current;
|
|
419
|
+
}
|
|
420
|
+
if (typescript.isBlock(current) ||
|
|
421
|
+
typescript.isSourceFile(current) ||
|
|
422
|
+
typescript.isFunctionDeclaration(current)) {
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
current = current.parent;
|
|
426
|
+
}
|
|
427
|
+
return undefined;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Generate completion entries for Tailwind classes
|
|
431
|
+
*/
|
|
432
|
+
generateCompletions(typescript, context) {
|
|
433
|
+
// Get all classes from the validator
|
|
434
|
+
const allClasses = this.getClassList();
|
|
435
|
+
const prefix = context.currentPrefix.toLowerCase();
|
|
436
|
+
// Filter and create completion entries
|
|
437
|
+
const entries = [];
|
|
438
|
+
for (const className of allClasses) {
|
|
439
|
+
// Skip classes that are already in the attribute
|
|
440
|
+
if (context.existingClasses.has(className)) {
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
// Filter by prefix if one is being typed
|
|
444
|
+
if (prefix && !className.toLowerCase().startsWith(prefix)) {
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
// Check if this is a color-related class
|
|
448
|
+
const isColorClass = this.isColorClass(className);
|
|
449
|
+
entries.push({
|
|
450
|
+
name: className,
|
|
451
|
+
kind: typescript.ScriptElementKind.string,
|
|
452
|
+
// VS Code recognizes 'color' kindModifier and shows a color icon
|
|
453
|
+
kindModifiers: isColorClass ? 'color' : '',
|
|
454
|
+
sortText: this.getSortText(className, prefix),
|
|
455
|
+
insertText: className,
|
|
456
|
+
replacementSpan: {
|
|
457
|
+
start: context.prefixStart,
|
|
458
|
+
length: context.currentPrefix.length
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
return entries;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Get the cached class list, initializing if necessary
|
|
466
|
+
*/
|
|
467
|
+
getClassList() {
|
|
468
|
+
if (this.cachedClassList === null) {
|
|
469
|
+
this.cachedClassList = this.validator.getAllClasses().sort();
|
|
470
|
+
}
|
|
471
|
+
return this.cachedClassList;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Clear the cached class list (call when design system reloads)
|
|
475
|
+
*/
|
|
476
|
+
clearCache() {
|
|
477
|
+
this.cachedClassList = null;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Check if a class name is related to colors
|
|
481
|
+
* Uses a pattern-based approach to detect color classes efficiently
|
|
482
|
+
*/
|
|
483
|
+
isColorClass(className) {
|
|
484
|
+
// Color-related prefixes in Tailwind CSS
|
|
485
|
+
// These patterns match classes that typically set colors
|
|
486
|
+
const colorPrefixes = [
|
|
487
|
+
'bg-', // background-color
|
|
488
|
+
'text-', // color (text color)
|
|
489
|
+
'border-', // border-color (but not border-0, border-2, etc.)
|
|
490
|
+
'ring-', // ring-color (but not ring-0, ring-1, etc.)
|
|
491
|
+
'outline-', // outline-color (but not outline-0, outline-1, etc.)
|
|
492
|
+
'shadow-', // box-shadow colors (but not shadow-sm, shadow-lg, etc.)
|
|
493
|
+
'accent-', // accent-color
|
|
494
|
+
'caret-', // caret-color
|
|
495
|
+
'fill-', // SVG fill
|
|
496
|
+
'stroke-', // SVG stroke
|
|
497
|
+
'from-', // gradient from color
|
|
498
|
+
'via-', // gradient via color
|
|
499
|
+
'to-', // gradient to color
|
|
500
|
+
'divide-', // divide color (but not divide-x, divide-y)
|
|
501
|
+
'placeholder-', // placeholder color
|
|
502
|
+
'decoration-' // text-decoration-color
|
|
503
|
+
];
|
|
504
|
+
// Check if class starts with any color prefix
|
|
505
|
+
const hasColorPrefix = colorPrefixes.some(prefix => className.startsWith(prefix));
|
|
506
|
+
if (!hasColorPrefix) {
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
// Filter out non-color variants of these prefixes
|
|
510
|
+
// These are utilities that use the same prefix but aren't colors
|
|
511
|
+
const nonColorPatterns = [
|
|
512
|
+
// Border utilities that aren't colors
|
|
513
|
+
/^border-[0-8]$/,
|
|
514
|
+
/^border-(collapse|separate|spacing|none|hidden|solid|dashed|dotted|double)$/,
|
|
515
|
+
/^border-(x|y|t|r|b|l|s|e)-[0-8]$/,
|
|
516
|
+
// Ring utilities that aren't colors
|
|
517
|
+
/^ring-[0-8]$/,
|
|
518
|
+
/^ring-(inset|offset-[0-8])$/,
|
|
519
|
+
// Outline utilities that aren't colors
|
|
520
|
+
/^outline-[0-8]$/,
|
|
521
|
+
/^outline-(none|dashed|dotted|double|offset-[0-8])$/,
|
|
522
|
+
// Shadow utilities that aren't colors
|
|
523
|
+
/^shadow-(sm|md|lg|xl|2xl|inner|none)$/,
|
|
524
|
+
// Divide utilities that aren't colors
|
|
525
|
+
/^divide-(x|y)(-[0-8]|-reverse)?$/,
|
|
526
|
+
/^divide-(solid|dashed|dotted|double|none)$/,
|
|
527
|
+
// Text utilities that aren't colors (sizes, alignment, etc.)
|
|
528
|
+
/^text-(xs|sm|base|lg|xl|[2-9]xl|left|center|right|justify|start|end|wrap|nowrap|balance|pretty)$/,
|
|
529
|
+
// Stroke width
|
|
530
|
+
/^stroke-[0-2]$/,
|
|
531
|
+
// Decoration utilities that aren't colors
|
|
532
|
+
/^decoration-(slice|clone|solid|double|dotted|dashed|wavy|auto|from-font|[0-8])$/
|
|
533
|
+
];
|
|
534
|
+
// If it matches any non-color pattern, it's not a color class
|
|
535
|
+
if (nonColorPatterns.some(pattern => pattern.test(className))) {
|
|
536
|
+
return false;
|
|
537
|
+
}
|
|
538
|
+
// Additional check: color classes typically have a color name or number
|
|
539
|
+
// e.g., bg-red-500, text-blue-200, border-gray-300
|
|
540
|
+
// or named colors like bg-white, text-black, bg-transparent
|
|
541
|
+
const afterPrefix = className.replace(/^[a-z]+-/, '');
|
|
542
|
+
// Common color indicators
|
|
543
|
+
const colorIndicators = [
|
|
544
|
+
// Color names
|
|
545
|
+
/^(slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-\d+$/,
|
|
546
|
+
// Special colors
|
|
547
|
+
/^(black|white|transparent|current|inherit)$/,
|
|
548
|
+
// Arbitrary colors
|
|
549
|
+
/^\[.*\]$/,
|
|
550
|
+
// Opacity variants on colors
|
|
551
|
+
/^.*\/\d+$/
|
|
552
|
+
];
|
|
553
|
+
return colorIndicators.some(pattern => pattern.test(afterPrefix));
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Generate sort text for completion ordering
|
|
557
|
+
* Classes that start with the prefix get priority
|
|
558
|
+
*/
|
|
559
|
+
getSortText(className, prefix) {
|
|
560
|
+
// Exact match gets highest priority
|
|
561
|
+
if (className === prefix) {
|
|
562
|
+
return '0' + className;
|
|
563
|
+
}
|
|
564
|
+
// Prefix match gets high priority
|
|
565
|
+
if (prefix && className.toLowerCase().startsWith(prefix.toLowerCase())) {
|
|
566
|
+
return '1' + className;
|
|
567
|
+
}
|
|
568
|
+
// Everything else sorted alphabetically
|
|
569
|
+
return '2' + className;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
exports.CompletionService = CompletionService;
|
|
573
|
+
//# sourceMappingURL=CompletionService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompletionService.js","sourceRoot":"","sources":["../../src/services/CompletionService.ts"],"names":[],"mappings":";;;AAiCA;;;;;;;;;;;;GAYG;AACH,MAAa,iBAAiB;IAM7B,YACkB,SAA4B,EAC5B,MAA+B;QAD/B,cAAS,GAAT,SAAS,CAAmB;QAC5B,WAAM,GAAN,MAAM,CAAyB;QAPjD,g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AAM,eAAe,GAAG;YACvB,cAAc;YACd,4IAA4I;YAC5I,iBAAiB;YACjB,6CAA6C;YAC7C,mBAAmB;YACnB,UAAU;YACV,6BAA6B;YAC7B,WAAW;SACX,CAAC;QAEF,OAAO,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACK,WAAW,CAAC,SAAiB,EAAE,MAAc;QACpD,oCAAoC;QACpC,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;YAC1B,OAAO,GAAG,GAAG,SAAS,CAAC;QACxB,CAAC;QAED,kCAAkC;QAClC,IAAI,MAAM,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YACxE,OAAO,GAAG,GAAG,SAAS,CAAC;QACxB,CAAC;QAED,wCAAwC;QACxC,OAAO,GAAG,GAAG,SAAS,CAAC;IACxB,CAAC;CACD;AA/rBD,8CA+rBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompletionService.spec.d.ts","sourceRoot":"","sources":["../../src/services/CompletionService.spec.ts"],"names":[],"mappings":""}
|