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

vscode.workspace.textDocuments call does not return hidden previewHtml documents #20075

Closed
Raymondd opened this issue Feb 6, 2017 · 2 comments
Assignees
Labels
api *duplicate Issue identified as a duplicate of another issue(s)

Comments

@Raymondd
Copy link

Raymondd commented Feb 6, 2017

  • VSCode Version: 1.9.0
  • OS Version: Win10 and MacOS

Steps to Reproduce:
Configuration to connect to SQL from the extension
Reference: #19732

Repro steps - execute 2 separate queries
Highlight the text select * from sys.databases and execute MS SQL: Execute Query (Ctrl+Shift+E) to run
You will notice the results editor tab opens, which is a WebView component.
1

Hide this webview behind the .sql document you just created:
2

Highlight the text select * from sys.tables and execute the MS SQL: Execute Query

Expected:
The results editor tab is found, brought to the foreground, and refreshed.

Actual:
The results editor tab is not found and not refreshed. A new results tab with the same URI is opened in the second pane.
3

Note that, if you have the results tab in the foreground, it is always found and refreshed properly.
The reason this is not happening is because this slice of code tells us if there is one already open or not:

    public doesResultPaneExist(resultsUri: string): boolean {
        let resultPaneURIMatch = vscode.workspace.textDocuments.find(tDoc => tDoc.uri.toString() === resultsUri);
        return (resultPaneURIMatch !== undefined);
    }

vscode.workspace.textDocuments contains all text documents, regardless of if they are visible or not, but it does not contain all previewHtml documents. It only contains the previewHtml documents that are visible. (In other words, any previewHtml documents which are not visible are not found in vscode.workspace.textDocuments which is inconsistent with other types of text documents)

@mjbvz
Copy link
Collaborator

mjbvz commented Feb 7, 2017

@bpasero can you please take a look.

This issue also effects the markdown preview (see issues like #8581). When I looked through the implementation in VSCode, I believe the current behavior may have been by design but perhaps we need a way to return all documents including html previews.

@jrieken
Copy link
Member

jrieken commented Feb 9, 2017

Closing this as dupe of #15178 which is about knowing what tabs (tab != editors != documents) are open. Ultimately we should migrate folks from the dark side and enable actual UX extensions

@jrieken jrieken closed this as completed Feb 9, 2017
@jrieken jrieken added the *duplicate Issue identified as a duplicate of another issue(s) label Feb 9, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api *duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

4 participants