Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.ts error doesn't disappear until you edit the file #1274

Closed
h-h-h-h opened this issue May 7, 2022 · 4 comments
Closed

.ts error doesn't disappear until you edit the file #1274

h-h-h-h opened this issue May 7, 2022 · 4 comments
Labels
enhancement New feature or request good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first

Comments

@h-h-h-h
Copy link

h-h-h-h commented May 7, 2022

I'm not sure this is a Volar bug, but you'd think this wouldn't happen in pure .ts projects, given how long TypeScript already exists.

I also had this annoying bug quite a number of times already under productive circumstances. But this is a reproducible case I could come up with.


  • In an empty directory, run

    npm init vue@latest
    

    ...with "Yes" to just the following question:

    √ Add TypeScript? ... No / Yes
    
  • Open the vue-project directory with VS Code.

  • Enable take-over mode for the workspace.

  • Open a tab for /src/main.ts. 'vue' in the first line import { createApp } from 'vue' has wavy, red underlining ("Cannot find module 'vue' or its corresponding type declarations. ts(2307)").

  • With VS Code and its main.ts tab still open, outside of VS Code, run npm install in the project directory.

  • The error persists, even when closing and reopening the main.ts tab. When you add a space at the end of the file and wait a moment, the error disappears.


As I wrote, the error also happens under productive circumstances where an edit in a file should resolve the error in another file, but where I have to edit the other file like adding a space for the errors to disappear. This already confused me and made me think what in the world I missed that the errors persist, when in reality the errors weren't there anymore and it was just a kind of refresh that was necessary.

@johnsoncodehk
Copy link
Member

We do not support watch node_modules changes yet, LSP does not have a good solution to watch node_modules without performance issue currently. You could use Volar: Restart Vue server command to restart language server when node_modules updated.

@johnsoncodehk johnsoncodehk added the enhancement New feature or request label May 22, 2022
@johnsoncodehk johnsoncodehk added the good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first label Mar 18, 2023
@davidmatter
Copy link
Collaborator

@johnsoncodehk would it be possible to only watch npm, yarn and pnpm lock files? That way we would know when there are dependency changes. No need to watch the whole node_modules dir.

@cMing1997
Copy link

We do not support watch node_modules changes yet, LSP does not have a good solution to watch node_modules without performance issue currently. You could use Volar: Restart Vue server command to restart language server when node_modules updated.我们还不支持观看node_modules更改,LSP 目前没有一个好的解决方案来观看没有性能问题的node_modules。更新时,可以使用 Volar: Restart Vue server 命令重新启动语言服务器node_modules。

Report a newly discovered problem, not sure if it is related to the problem, after creating a new VUE file, introduce a file with an alias, TS will alert that the corresponding module or type can not be found, but the path is correct. The error will not stop until I restart vscode, tsconfig. Exe in my project. JSON configures path and baseUrl

@johnsoncodehk
Copy link
Member

Fixed by #3788

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first
Projects
None yet
Development

No branches or pull requests

4 participants