-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
#22 Check if file exists before calling openTextDocument. #34
#22 Check if file exists before calling openTextDocument. #34
Conversation
2 Tests will fail due to master code. There is another pr open fixing this. |
@@ -128,6 +129,11 @@ class ReferenceProvider { | |||
if (!newUriPath.match(/\.js$/i)) newUriPath += '.js'; | |||
|
|||
const newUri = vscode.Uri.file(newUriPath); | |||
|
|||
if (!fs.existsSync(newUri.fsPath)) { |
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.
This was a previously suggested solution. Instead of slowing down response with a sync call, it would be better to find a faster solution.
In fact we are using vscode API properly and handle the rejection. But vscode still throws a [uncaught exception]: [object Object]
.
Maybe we should report this.
A quick fix will be a try-catch block IMO.
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.
I tried that in my previous PR and could not suppress the error with a try catch hence this solution. I also tried looking into the vscode api documentation as you said its handled as expected. If you really think this (drastically) slows down the plugin I would just leave this bug for now as a known issue.
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.
Thank you for the information. I don't think it is critical, but why add a few ms to the critical path? I suggest to leave as a known issue and report on vscode.
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.
If its not critical I completely agree. Since it's reported and seemed like an easy fix I thought lets apply the change.
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.
Let us just wrap it with a try-catch block.
Opened an issue on vscode end. |
No description provided.