Skip to content

Commit

Permalink
Add keybinding Ctrl-H to toggle showing hidden files
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjorgensen committed Feb 11, 2024
1 parent 1ccacb9 commit 6399fcc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
18 changes: 17 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,12 @@
"title": "Edit",
"enablement": "code-for-ibmi:connected",
"category": "IBM i"
},
{
"command": "code-for-ibmi.ifs.toggleShowHiddenFiles",
"title": "Toggle hidden files",
"enablement": "code-for-ibmi:connected",
"category": "IBM i"
}
],
"keybindings": [
Expand Down Expand Up @@ -1637,6 +1643,12 @@
"key": "ctrl+r",
"mac": "cmd+r",
"when": "editorLangId == cl"
},
{
"command": "code-for-ibmi.ifs.toggleShowHiddenFiles",
"key": "ctrl+h",
"mac": "cmd+h",
"when": "!editorFocus || editorReadonly"
}
],
"viewsContainers": {
Expand Down Expand Up @@ -1978,7 +1990,11 @@
{
"command": "code-for-ibmi.removeIFSShortcut",
"when": "never"
}
},
{
"command": "code-for-ibmi.ifs.toggleShowHiddenFiles",
"when": "code-for-ibmi:connected && view == ifsBrowser"
}
],
"view/title": [
{
Expand Down
10 changes: 9 additions & 1 deletion src/views/ifsBrowser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import os from "os";
import path from "path";
import vscode, { FileType } from "vscode";
Expand Down Expand Up @@ -715,6 +714,15 @@ export function initializeIFSBrowser(context: vscode.ExtensionContext) {
)
}

vscode.commands.registerCommand(`code-for-ibmi.ifs.toggleShowHiddenFiles`, async function () {
const config = instance.getConfig();
if (config) {
config.showHiddenFiles = !config.showHiddenFiles;
await ConnectionConfiguration.update(config);
vscode.commands.executeCommand("code-for-ibmi.refreshIFSBrowser");
}
});

function handleFileListErrors(errors: string[]) {
errors.forEach(error => vscode.window.showErrorMessage(error));
vscode.window.showErrorMessage(t(`ifsBrowser.handleFileListErrors.errorMessage`, errors.length, errors.length > 1 ? t(`errors`) : t(`error`)));
Expand Down

0 comments on commit 6399fcc

Please sign in to comment.