Skip to content

'Could not find source file' with Vue plugin when creating new files and using VS Code's file watcherΒ #59349

@mjbvz

Description

@mjbvz

πŸ”Ž Search Terms

  • Vue
  • volar
  • plugin
  • extension
  • file watcher

πŸ•— Version & Regression Information

TS 5.4.5+ using a VS Code version with vscode file watcher enabled (1.89+)

⏯ Playground Link

No response

πŸ’» Code

microsoft/vscode#214226 (comment)

  1. Install the official vue plugin for VS Code
  2. Create a new vue project (tested with https://github.com/johnsoncodehk/volar-starter)
  3. Open an existing vue file to activate the language server
  4. Now create a new .vue file and add a <script> block in it

πŸ™ Actual behavior

Intellisense doesn't work in the new block. You also see a number of request errors for this file:

 ERR <semantic> TypeScript Server Error (5.5.3)
Could not find source file: '/Users/matb/projects/sandbox/volar-starter/src/xxx.vue'.
Error: Could not find source file: '/Users/matb/projects/sandbox/volar-starter/src/xxx.vue'.
    at getValidSourceFile (/Users/matb/projects/sandbox/volar-starter/node_modules/typescript/lib/typescript.js:148819:22)
    at getEncodedSemanticClassifications3 (/Users/matb/projects/sandbox/volar-starter/node_modules/typescript/lib/typescript.js:149357:77)
    at /Users/matb/.vscode/extensions/vue.volar-2.0.26/node_modules/typescript-vue-plugin-bundle/index.js:5:3611
    at Proxy.<anonymous> (/Users/matb/.vscode/extensions/vue.volar-2.0.26/node_modules/typescript-vue-plugin-bundle/index.js:279:853)
    at IpcIOSession.getEncodedSemanticClassifications (/Users/matb/projects/sandbox/volar-starter/node_modules/typescript/lib/typescript.js:189730:41)
    at encodedSemanticClassifications-full (/Users/matb/projects/sandbox/volar-starter/node_modules/typescript/lib/typescript.js:189027:43)
    ...

πŸ™‚ Expected behavior

Script block should be treated as code

Additional information about the issue

Also doesn't happen if you set "typescript.tsserver.experimental.useVsCodeWatcher": false. However this has been on by default since the April stable release of VS Code (1.89) so it is not a new regression

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalRelates to another program, environment, or user action which we cannot control.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions