-
Notifications
You must be signed in to change notification settings - Fork 465
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
Fix: cleaning previewHtml api calling logic #677
Conversation
Hi @Raymondd, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
TTYL, MSBOT; |
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.
Tentatively approving, but would like to be convinced we're not double updating as this is wasteful / costly as it double-reloads. Also consider the error handling.
if (this.doesResultPaneExist(resultsUri)) { | ||
// Implicity Use existing results window by not providing a pane | ||
previewCommandPromise = vscode.commands.executeCommand('vscode.previewHtml', resultsUri, paneTitle); | ||
// Update the existing results pane with the given reusltsUri |
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.
typo: resultsUri
// Implicity Use existing results window by not providing a pane | ||
previewCommandPromise = vscode.commands.executeCommand('vscode.previewHtml', resultsUri, paneTitle); | ||
// Update the existing results pane with the given reusltsUri | ||
this.update(vscode.Uri.parse(resultsUri)); |
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.
Aren't we already calling this in another file? Won't this double-reload? I'm basically wondering if we need to do anything in this case
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 is also being called directly after a query is run, so yeah it is being double reloaded. I will remove this one.
} | ||
let resultPaneColumn = this.newResultPaneViewColumn(); | ||
// Open new window then reset focus back to the editor | ||
vscode.commands.executeCommand('vscode.previewHtml', resultsUri, resultPaneColumn, paneTitle).then(() => { |
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.
How about we add in some error handling this time? At least log to the output channel if something unexpected happens...
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.
Adding error catching and logging.
Fixes #676 .
this.doesResultPaneExist(resultsUri)
is still present(This issue is going to be raised to the vscode team, because it looks like it is a bug in the
vscode.workspace.textDocuments
api call which is not able to find hidden previewHtml documents)