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

CompileOnSave first load experience #17703

Closed
mjbvz opened this issue Aug 9, 2017 · 1 comment
Closed

CompileOnSave first load experience #17703

mjbvz opened this issue Aug 9, 2017 · 1 comment
Labels
Question An issue which isn't directly actionable in code VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Aug 9, 2017

Problem

I'm investigating adding support for compileOnSave to VSCode: microsoft/vscode#32103 . The existing api seems to work well recompiling a file after it changes, but I have a few questions:

  • When a project is first loaded, we only display errors for file that have been loaded in the editor. Even after recompiling a file, we only get the errors for its dependencies, and not all possible errors in the project.

  • When a file is changed, we only recompile that file and its dependencies. This is also how atom-typescript works and seems to be what the API is designed for. However, this may result in the compiled files being missing or in an inconsistent state. A better behavior would be that we recompile the entire project whenever a file in it changes.

Questions

  • What is the expected behavior of compile on save? Should it recompile the entire project or just the dependencies?
  • What is the expected workflow for using compile on save? Do I have to run tsc first?
  • Is there a way we can get errors for the entire project when it is first loaded?
@mjbvz mjbvz added the VS Code Tracked There is a VS Code equivalent to this issue label Aug 9, 2017
@mjbvz mjbvz changed the title Compile on save first load experience CompileOnSave first load experience Aug 9, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Aug 29, 2017

What is the expected behavior of compile on save? Should it recompile the entire project or just the dependencies?

The API is designed to give the host the complete control on what needs to be done and when. so the assumption here is that the host will enumerate all files in the project, and will call compile on save on them all at some point, and then from that point on, call compile on save on changed files.

What is the expected workflow for using compile on save? Do I have to run tsc first?

That is up to you. but possibly.

Is there a way we can get errors for the entire project when it is first loaded?

The API provides semanticDiagnosticsSync and syntacticDiagnosticsSync, you can call these on each file in the project. one thing to note, these are expensive operations, both in terms of memory and CPU. they will also keep the server blocked untill canceled or completed. and cancellation is a bit sparse when it comes to type checking.
We believe the behavior we have today in VSCode (and tsserver by default) is the best. we do query for diagnostics for all closed files in VS and we get users complaining about high resource utilization.
I would highly recommend not changing the current behavior.

@mhegazy mhegazy added the Question An issue which isn't directly actionable in code label Aug 29, 2017
@mhegazy mhegazy closed this as completed Aug 29, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

2 participants