Skip to content

Commit ea92d92

Browse files
committed
livewire completion setting
1 parent 747d564 commit ea92d92

File tree

5 files changed

+27
-14
lines changed

5 files changed

+27
-14
lines changed

generatable.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
"type": "livewireComponent",
5656
"label": "Livewire components",
5757
"features": [
58-
"link"
58+
"link",
59+
"completion"
5960
]
6061
}
6162
]

generate-config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'diagnostics' => "Enable diagnostics for {$label}.",
2424
'hover' => "Enable hover information for {$label}.",
2525
'link' => "Enable linking for {$label}.",
26+
'completion' => "Enable completion for {$label}.",
2627
default => null,
2728
},
2829
];

package.json

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"type": "boolean",
133133
"default": true,
134134
"generated": true,
135-
"description": null
135+
"description": "Enable completion for app bindings."
136136
},
137137
"Laravel.asset.diagnostics": {
138138
"type": "boolean",
@@ -156,7 +156,7 @@
156156
"type": "boolean",
157157
"default": true,
158158
"generated": true,
159-
"description": null
159+
"description": "Enable completion for asset."
160160
},
161161
"Laravel.auth.diagnostics": {
162162
"type": "boolean",
@@ -180,7 +180,7 @@
180180
"type": "boolean",
181181
"default": true,
182182
"generated": true,
183-
"description": null
183+
"description": "Enable completion for auth."
184184
},
185185
"Laravel.bladeComponent.link": {
186186
"type": "boolean",
@@ -210,7 +210,7 @@
210210
"type": "boolean",
211211
"default": true,
212212
"generated": true,
213-
"description": null
213+
"description": "Enable completion for config."
214214
},
215215
"Laravel.controllerAction.diagnostics": {
216216
"type": "boolean",
@@ -234,7 +234,7 @@
234234
"type": "boolean",
235235
"default": true,
236236
"generated": true,
237-
"description": null
237+
"description": "Enable completion for controller actions."
238238
},
239239
"Laravel.env.diagnostics": {
240240
"type": "boolean",
@@ -258,7 +258,7 @@
258258
"type": "boolean",
259259
"default": true,
260260
"generated": true,
261-
"description": null
261+
"description": "Enable completion for env."
262262
},
263263
"Laravel.inertia.diagnostics": {
264264
"type": "boolean",
@@ -282,14 +282,20 @@
282282
"type": "boolean",
283283
"default": true,
284284
"generated": true,
285-
"description": null
285+
"description": "Enable completion for Inertia."
286286
},
287287
"Laravel.livewireComponent.link": {
288288
"type": "boolean",
289289
"default": true,
290290
"generated": true,
291291
"description": "Enable linking for Livewire components."
292292
},
293+
"Laravel.livewireComponent.completion": {
294+
"type": "boolean",
295+
"default": true,
296+
"generated": true,
297+
"description": "Enable completion for Livewire components."
298+
},
293299
"Laravel.middleware.diagnostics": {
294300
"type": "boolean",
295301
"default": true,
@@ -312,7 +318,7 @@
312318
"type": "boolean",
313319
"default": true,
314320
"generated": true,
315-
"description": null
321+
"description": "Enable completion for middleware."
316322
},
317323
"Laravel.mix.diagnostics": {
318324
"type": "boolean",
@@ -336,7 +342,7 @@
336342
"type": "boolean",
337343
"default": true,
338344
"generated": true,
339-
"description": null
345+
"description": "Enable completion for mix."
340346
},
341347
"Laravel.paths.link": {
342348
"type": "boolean",
@@ -366,7 +372,7 @@
366372
"type": "boolean",
367373
"default": true,
368374
"generated": true,
369-
"description": null
375+
"description": "Enable completion for route."
370376
},
371377
"Laravel.translation.diagnostics": {
372378
"type": "boolean",
@@ -390,7 +396,7 @@
390396
"type": "boolean",
391397
"default": true,
392398
"generated": true,
393-
"description": null
399+
"description": "Enable completion for translation."
394400
},
395401
"Laravel.view.diagnostics": {
396402
"type": "boolean",
@@ -414,7 +420,7 @@
414420
"type": "boolean",
415421
"default": true,
416422
"generated": true,
417-
"description": null
423+
"description": "Enable completion for view."
418424
}
419425
}
420426
}

