Skip to content

Commit 47242a3

Browse files
charlwillia6cwilliams
andauthored
Fix: only show Current File for file scheme editors (#255)
Prevents invalid file paths from appearing in the Current File button when clicking on non-file editors like Output panel or Terminal. Now checks editor's URI scheme to ensure it's a valid file before updating the active file path. Co-authored-by: cwilliams <[email protected]>
1 parent b5e5732 commit 47242a3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

extensions/vscode/src/ideProtocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class VsCodeIde implements IDE {
6666

6767
onDidChangeActiveTextEditor(callback: (filepath: string) => void): void {
6868
vscode.window.onDidChangeActiveTextEditor((editor) => {
69-
if (editor) {
69+
if (editor?.document.uri.scheme === 'file') {
7070
callback(editor.document.uri.fsPath);
7171
}
7272
});

gui/src/redux/slices/uiStateSlice.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ export const uiStateSlice = createSlice({
5858
state.displayBottomMessageOnBottom = action.payload;
5959
},
6060
setActiveFilePath: (state, action: PayloadAction<UiState["activeFilePath"]>) => {
61-
state.activeFilePath = action.payload ?? "";
61+
// Only set non-empty strings as active file paths
62+
state.activeFilePath = action.payload && action.payload.length > 0 ? action.payload : undefined;
6263
},
6364
},
6465
});

0 commit comments

Comments
 (0)