-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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
Task: Typescript errors disappear after document closed #47386
Comments
@mjbvz the reason for this is that the errors from the TS language server and the tsc -w task have the same owner (which they need, otherwise you see errors twice). Now when the file closes the TS extensions removes the errors from the file. I somehow remember that I had special code in that I fetched errors from files that have been through an open / close cycle until the file disappears. The same problem happens for example without the tsc watch task. Have two ts files open where one depends on the other, have an error and close the one with the error. Observer the error list is empty. At the end the TS language server should have a project wide compile. For the tsc -w case I can look into restoring errors when files are closing. |
We recently swapped from Flow to TypeScript. In our previous workflow with Flow, the errors would remain when we opened/closed files. However, with Typescript, none of the errors show by default (when all files are closed). For this reason, we use VSCode's Tasks -> Run Build Task, to run the detected tsconfig.watch. This is great because it shows all errors across the project without having to open files. However, when we open a file then close it, the error disappears from the problems tab (same issue as described above). We would love for there to be a configuration option to disable removing errors from problems tab until they are fixed. This would be a simple fix. An even cooler one would be for this behaviour to be automatic when using a typescript watcher. |
@mjbvz in the past the typescript extension did keep all files that were open and reported errors in a list and rechecked them even if they were closed. This feature seems to got removed. Any reason for this? |
Our team moved from Flow to TypeScript recently and this is one thing they keep bringing up as a downside... @mjbvz any comments on this? |
this looks like a regression to me, it didn't use to be like that |
You can always run the |
Yes but after you close a file, the errors disappear from the file browser bar and the IDE's problems summary |
Agree. (see my command #47386 (comment)) |
I’m checking in a change to keep the diagnostics around on close, but the problem de-duplication seems incorrect here. Here are the states: Open workspace with no open files and start watch task
Now open
Close
|
This is not fully correct: Now open index.ts in vscode
Close index.ts
I looked into re-applying the errors on document close however this is not so easy due to that fact that everything runs async. If I re-add them too early the TS server will take them away if I re-add them too late then the whole problem view flickers. So we need to have some sort of coordination here which very likely requires new API. |
That makes sense for how the feature is implemented, but as an extension author I expected that VS Code would maintain both errors behind the scenes and then presents the de-duplicated error list to users. Is that possible? Would it break existing scenarios? |
No, the problem with this is that de-duping would only work if both error sets are computed on the same state. However usually the compiler works on the save state on disk whereas the typescript server works on the in buffer state. Consider the case where there is one error from the compiler and then the user opens the file and adds two new lines at the top. Will be very hard to de-dupe these reliable. So the model for TS is more:
The problem is to make transitions without flickering and showing errors twice. Am not sure if we can handle this generically in the core or whether we best involve the extension into this since that one might have more knowledge. |
Thanks for the explanation. I'm closing this issue since we have a workaround on the ts side then |
@mjbvz Could you ping us the GitHub issue which will result in this behaviour being fixed? (i.e. if it's in the TS repo or something). Just so we can have progress updates 😄 |
Seems this is still a problem nowadays. Right now,
This is fairly time consuming. It would be great to show all (current and non-outdated) errors for the whole project in its current state, and have an option to disable that like some other people want (they want only errors for open files). |
Just to be clear, the workaround for TypeScript is to run the |
Fixes microsoft#47386 Logic was added in microsoft@df97bc3 to add a watcher's problems back to the problems view after closing a file. It doesn't work quite right though because of how `processLineInternal` batches up changes, only sending them to `markerService` when it gets called on subsequent lines with a different owner or resource. Because of that, the current behavior is that when you close a file with errors, the errors will disappear and only end up getting restored the next time a different file being watched gets saved. This PR fixes that (restoring the errors right after the file is closed) by calling `forceDelivery()`.
Note: this was partially fixed by df97bc3. Due to a bug, the current behavior is that when you close a file with problems, the problems will get restored, but only after the next time a different file being watched gets saved. I have a fix for that at #183172. With that PR, problems from a watch task will get added back to the problems view right after closing a file. |
Fixes microsoft#47386 This sets the `flushOnListenerRemove` option to true for the call to Event.debounce. Without this, some `onMarkerChanged` events can get dropped -- specifically, when an event gets fired more than 100ms after first listening, in which case the 600ms cleanup setTimeout fires while the 500ms debounce timeout is still pending.
Fixes microsoft#47386 This sets the `flushOnListenerRemove` option to true for the call to Event.debounce. Without this, some `onMarkerChanged` events can get dropped -- specifically, when an event gets fired more than 100ms after first listening, in which case the 600ms cleanup setTimeout fires while the 500ms debounce timeout is still pending.
Fixes microsoft#47386 This sets the `flushOnListenerRemove` option to true for the call to Event.debounce. Without this, some `onMarkerChanged` events can get dropped -- specifically, when an event gets fired more than 100ms after first listening, in which case the 600ms cleanup setTimeout fires while the 500ms debounce timeout is still pending.
Fixes microsoft#47386 This sets the `flushOnListenerRemove` option to true for the call to Event.debounce. Without this, some `onMarkerChanged` events can get dropped -- specifically, when an event gets fired more than 100ms after first listening, in which case the 600ms cleanup setTimeout fires while the 500ms debounce timeout is still pending.
Fixes microsoft#47386 This sets the `flushOnListenerRemove` option to true for the call to Event.debounce. Without this, some `onMarkerChanged` events can get dropped -- specifically, when an event gets fired more than 100ms after first listening, in which case the 600ms cleanup setTimeout fires while the 500ms debounce timeout is still pending.
Fixes microsoft#47386 This sets the `flushOnListenerRemove` option to true for the call to Event.debounce. Without this, some `onMarkerChanged` events can get dropped -- specifically, when an event gets fired more than 100ms after first listening, in which case the 600ms cleanup setTimeout fires while the 500ms debounce timeout is still pending.
Fixes microsoft#47386 This sets the `flushOnListenerRemove` option to true for the call to Event.debounce. Without this, some `onMarkerChanged` events can get dropped -- specifically, when an event gets fired more than 100ms after first listening, in which case the 600ms cleanup setTimeout fires while the 500ms debounce timeout is still pending.
Fixes microsoft#47386 This sets the `flushOnListenerRemove` option to true for the call to Event.debounce. Without this, some `onMarkerChanged` events can get dropped -- specifically, when an event gets fired more than 100ms after first listening, in which case the 600ms cleanup setTimeout fires while the 500ms debounce timeout is still pending.
Fixes microsoft#47386 This sets the `flushOnListenerRemove` option to true for the call to Event.debounce. Without this, some `onMarkerChanged` events can get dropped -- specifically, when an event gets fired more than 100ms after first listening, in which case the 600ms cleanup setTimeout fires while the 500ms debounce timeout is still pending.
Does this have any relation to the |
…183271) Fixes #47386 This sets the `flushOnListenerRemove` option to true for the call to Event.debounce. Without this, some `onMarkerChanged` events can get dropped -- specifically, when an event gets fired more than 100ms after first listening, in which case the 600ms cleanup setTimeout fires while the 500ms debounce timeout is still pending. Co-authored-by: Megan Rogge <merogge@microsoft.com>
I expect typescript errors from all files to show until they have been fixed.
Instead, they disappear as soon as the document is closed again (e.g. by randomly clicking on the error list, which causes documents to open & close again)
Steps to Reproduce:
What I have tried:
The "best" in my trial and error endevour I have got was that the errors just persisted, even when fixed, lol :)
My user settings (don't have workspace settings)
Does this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: