Skip to content

Commit 524b4f0

Browse files
Nate Corkishzignd
Nate Corkish
authored andcommitted
Give the user the ability to choose their own languages for showing completion
1 parent 6bc9ed0 commit 524b4f0

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
dist
22
node_modules
33
*.vsix
4+
out

package.json

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,42 @@
4646
"type": "boolean",
4747
"default": false,
4848
"description": "Enables completion when you're writing Emmet abbreviations."
49+
},
50+
"html-css-class-completion.enabledJavascriptLanguages": {
51+
"type": "array",
52+
"description": "A list of Javascript languages where suggestions are enabled.",
53+
"default": [
54+
"typescriptreact",
55+
"javascript",
56+
"javascriptreact"
57+
]
58+
},
59+
"html-css-class-completion.enabledCSSLanguages": {
60+
"type": "array",
61+
"description": "A list of CSS languages where suggestions are enabled.",
62+
"default": [
63+
"css",
64+
"sass",
65+
"scss"
66+
]
67+
},
68+
"html-css-class-completion.enabledHTMLLanguages": {
69+
"type": "array",
70+
"description": "A list of HTML languages where suggestions are enabled.",
71+
"default": [
72+
"html",
73+
"django-html",
74+
"razor",
75+
"php",
76+
"blade",
77+
"vue",
78+
"twig",
79+
"markdown",
80+
"erb",
81+
"handlebars",
82+
"ejs",
83+
"svelte"
84+
]
4985
}
5086
}
5187
}
@@ -89,4 +125,4 @@
89125
"source-map-support": "^0.5.3",
90126
"verror": "^1.10.0"
91127
}
92-
}
128+
}

src/extension.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,18 @@ export async function activate(context: ExtensionContext): Promise<void> {
180180
}
181181

182182
// Javascript based extensions
183-
["typescriptreact", "javascript", "javascriptreact"].forEach((extension) => {
183+
workspace.getConfiguration().get<string[]>("html-css-class-completion.enabledJavascriptLanguages").forEach((extension) => {
184184
context.subscriptions.push(provideCompletionItemsGenerator(extension, /className=["|']([\w- ]*$)/));
185185
context.subscriptions.push(provideCompletionItemsGenerator(extension, /class=["|']([\w- ]*$)/));
186186
});
187187

188188
// HTML based extensions
189-
["html", "django-html", "razor", "php", "blade", "vue",
190-
"twig", "markdown", "erb", "handlebars", "ejs",
191-
].forEach((extension) => {
189+
workspace.getConfiguration().get<string[]>("html-css-class-completion.enabledHTMLLanguages").forEach((extension) => {
192190
context.subscriptions.push(provideCompletionItemsGenerator(extension, /class=["|']([\w- ]*$)/));
193191
});
194192

195193
// CSS based extensions
196-
["css", "sass", "scss"].forEach((extension) => {
194+
workspace.getConfiguration().get<string[]>("html-css-class-completion.enabledCSSLanguages").forEach((extension) => {
197195
// Support for Tailwind CSS
198196
context.subscriptions.push(provideCompletionItemsGenerator(extension, /@apply ([\.\w- ]*$)/, "."));
199197
});

0 commit comments

Comments
 (0)