1
1
import { notFound } from "@src/diagnostic" ;
2
2
import AutocompleteResult from "@src/parser/AutocompleteResult" ;
3
3
import { getRoutes } from "@src/repositories/routes" ;
4
+ import { getViews } from "@src/repositories/views" ;
4
5
import { config } from "@src/support/config" ;
5
6
import { findHoverMatchesInDoc } from "@src/support/doc" ;
6
7
import { detectedRange , detectInDoc } from "@src/support/parser" ;
7
8
import { wordMatchRegex } from "@src/support/patterns" ;
8
- import { relativePath } from "@src/support/project" ;
9
+ import { projectPath , relativePath } from "@src/support/project" ;
9
10
import { facade } from "@src/support/util" ;
10
11
import { AutocompleteParsingResult } from "@src/types" ;
11
12
import * as vscode from "vscode" ;
@@ -17,6 +18,11 @@ const toFind: FeatureTag = [
17
18
class : [ ...facade ( "Redirect" ) , ...facade ( "URL" ) , "redirect" , "url" ] ,
18
19
method : [ "route" , "signedRoute" , "temporarySignedRoute" ] ,
19
20
} ,
21
+ {
22
+ class : [ "Livewire\\Volt\\Volt" ] ,
23
+ method : [ "route" ] ,
24
+ argumentIndex : 1 ,
25
+ } ,
20
26
] ;
21
27
22
28
const isCorrectIndexForMethod = (
@@ -28,6 +34,11 @@ const isCorrectIndexForMethod = (
28
34
return index === 0 ;
29
35
}
30
36
37
+ // @ts -ignore
38
+ if ( item . className === "Livewire\\Volt\\Volt" ) {
39
+ return index === 1 ;
40
+ }
41
+
31
42
return true ;
32
43
} ;
33
44
@@ -41,6 +52,22 @@ export const linkProvider: LinkProvider = (doc: vscode.TextDocument) => {
41
52
return null ;
42
53
}
43
54
55
+ // @ts -ignore
56
+ if ( item . className === "Livewire\\Volt\\Volt" ) {
57
+ const view = getViews ( ) . items . find (
58
+ ( v ) => v . key === `livewire.${ param . value } ` ,
59
+ ) ;
60
+
61
+ if ( ! view ) {
62
+ return null ;
63
+ }
64
+
65
+ return new vscode . DocumentLink (
66
+ detectedRange ( param ) ,
67
+ vscode . Uri . file ( projectPath ( view . path ) ) ,
68
+ ) ;
69
+ }
70
+
44
71
const route = getRoutes ( ) . items . find (
45
72
( route ) => route . name === param . value ,
46
73
) ;
0 commit comments