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

Fix: cleaning previewHtml api calling logic #677

Merged
merged 3 commits into from
Feb 6, 2017
Merged

Conversation

Raymondd
Copy link
Contributor

@Raymondd Raymondd commented Feb 4, 2017

Fixes #676 .

  • Only calling this.update when a results pane is already open
  • Bug where an open results pane that is hidden cannot be found by 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)

@Raymondd Raymondd added the Bug label Feb 4, 2017
@Raymondd Raymondd added this to the MSSQL Preview Release 3 milestone Feb 4, 2017
@Raymondd Raymondd self-assigned this Feb 4, 2017
@msftclas
Copy link

msftclas commented Feb 4, 2017

Hi @Raymondd, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!


It looks like you're a Microsoft contributor (Raymond Martin). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

Copy link
Contributor

@kevcunnane kevcunnane left a 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
Copy link
Contributor

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));
Copy link
Contributor

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

Copy link
Contributor Author

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(() => {
Copy link
Contributor

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...

Copy link
Contributor Author

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.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 62.241% when pulling c6fa403 on fix/previewHtmlApiUsage into 13cf99e on dev.

@Raymondd Raymondd merged commit 1e0c95c into dev Feb 6, 2017
@benrr101 benrr101 deleted the fix/previewHtmlApiUsage branch March 1, 2017 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants