File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,12 @@ export type Configuration = {
10
10
* @default true
11
11
* */
12
12
enableLinks : boolean
13
+ /**
14
+ * Whether to enable definitions for template attributes
15
+ * May lead to definition duplicates with Volar configured
16
+ * @default true,
17
+ * */
18
+ enableTemplateAttributeDefinitions : boolean
13
19
/**
14
20
* (component definitions) Try to resolve imports using aliases from root webpack config
15
21
* @default true
Original file line number Diff line number Diff line change @@ -2,11 +2,14 @@ import * as vscode from 'vscode'
2
2
import { pascalCase , camelCase } from 'change-case'
3
3
import { documentsImportsCache } from './componentsLinks'
4
4
import { getDefaultExportOutline , interpolationPropRegex , isScriptSetup } from './util'
5
+ import { getExtensionSetting } from 'vscode-framework'
5
6
6
7
export const registerGotoDefinition = ( ) => {
7
8
// attribute definition
8
9
vscode . languages . registerDefinitionProvider ( 'vue' , {
9
- async provideDefinition ( document , position , token ) {
10
+ async provideDefinition ( document , position ) {
11
+ if ( ! getExtensionSetting ( 'enableTemplateAttributeDefinitions' ) ) return
12
+
10
13
const lineText = document . lineAt ( position ) . text
11
14
const match = interpolationPropRegex . exec ( lineText . slice ( 0 , position . character ) )
12
15
if ( ! match ) return
@@ -38,7 +41,6 @@ export const registerGotoDefinition = () => {
38
41
console . warn ( 'no importsCache!' )
39
42
return
40
43
}
41
-
42
44
// Volar with configured aliases in tsconfig already provides correct definition
43
45
if ( await isScriptSetup ( document . uri ) ) return
44
46
You can’t perform that action at this time.
0 commit comments