Skip to content

Commit 6b5049c

Browse files
add tabular.data.viewSettings command for quick navigation to table viewer settings (#71)
1 parent a60af82 commit 6b5049c

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"onLanguage:tsv",
4848
"onCommand:tabular.data.openDataFile",
4949
"onCommand:tabular.data.viewTable",
50+
"onCommand:tabular.data.viewSettings",
5051
"onCustomEditor:tabular.data.tableEditor",
5152
"onWebviewPanel:tabular.data.tableView"
5253
],
@@ -67,6 +68,12 @@
6768
"command": "tabular.data.viewTable",
6869
"title": "View Table",
6970
"category": "Tabular Data"
71+
},
72+
{
73+
"command": "tabular.data.viewSettings",
74+
"title": "View Settings",
75+
"category": "Tabular Data",
76+
"icon": "$(gear)"
7077
}
7178
],
7279
"keybindings": [

src/commands/viewCommands.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
* Tabular data view commands.
33
*/
44
export const enum ViewCommands {
5-
viewTable = 'tabular.data.viewTable',
5+
// table view commands
66
openDataFile = 'tabular.data.openDataFile',
7+
viewTable = 'tabular.data.viewTable',
8+
viewSettings = 'tabular.data.viewSettings',
9+
10+
// built-in vscode commands
11+
workbenchOpenSettings = 'workbench.action.openSettings',
712
vscodeOpen = 'vscode.open'
813
}

src/commands/viewSettings.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {
2+
commands,
3+
ExtensionContext,
4+
Disposable,
5+
Uri
6+
} from 'vscode';
7+
8+
import * as config from '../configuration/configuration';
9+
import { ViewCommands } from './viewCommands';
10+
11+
export async function registerViewSettingsCommand(context: ExtensionContext) {
12+
const viewSettingsCommand: Disposable =
13+
commands.registerCommand(ViewCommands.viewSettings, () => {
14+
commands.executeCommand(ViewCommands.workbenchOpenSettings, config.extensionId);
15+
});
16+
context.subscriptions.push(viewSettingsCommand);
17+
}

src/extension.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ExtensionContext, TextEditor, window } from 'vscode';
22

33
import { registerOpenDataFileCommand } from './commands/openDataFile';
44
import { registerViewTableCommand } from './commands/viewTable';
5+
import { registerViewSettingsCommand } from './commands/viewSettings';
56

67
import { statusBar } from './views/statusBar';
78

@@ -23,6 +24,7 @@ export function activate(context: ExtensionContext) {
2324
// register tabular data viewer commands
2425
registerOpenDataFileCommand(context);
2526
registerViewTableCommand(context);
27+
registerViewSettingsCommand(context);
2628

2729
// register table view serializer for restore on vscode reload
2830
context.subscriptions.push(TableViewSerializer.register(context));

0 commit comments

Comments
 (0)