Skip to content

View as Text from the Command Palette opens the dictionary's text - #193

Merged
ww-mw merged 2 commits into
mainfrom
fix/view-as-text-palette
Nov 2, 2026
Merged

ww-mw merged 2 commits into
mainfrom
fix/view-as-text-palette

Conversation

@ww-mw

@ww-mw ww-mw commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

The Command Palette runs a command with no argument. It lists View as Text only while a table has focus (resourceExtname == .sldd && activeCustomEditorId == dataExplorer.tableView), and a table is a webview, so vscode.window.activeTextEditor is undefined then: dataExplorer.viewAsText found no file and returned without doing anything. dataExplorer.viewAsTable had the same fallback.

Fix (src/extension.ts): activeResourceUri() takes the file from the active tab (TabInputCustom or TabInputText, .uri), then from activeTextEditor. Both toggle commands use it when called with no argument; the editor/title buttons still pass the file and are unchanged.

Tests (test-integration/suite/toggle.test.ts), committed alone first:

  • View as Text with no argument on a JSON dictionary's table opens its text as a second tab (TabInputText). Failed on unchanged src/ (run 41357910826: "timed out after 20000ms waiting for the plain text editor for the URI to become active"); passes with the fix.
  • View as Table with no argument from the text editor opens the table beside it (passed before and after).
  • View as Table with no argument on a compressed dictionary already in its table (binarySlddView, which the palette's resourceExtname == .sldd also matches) leaves the one tab as it is (passed before and after: before, nothing ran; now its best editor is the one it is in).

CI: red 41357910826 (test only: 211 passing, 1 failing), green 41358267708 (212 passing, 9 pending). Unit: 1305 passed.

CHANGELOG: one bullet under a new ## Unreleased heading. No release.

ww-mw added 2 commits November 1, 2026 17:35
The palette runs a command with no argument, and lists View as Text only
while a table has focus. A table is a webview, so there is no active text
editor to take the file from, and the command does nothing. The new test
opens the JSON dictionary's table, runs View as Text with no argument and
expects its text in a second tab: it fails on this commit.

Two more pin the palette's View as Table: from a text editor it opens the
table beside it, and on a compressed dictionary already in its table it
leaves the one tab as it is.
The palette passes no argument, and both toggle commands fell back to the
active text editor's document. The palette lists View as Text only while a
table has focus, when there is no active text editor (a table is a
webview), so the command found no file and did nothing.

Both commands now take the file from the active tab, a custom editor's or
a text editor's, and only then from the active text editor.
ww-mw added a commit that referenced this pull request Nov 2, 2026
Both add ## Unreleased to CHANGELOG.md: one heading now, #193's bullet first, then this one's.
@ww-mw
ww-mw merged commit 3c11376 into main Nov 2, 2026
4 checks passed
@ww-mw
ww-mw deleted the fix/view-as-text-palette branch November 2, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant