Vetur: Go to definition from template not work in 0.28.0

Created on 28 Sep 2020  路  4Comments  路  Source: vuejs/vetur

  • [x] I have searched through existing issues
  • [x] I have read through docs
  • [x] I have read FAQ

Info

  • Platform: Window 10 Pro
  • Vetur version: 0.28.0
  • VS Code version: 1.49.2

Problem

Go to definition from template not working when update to vetur 0.28.0.
Work just fine when downgrade to 0.27.3

Reproducible Case

In VS Code with vetur 0.28.0, hover any variable or function, Ctrl + click won't go to definition, instead show this error in the bottom right in vscode window

Capture

_Temporary solution_: Downgrade vetur back to 0.27.3

bug definition no-repro-case template-interpolation

Most helpful comment

I'm having the same problem (using Vetur 0.28.0 on Windows 10).

When I click "Go to definition", Visual Studio closes the file I am working on, and displays a message "unable to open 'file.vue': Unable to resolve resource (path)"
I noticed that the path contains forward slashes (e.g. c:/path/to/file) instead of the usual convention on Windows of using backslashes (c:\path\to\file). I don't know if that's significant.

I think this might be the same problem as issue #1484, which was fixed in #2161
I believe it was caused by path handling inconsistencies between Windows and Mac/Linux.

2161 updated server/src/modes/template/interpolationMode.ts, by wrapping 2 uri's in URI.file

I have just checked the latest version of interpolationMode.ts, and the calls to URI.file have been removed, which could explain why the problem has resurfaced.

All 4 comments

I'm having the same problem (using Vetur 0.28.0 on Windows 10).

When I click "Go to definition", Visual Studio closes the file I am working on, and displays a message "unable to open 'file.vue': Unable to resolve resource (path)"
I noticed that the path contains forward slashes (e.g. c:/path/to/file) instead of the usual convention on Windows of using backslashes (c:\path\to\file). I don't know if that's significant.

I think this might be the same problem as issue #1484, which was fixed in #2161
I believe it was caused by path handling inconsistencies between Windows and Mac/Linux.

2161 updated server/src/modes/template/interpolationMode.ts, by wrapping 2 uri's in URI.file

I have just checked the latest version of interpolationMode.ts, and the calls to URI.file have been removed, which could explain why the problem has resurfaced.

image
Got the same problem when I was learning the VUE.
The image above is when I using the TypeScript language, and here's the JavaScript version
image
In ts I can get the suggestion in template, but I can't use go to the definition in the