Send diagnostics for all open files
We want TS LSP server to sent diagnostics for all currently open files.
There's already been a discussion about it https://github.com/sourcegraph/javascript-typescript-langserver/issues/186 but it's been decided to send diagnostics per file. In that case if the IDE wants to keep updated information about open files it should constantly sent lots of requests to LSP server.
So posting diagnostics not for all files in project but only for the open ones seems like a reasonable compromise. This behavior is similar to what VSCode does. Basically it helps showing errors for all currently open files and handles the situations when some file is fixed by changes in another file (for example in import).
We want to have the following behavior:
- When the file is opened and didOpen is sent, file path is stored in the project configuration openFiles set.
- When the file is opened (didOpen) or edited (didChange) the diagnostics is posted by LSP server for all the open files that are currently open.
- When the file is closed (didClose) the empty diagnostics is sent (i.e. errors in this file are no longer tracked by the server) and it's removed from project configuration openFiles.
Codecov Report
Merging #499 into master will increase coverage by
0.01%. The diff coverage is92.3%.
@@ Coverage Diff @@
## master #499 +/- ##
==========================================
+ Coverage 83.09% 83.11% +0.01%
==========================================
Files 15 15
Lines 2053 2061 +8
Branches 488 421 -67
==========================================
+ Hits 1706 1713 +7
- Misses 345 346 +1
Partials 2 2
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/diagnostics.ts | 68.42% <100%> (ø) |
:arrow_up: |
| src/typescript-service.ts | 85.2% <100%> (+0.04%) |
:arrow_up: |
| src/project-manager.ts | 87.01% <83.33%> (-0.06%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update d9a9984...7c2faf4. Read the comment docs.