eclipse-theia/theia

vscode.window.visibleTextEditors does not work correctly when opening a webview

Open

#10,189 建立於 2021年9月29日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)TypeScript (18,676 star) (2,478 fork)batch import
help wantedvscode

描述

Bug Description:

Hi, I am building a vscode extension to be used in Theia, and I think the vscode.window.visibleTextEditors does not work as expected. Once opening a non-text editor tab (custom editor OR any web view or just the getting started page for example), and then trying to fetch the visibleTextEditors, I still get the last INVISIBLE text editor!

I need this functionality in order to post a message to the active/visible editor that could be a normal text editor or any web-view, but from both vscode.window.activeTextEditor and vscode.window.visibleTextEditors APIs I can't determine the type of the currently opened tab (I can manage my custom editor visibility by used the onDidChangeViewState event).

Also, the visible/active editor changer should affect the status bar and the scode.window.onDidChangeVisibleTextEditors event.

Steps to Reproduce:

  1. regester a command that executes this code: vscode.window.visibleTextEditors.forEach(e=>vscode.window.showInformationMessage(e.document.uri.fsPath));
  2. open 2 text editors
  3. call the command, you will get the visible editor path
  4. open the Preferences tab or the Getting started page, and then call the command again, you will get the last active text editor tab although it is not visible.

Additional Information

  • Operating System: Windows 10
  • Theia Version: Theia 1.16

貢獻者指南