Vetur: "Go to definition" for methods/computeds does not work in the template - Unable to open '[somefile].vue': resource is not available.

Created on 31 Oct 2019  路  5Comments  路  Source: vuejs/vetur

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

Info

  • Platform: Windows 10
  • Vetur version: 0.22.6
  • VS Code version: 1.39.2

Problem

Running "Go to definition" on a method/computed name inside the template (with vetur.experimental.templateInterpolationService enabled) throws an error:
Unable to open 'HelloWorld.vue': resource is not available.

I tested this in Veturpack and the default (babel, eslint) Vue CLI 4 project.

More verbose message from Log (Window) in Output panel:

[2019-10-31 22:17:30.846] [renderer1] [error] resource is not available: Error: resource is not available
    at v.createReferencedObject (file:///C:/Users/atagisow/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:4888:687)
    at v.createReferencedObject (file:///C:/Users/atagisow/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:4888:652)
    at process._tickCallback (internal/process/next_tick.js:68:7)

vetur

When the above gif was made:

  • Vetur was the only enabled extension
  • The contents of settings.json was only "vetur.experimental.templateInterpolationService": true

Reproducible Case

the gif I uploaded is made on the Vue CLI 4 template, here I'll show how to reproduce it in Veturpack

  1. Clone Veturpack
  2. In VSCode go to veturpack\client\components\Counter.vue
  3. Right click count on line 8 and press "Go to definition"

You'll get the Unable to open 'Counter.vue': resource is not available. error

I'm not sure if what I'm describing is even a feature of Vetur? I'm going by what I've read in https://vuejs.github.io/vetur/interpolation.html#generic-language-features -> :

Currently diagnostics, hover, jump to definition and find references are implemented in this way:

So I'm assuming I should be able to do what I'm trying to do.

This issue is different from #707 because it's related to methods/computeds whereas 707 is related to Go Tos in imports

bug definition template-interpolation windows

Most helpful comment

NVM, should be fixed in #2161.

All 5 comments

Same error occurs on my system with

  • Vetur 25.0
  • VS Code Insiders 1.48.0-insider
  • OS: Windows_NT x64 10.0.18362
[2020-07-22 14:02:08.115] [renderer1] [error] Unable to resolve resource c:/repos/app/src/views/types.ts: Error: Unable to resolve resource c:/repos/app/src/views/types.ts
    at S.doCreateReferencedObject (file:///C:/Users/User/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:6123:107)
    at S.doCreateReferencedObject (file:///C:/Users/User/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:6123:70)
    at async b.createModelReference (file:///C:/Users/User/AppData/Local/Programs/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:6124:728)

I am experiencing the same problem with a similar error message and the file at given path definitely exist.

  • Vetur 0.25.0
  • VS Code 1.47.3
  • Win 10

If you are able to repro, do you mind doing this:

  • Turn on "vetur.trace.server": "verbose"
  • Go to Output -> Vue Language Server
  • Clear all output
  • Do a F12
  • Use Ctrl+F to find last textDocument/definition log
  • Paste it here
  • Do a successful F12 (such as in JS, jump to definition of a variable)
  • Use Ctrl+F to find last textDocument/definition log
  • Paste it here

image

From what I can see in @rs3d's log, it seems to be that the URI is not handled correctly on Windows pathing.

NVM, should be fixed in #2161.

I just finished your repro steps 馃槄. Glad to hear that this one is fixed, looking forward for the next release.

Was this page helpful?
0 / 5 - 0 ratings