src/features/livewireComponent.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { getViews } from "@src/repositories/views";
2+
import { config } from "@src/support/config";
23
import { projectPath } from "@src/support/project";
34
import * as vscode from "vscode";
45
import { LinkProvider } from "..";
@@ -44,6 +45,10 @@ export const completionProvider: vscode.CompletionItemProvider = {
4445
doc: vscode.TextDocument,
4546
pos: vscode.Position,
4647
): vscode.ProviderResult<vscode.CompletionItem[]> {
48+
if (!config("livewireComponent.completion", true)) {
49+
return undefined;
50+
}
51+
4752
const componentPrefix = "<livewire:";
4853
const pathPrefix = "livewire.";
4954
const line = doc.lineAt(pos.line).text;

src/support/generated-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export type GeneratedConfigKey = 'appBinding.diagnostics' | 'appBinding.hover' | 'appBinding.link' | 'appBinding.completion' | 'asset.diagnostics' | 'asset.hover' | 'asset.link' | 'asset.completion' | 'auth.diagnostics' | 'auth.hover' | 'auth.link' | 'auth.completion' | 'bladeComponent.link' | 'config.diagnostics' | 'config.hover' | 'config.link' | 'config.completion' | 'controllerAction.diagnostics' | 'controllerAction.hover' | 'controllerAction.link' | 'controllerAction.completion' | 'env.diagnostics' | 'env.hover' | 'env.link' | 'env.completion' | 'inertia.diagnostics' | 'inertia.hover' | 'inertia.link' | 'inertia.completion' | 'livewireComponent.link' | 'middleware.diagnostics' | 'middleware.hover' | 'middleware.link' | 'middleware.completion' | 'mix.diagnostics' | 'mix.hover' | 'mix.link' | 'mix.completion' | 'paths.link' | 'route.diagnostics' | 'route.hover' | 'route.link' | 'route.completion' | 'translation.diagnostics' | 'translation.hover' | 'translation.link' | 'translation.completion' | 'view.diagnostics' | 'view.hover' | 'view.link' | 'view.completion';
1+
export type GeneratedConfigKey = 'appBinding.diagnostics' | 'appBinding.hover' | 'appBinding.link' | 'appBinding.completion' | 'asset.diagnostics' | 'asset.hover' | 'asset.link' | 'asset.completion' | 'auth.diagnostics' | 'auth.hover' | 'auth.link' | 'auth.completion' | 'bladeComponent.link' | 'config.diagnostics' | 'config.hover' | 'config.link' | 'config.completion' | 'controllerAction.diagnostics' | 'controllerAction.hover' | 'controllerAction.link' | 'controllerAction.completion' | 'env.diagnostics' | 'env.hover' | 'env.link' | 'env.completion' | 'inertia.diagnostics' | 'inertia.hover' | 'inertia.link' | 'inertia.completion' | 'livewireComponent.link' | 'livewireComponent.completion' | 'middleware.diagnostics' | 'middleware.hover' | 'middleware.link' | 'middleware.completion' | 'mix.diagnostics' | 'mix.hover' | 'mix.link' | 'mix.completion' | 'paths.link' | 'route.diagnostics' | 'route.hover' | 'route.link' | 'route.completion' | 'translation.diagnostics' | 'translation.hover' | 'translation.link' | 'translation.completion' | 'view.diagnostics' | 'view.hover' | 'view.link' | 'view.completion';

0 commit comments

Comments
 (0)