Skip to content

Commit 6701aea

Browse files
authored
Merge pull request #95 from m2de/task-blade-support
Support for Laravel Blade file extension
2 parents 9eb5b93 + f28e8d7 commit 6701aea

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ A Visual Studio Code extension that provides CSS class name completion for the H
1313
* HTML
1414
* Razor
1515
* PHP
16+
* Laravel (Blade)
1617
* JavaScript
1718
* JavaScript React (.jsx)
1819
* TypeScript React (.tsx)

src/extension.ts

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -122,34 +122,15 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
122122
}
123123
}));
124124

125-
const htmlRegex = /class=["|']([\w- ]*$)/;
126-
const jsxRegex = /className=["|']([\w- ]*$)/;
127-
128-
const html = provideCompletionItemsGenerator('html', htmlRegex);
129-
const razor = provideCompletionItemsGenerator('razor', htmlRegex);
130-
const php = provideCompletionItemsGenerator('php', htmlRegex);
131-
const vue = provideCompletionItemsGenerator('vue', htmlRegex);
132-
const twig = provideCompletionItemsGenerator('twig', htmlRegex);
133-
const md = provideCompletionItemsGenerator('markdown', htmlRegex);
134-
const tsReact = provideCompletionItemsGenerator('typescriptreact', jsxRegex);
135-
const js = provideCompletionItemsGenerator('javascript', jsxRegex)
136-
const jsReact = provideCompletionItemsGenerator('javascriptreact', jsxRegex);
137-
const erb = provideCompletionItemsGenerator('erb', htmlRegex);
138-
const hbs = provideCompletionItemsGenerator('handlebars', htmlRegex);
139-
const ejs = provideCompletionItemsGenerator('ejs', htmlRegex);
140-
141-
context.subscriptions.push(html);
142-
context.subscriptions.push(razor);
143-
context.subscriptions.push(php);
144-
context.subscriptions.push(vue);
145-
context.subscriptions.push(twig);
146-
context.subscriptions.push(md);
147-
context.subscriptions.push(tsReact);
148-
context.subscriptions.push(js);
149-
context.subscriptions.push(jsReact);
150-
context.subscriptions.push(erb);
151-
context.subscriptions.push(hbs);
152-
context.subscriptions.push(ejs);
125+
// Javascript based extensions
126+
['typescriptreact', 'javascript', 'javascriptreact'].forEach((extension) => {
127+
context.subscriptions.push(provideCompletionItemsGenerator(extension, /className=["|']([\w- ]*$)/));
128+
});
129+
130+
// HTML based extensions
131+
['html', 'razor', 'php', 'blade', 'vue', 'twig', 'markdown', 'erb', 'handlebars', 'ejs'].forEach((extension) => {
132+
context.subscriptions.push(provideCompletionItemsGenerator(extension, /class=["|']([\w- ]*$)/));
133+
});
153134

154135
caching = true;
155136
try {

0 commit comments

Comments
 (0)