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

Add a "Volar: Reload Project" command #1605

Closed
segevfiner opened this issue Jul 20, 2022 · 11 comments
Closed

Add a "Volar: Reload Project" command #1605

segevfiner opened this issue Jul 20, 2022 · 11 comments
Labels
enhancement New feature or request

Comments

@segevfiner
Copy link
Contributor

Current limitations in ts-server file watching can often lead to a need to either restart the server or reload the project. Reloading the project can often be faster than a full restart but is not exposed in Volar unlike in the builtin TypeScript extension.

@johnsoncodehk
Copy link
Member

We have this command and it title is "Volar: Restart Vue server", but we can change the title to "Volar: Reload Project" if it more meaningful.

@segevfiner
Copy link
Contributor Author

The TypeScript plugin has both a restart and reload commands are they the same underneth?

@johnsoncodehk
Copy link
Member

It seems "TypeScript: Reload Project" is subset of "TypeScript: Restart TS server" and faster than it.

But I'm not sure if implement "Reload Project" in Volar is meaningful if only it's just faster.

@segevfiner
Copy link
Contributor Author

Mostly I suggested this due to ts-server still having trouble nowadays with keeping it's status up-to-date often prompting me to having to reload/restart it and in takeover mode it is Volar that takes the responsibility of running it.

@jods4
Copy link

jods4 commented Jul 25, 2022

I wonder how much is a limitation in TS itself or caused by Volar.
@johnsoncodehk if you feel this is hijacking the wrong issue, feel free to copy-paste this report into a new issue.

In my project, we have a watcher tool that generates and updates TS files in the background, based on our server-side code. Basically, think of generating your client code to call the server web API.

This is a constant source of "Volar: Restart Vue Server" and that's super annoying and flow-breaking.

Here's an example of what happens:
0. Prerequisites: assume the project is already open and the modified client TS file has never been opened in VS Code.

  1. For this example, I added a method getTest on my server, so the client TS file is updated by our tool with this addition.

  2. Try to use the new method in a plain TS file: everything works ok.
    edOVZqdpmJ

  3. Now try the same in a Vue SFC: the new function is not picked up, as if TS server has not seen the changes:
    8sZIJ77NR1

This is in the same project, same VS Code session. So it looks like plain TS is a little better than Volar at picking file changes.

@johnsoncodehk johnsoncodehk added the enhancement New feature or request label Jul 26, 2022
@segevfiner
Copy link
Contributor Author

TS 4.8 might include improvements to the buggy file watcher behavior BTW.

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Jul 31, 2022

@jods4 Volar doesn't implement file watch by itself, but delegates to LSP events (same as Vetur), so you should be able to reproduce the same problem in Vetur.

@johnsoncodehk
Copy link
Member

v0.39.3 "Volar: Reload Project" command cannot detect node_modules change, will fix in v0.39.4.

@jods4
Copy link

jods4 commented Aug 1, 2022

@johnsoncodehk I have not tested with Vetur, it may not work either.
The strange thing is that in a regular plain TS file, it works (see above).

So somehow the TS language server on its own seems to do fine. Volar must be doing something differently that leads to missed file changes.

If there's anything that I can provide to help to find the difference, maybe like logs, just let me know.

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Aug 3, 2022

@jods4 VSCode provide language support for .ts via tsserver, tsserver implement it own file watch logic but not use LSP file watcher.

I think every LSP language extension should have same problem, you should port this problem to VSCode repo.

@segevfiner
Copy link
Contributor Author

https://devblogs.microsoft.com/typescript/announcing-typescript-4-8-beta/#file-watching-fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants