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

Diagnostic diff #204

Merged
merged 5 commits into from
Oct 12, 2020
Merged

Diagnostic diff #204

merged 5 commits into from
Oct 12, 2020

Conversation

TwitchBronBron
Copy link
Member

@TwitchBronBron TwitchBronBron commented Oct 11, 2020

The original diagnostic functionality would send the entire list of diagnostics, for every file, after every validate. For a project with a large number of diagnostics, this causes extremely poor performance anytime the diagnostic window is open, because the VSCode diagnostic window re-renders every diagnostic since the references have all changed (since we sent new copies of everything).

This PR fixes that problem by only sending messages for files whose diagnostics have changed. If a file's diagnostics haven't changed since the last time they were sent, that file is skipped. Files with added/changed/removed diagnostics are the only ones that will be updated.

VSCode handles diagnostics on a file-by-file basis, so by "skipping" a file when sending diagnostics, this causes that the file's previous diagnostics to persist.

Notable changes:

  • created new DiagnosticCollection that handles tracking the previous diagnostic landscape, and generates a diff of the current diagnostics compared to the previous one.

@@ -57,7 +56,7 @@ export class StdlibArgument implements Argument {
}

/** A fake location exists only within the BRS runtime. */
static InternalRange = util.createRange(-1, -1, -1, -1);
static InternalRange = Range.create(-1, -1, -1, -1);
Copy link
Member Author

@TwitchBronBron TwitchBronBron Oct 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was to work around a ts-node mocha testing circular reference issue that only showed up during local debugging of BrighterScript. Not related to the main purpose of the PR, but I needed to fix it so I figured I would include it.

@TwitchBronBron TwitchBronBron merged commit 314d85d into master Oct 12, 2020
@TwitchBronBron TwitchBronBron deleted the diagnostic-diff branch October 12, 2020 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant