-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fixes for stale, misattributed, and incorrect diagnostics #6
Conversation
@@ -187,33 +190,35 @@ public void didChange(DidChangeTextDocumentParams params) { | |||
File tempFile = null; | |||
|
|||
try { | |||
tempFile = File.createTempFile("smithy", SmithyProject.SMITHY_EXTENSION); | |||
if (params.getContentChanges().size() > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, tempFile
would be set before .get(0)
blows up, and Option.ofNullable
will not be reliable (it will have a filename, but the file will be empty)
Either<Exception, SmithyProject> loadedModel = this.project.recompile(path); | ||
String changedFileUri = original.map(File::getAbsolutePath).orElse(path.getAbsolutePath()); | ||
|
||
public void report(Either<String, List<PublishDiagnosticsParams>> result) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporting and recompilation are now separate, to aid with testing and general declutter.
Issue #, if available:
Description of changes:
didChange
. Instead:this.project
) if we're not working with real files (as in the case ofdidOpen
anddidSave
). This prevents stale diagnostics from accumulating with every change until the user presses Save.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.