Skip to content

Commit

Permalink
add name and prefix for status bar context menu (usernamehw#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
usernamehw committed Mar 20, 2022
1 parent 333859e commit ffaf83d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 10 deletions.
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,27 @@ interface CommandObject {
icon?: string;// icon id https://code.visualstudio.com/api/references/icons-in-labels#icon-listing
iconColor?: string;// color id https://code.visualstudio.com/api/references/theme-color
disableTooltip?: boolean;// do not show the hover tooltip for this Tree View Item
statusBar?: {// add to status bar
alignment: 'left' | 'right';
text: string;
priority?: number;
tooltip?: string;
markdownTooltip?: string;
color?: string;
hidden?: boolean;
};
hidden?: boolean;// Do not show this in Tree View

sequence?: (CommandObject | string)[];// execute multipe commands

nestedItems: {// Group items into a folder (1 lvl max)
[key: string]: CommandObject
}

// add command to status bar
statusBar?: {
alignment: 'left' | 'right';// status bar alignment
text: string;// status bar item text
name?: string;// name of the item in status bar context menu
priority?: number;// item position (can also be a negative number)
tooltip?: string;// hover text
markdownTooltip?: string;// hover text (in markdown)
color?: string;// color of status bar item text
hidden?: boolean;// Do not show this status bar item
};


}
```

Expand Down Expand Up @@ -655,6 +660,8 @@ vscode.diff
vscode.openWith `commands.executeCommand("vscode.openWith", uri, MyCustomEditor.viewType);`
editor.unfold
editor.fold
commands.executeCommand("workbench.extensions.uninstallExtension", "EXTENSION_ID");
commands.executeCommand("workbench.extensions.action.showExtensionsWithIds", ["alefragnani.delphi-keybindings", "alefragnani.delphi-themes"]);
TODO: https://github.com/microsoft/vscode-docs/blob/main/api/references/commands.md Sync changes periodically
-->
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
"right"
]
},
"name": {
"type": "string"
},
"text": {
"type": "string"
},
Expand Down Expand Up @@ -170,6 +173,9 @@
"right"
]
},
"name": {
"type": "string"
},
"text": {
"type": "string"
},
Expand Down Expand Up @@ -236,6 +242,9 @@
"right"
]
},
"name": {
"type": "string"
},
"text": {
"type": "string"
},
Expand Down Expand Up @@ -297,6 +306,9 @@
"right"
]
},
"name": {
"type": "string"
},
"text": {
"type": "string"
},
Expand Down Expand Up @@ -389,6 +401,9 @@
"text": {
"type": "string"
},
"name": {
"type": "string"
},
"priority": {
"type": "number"
},
Expand Down Expand Up @@ -450,6 +465,9 @@
"text": {
"type": "string"
},
"name": {
"type": "string"
},
"priority": {
"type": "number"
},
Expand Down Expand Up @@ -513,6 +531,9 @@
"right"
]
},
"name": {
"type": "string"
},
"text": {
"type": "string"
},
Expand Down Expand Up @@ -574,6 +595,9 @@
"right"
]
},
"name": {
"type": "string"
},
"text": {
"type": "string"
},
Expand Down
2 changes: 1 addition & 1 deletion src/statusBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function updateStatusBarItems(items: TopLevelCommands) {
const alignment = statusBarUserObject.alignment === 'right' ? StatusBarAlignment.Right : StatusBarAlignment.Left;
const newStatusBarItem = window.createStatusBarItem(statusBarUserObject.text, alignment, statusBarUserObject.priority ?? -9999);
let icon = item.icon ? `$(${item.icon}) ` : '';
newStatusBarItem.name = statusBarUserObject.text;
newStatusBarItem.name = `Commands: ${statusBarUserObject.name || statusBarUserObject.text}`;
newStatusBarItem.color = statusBarUserObject.color;

let mdTooltip = new MarkdownString(undefined, true);
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export interface CommandObject {
interface StatusBar {
alignment?: 'left' | 'right';
text: string;
name?: string;
priority?: number;
tooltip?: string;
markdownTooltip?: string;
Expand Down

0 comments on commit ffaf83d

Please sign in to comment.