Skip to content

Commit 97d854b

Browse files
committed
only run blade autocompletion on blade files
1 parent d18927e commit 97d854b

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

src/completion/Blade.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ export default class Blade implements vscode.CompletionItemProvider {
1212
token: vscode.CancellationToken,
1313
context: vscode.CompletionContext,
1414
): vscode.CompletionItem[] {
15-
let isBlade =
16-
["blade", "laravel-blade"].includes(document.languageId) ||
17-
document.fileName.endsWith(".blade.php");
18-
19-
if (!isBlade) {
20-
return [];
21-
}
22-
2315
return this.getDefaultDirectives(document, position).concat(
2416
getCustomBladeDirectives().items.map((directive) => {
2517
let completeItem = new vscode.CompletionItem(

src/extension.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ export function activate(context: vscode.ExtensionContext) {
5454

5555
console.log("Laravel VS Code Started...");
5656

57-
const LANGUAGES = [
58-
{ scheme: "file", language: "php" },
57+
const BLADE_LANGUAGES = [
5958
{ scheme: "file", language: "blade" },
6059
{ scheme: "file", language: "laravel-blade" },
6160
];
6261

62+
const LANGUAGES = [{ scheme: "file", language: "php" }, ...BLADE_LANGUAGES];
63+
6364
initVendorWatchers();
6465
setParserBinaryPath(context);
6566

@@ -113,6 +114,8 @@ export function activate(context: vscode.ExtensionContext) {
113114
),
114115
vscode.languages.registerCompletionItemProvider(
115116
LANGUAGES,
117+
vscode.languages.registerCompletionItemProvider(
118+
BLADE_LANGUAGES,
116119
new BladeCompletion(),
117120
"@",
118121
),

0 commit comments

Comments
 (0)