Repository navigation
Add Open in Wiki Site to the Explorer and editor-tab right-click menus - #55
Merged
Merged
Conversation
Each wiki scan publishes its files as the workspaceWiki.indexedFiles context key, and the new explorer/context and editor/title/context entries show only for files in it. Before the first scan they show for every Markdown file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
An older scan can overwrite the newer menu index, and the tests do not verify Explorer or editor-tab visibility in VS Code.
2 open issues
What changed in this PR
Adds Open in Wiki Site to the Explorer and editor-tab context menus, extending the existing Workspace Wiki sidebar action.
Changes:
- Publishes indexed file URIs after each wiki tree load to control menu visibility.
- Adds both menu entries with a Markdown fallback before the first scan.
- Adds context-publication unit tests and updates user and architecture documentation.
| File | Description |
|---|---|
src/tree/loadWikiTree.ts |
Publishes indexed file URIs as a VS Code context key. |
src/tree/loadWikiTree.test.ts |
Tests populated and empty context indexes. |
README.md |
Documents the additional menu locations. |
package.json |
Adds Explorer and editor-tab menu contributions. |
docs/usage/tutorials.md |
Updates instructions for opening individual files. |
docs/architecture/wiki-site.md |
Explains menu visibility and the pre-scan fallback. |
Review effort: Balanced
| "explorer/context": [ | ||
| { | ||
| "command": "workspace-wiki.openInSite", | ||
| "when": "!explorerResourceIsFolder && (resource in workspaceWiki.indexedFiles || (!workspaceWiki.indexedFiles && resourceLangId == markdown))", |
| const tree = await buildTree(uris, directorySort, acronyms); | ||
|
|
||
| const indexedFiles = Object.fromEntries(flattenFiles(tree).map((node) => [node.uri.toString(), true])); | ||
| void vscode.commands.executeCommand('setContext', INDEXED_FILES_CONTEXT, indexedFiles); |
The sidebar and the site each run loadWikiTree, so two scans can overlap. Only the most recently started scan now sets workspaceWiki.indexedFiles, so a slower, older scan cannot overwrite a newer file list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Right-clicking a wiki file in the Explorer or on its editor tab now offers Open in Wiki Site. Before this change, the item was only on the Workspace Wiki sidebar's right-click menu.
The item shows only for files the wiki indexes. Each wiki scan sets the
workspaceWiki.indexedFilescontext key to the scanned file URIs, and the new menu entries testresource in workspaceWiki.indexedFiles.Before the first scan, the item shows for every Markdown file. Choosing it for a file outside the wiki opens the site's existing "This page is not part of the wiki." message.
brag.mp4