javascript-typescript-langserver icon indicating copy to clipboard operation
javascript-typescript-langserver copied to clipboard

Send diagnostics for all open files

Open jzashch opened this issue 7 years ago • 1 comments

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:

  1. When the file is opened and didOpen is sent, file path is stored in the project configuration openFiles set.
  2. 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.
  3. 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.

jzashch avatar Aug 09 '18 15:08 jzashch

Codecov Report

Merging #499 into master will increase coverage by 0.01%. The diff coverage is 92.3%.

Impacted file tree graph

@@            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 data Powered by Codecov. Last update d9a9984...7c2faf4. Read the comment docs.

codecov-io avatar Aug 09 '18 16:08 codecov-io