Skip to content

Commit

Permalink
feat: allow disable scoped css classes intellisense
Browse files Browse the repository at this point in the history
close #1121
  • Loading branch information
johnsoncodehk committed Apr 10, 2022
1 parent dc529f9 commit a437904
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Expand Up @@ -28,9 +28,13 @@
"type": "boolean",
"markdownDescription": "https://github.com/johnsoncodehk/volar/issues/577"
},
"experimentalResolveNonScopedCssClasses": {
"type": "boolean",
"markdownDescription": "https://github.com/johnsoncodehk/volar/issues/1038"
"experimentalResolveStyleCssClasses": {
"enum": [
"scoped",
"always",
"never"
],
"markdownDescription": "https://github.com/johnsoncodehk/volar/issues/1038, https://github.com/johnsoncodehk/volar/issues/1121"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-typescript/src/types.ts
Expand Up @@ -16,5 +16,5 @@ export interface VueCompilerOptions {
experimentalTemplateCompilerOptions?: any;
experimentalTemplateCompilerOptionsRequirePath?: string;
experimentalDisableTemplateSupport?: boolean;
experimentalResolveNonScopedCssClasses?: boolean;
experimentalResolveStyleCssClasses?: 'scoped' | 'always' | 'never';
}
3 changes: 2 additions & 1 deletion packages/vue-typescript/src/use/useSfcTemplateScript.ts
Expand Up @@ -50,8 +50,9 @@ export function useSfcTemplateScript(
);
const cssScopedClasses = computed(() => {
const obj: Record<string, Record<string, TextRange[]>> = {};
const setting = compilerOptions.experimentalResolveStyleCssClasses ?? 'scoped';
for (const style of styleFiles.value) {
if (style.data.scoped || compilerOptions.experimentalResolveNonScopedCssClasses) {
if ((setting === 'scoped' && style.data.scoped) || setting === 'always') {
const classes = getCssClasses(style);
obj[style.fileName] = classes;
}
Expand Down

0 comments on commit a437904

Please sign in to comment.