Trying to populate a DiagnosticCollection
progressively results in excessive calls to CodeAction provider.ย #199724
Description
Version: 1.84.2 (user setup)
Commit: 1a5daa3
Date: 2023-11-09T10:51:52.184Z
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22631
I'm reworking how the C/C++ extension populates diagnostics (and inlay hints, semantic tokens, etc.), to progressively populate the document as additional results are available.
It looks like DiagnosticCollection
does not currently provide an efficient way to add Diagnostic
's to an existing set. It's necessary to get the array of Diagnostic
s, make a change, then set it again. I'm seeing that, with a large file, and several iterations of augmenting that list of diagnostics, that I get redundant (expensive) requests to provide CodeAction
's for Diagnostic
s that are not 'new'. Also, if the user clicks on that bit of code, they will see the CodeAction
lightbulb disappear out from under them when unnecessarily regenerated.
Perhaps this could be addressed by adding an 'add' function to DiagnosticCollection
, or maybe keeping a cached list of existing Diagnostics
to avoid redundantly requesting CodeAction
s for.
Activity