Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Fix gotype-live errors showing in wrong file#923

Merged
ramya-rao-a merged 5 commits intomicrosoft:masterfrom
tylerstillwater:master
Apr 17, 2017
Merged

Fix gotype-live errors showing in wrong file#923
ramya-rao-a merged 5 commits intomicrosoft:masterfrom
tylerstillwater:master

Conversation

@tylerstillwater
Copy link
Copy Markdown
Contributor

There exists an issue with the live error system in that gotype-live will report errors for all files in the package, but the document change event is only for a single file. As a result, all the errors, for all the files, were being displayed as errors in the current file. This PR fixes that issue.

It may be worthwhile to investigate the possibility of displaying those errors for the correct file.

@tylerstillwater
Copy link
Copy Markdown
Contributor Author

@ramya-rao-a I've just updated the PR to parse the errors from all the files and add them to the appropriate diagnostic set. This allows the live error system to now clear all errors from the errors diagnostic collection and replace them with the live errors coming from gotype.

@tylerstillwater tylerstillwater changed the title Fix gotype-live warnings showing in wrong file Fix gotype-live errors showing in wrong file Apr 13, 2017
@ramya-rao-a
Copy link
Copy Markdown
Contributor

gotype-live will report errors for all files in the package

So in that case, shouldn't we refrain from clearing the errors for files from other packages?

Also, lets enable the live error feature when files.autoSave != 'afterDelay' || files.autoSaveDelay > liv-error delay *1.5 and listen for feedback on how that feels for users

@tylerstillwater
Copy link
Copy Markdown
Contributor Author

tylerstillwater commented Apr 17, 2017 via email

@tylerstillwater
Copy link
Copy Markdown
Contributor Author

@ramya-rao-a as requested, live errors now works under the specified autoSave conditions.

Please let me know if you need anything else before merging. Thanks!


errorDiagnosticCollection.set(uri, diagnostics);
diagnosticMap.forEach((diagnostics, file) => {
errorDiagnosticCollection.set(vscode.Uri.parse('file://' + file), diagnostics);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just curious... why add the prefix file:// before parsing the file to get the uri? vscode.Uri.parse should work with just the file path as well

@tylerstillwater
Copy link
Copy Markdown
Contributor Author

tylerstillwater commented Apr 17, 2017 via email

@ramya-rao-a
Copy link
Copy Markdown
Contributor

thats interesting, i'll look into that separately.

Thanks for the fix!

I'll combine this one with a few other bug fixes and release in a few days

@tylerstillwater
Copy link
Copy Markdown
Contributor Author

Sounds good! Thanks!

@ramya-rao-a ramya-rao-a merged commit 217446d into microsoft:master Apr 17, 2017
@ramya-rao-a
Copy link
Copy Markdown
Contributor

@tylerb I was testing this in Windows and the errors were not getting mapped to the right file. Probably due to issues with path separators while trying to parse file:\\' + file.

08e9c10 to fix the issue.

Just FYI, in case you came across the fix next time you were looking at this file

@tylerstillwater
Copy link
Copy Markdown
Contributor Author

tylerstillwater commented May 2, 2017 via email

@ramya-rao-a
Copy link
Copy Markdown
Contributor

No problem 😊

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants