Bug Description
svn.openFile does nothing when triggered via keyboard shortcut from the diff editor.
The icon tooltip correctly shows the keybinding, but pressing the keys has no effect.
Steps to Reproduce
- Open an SVN-tracked file and trigger a diff view (e.g., via "Open Changes with BASE")
- Assign a keybinding to
svn.openFile in keybindings.json
- While in the diff editor, press the assigned keyboard shortcut
- Nothing happens — the working copy file is NOT opened
Clicking the $(go-to-file) icon in the editor title bar works correctly.
Root Cause
In src/commands/openFile.ts, when the command is invoked without arguments
(which is the case for keyboard shortcuts), the getSCMResource() fallback is
commented out, causing uris to remain undefined and the function to return early:
if (!(resource instanceof Resource)) {
// can happen when called from a keybinding
// TODO(@JohnstonCode) fix this
// resource = this.getSCMResource(); ← this is never called
}
if (resource) { ... } // resource is undefined, skipped
if (!uris) { return; } // returns here, nothing opens
## Suggested Fix
When no argument is provided and `window.activeTextEditor` is available,
fall back to the active editor's URI:
```typescript
if (!(resource instanceof Resource)) {
const activeEditor = window.activeTextEditor;
if (activeEditor) {
const uri = activeEditor.document.uri;
if (uri.scheme === "svn") {
uris = [Uri.file(fromSvnUri(uri).fsPath)];
} else if (uri.scheme === "file") {
uris = [uri];
}
}
}
Environment
- VS Code: latest
- Extension version: 2.17.0
- OS: Windows
Bug Description
svn.openFiledoes nothing when triggered via keyboard shortcut from the diff editor.The icon tooltip correctly shows the keybinding, but pressing the keys has no effect.
Steps to Reproduce
svn.openFileinkeybindings.jsonClicking the
$(go-to-file)icon in the editor title bar works correctly.Root Cause
In
src/commands/openFile.ts, when the command is invoked without arguments(which is the case for keyboard shortcuts), the
getSCMResource()fallback iscommented out, causing
uristo remainundefinedand the function to return early:Environment