Skip to content

Commit

Permalink
add statusbar (#468, #458)
Browse files Browse the repository at this point in the history
  • Loading branch information
shalldie committed Oct 9, 2024
1 parent 1ed1cbb commit ff2b458
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import vscode from 'vscode';
import vscode, { MarkdownString, StatusBarAlignment, StatusBarItem } from 'vscode';
import { Background } from './background';
import { EXTENSION_ID, VERSION } from './constants';
import { vsHelp } from './utils/vsHelp';

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed

export const statusbar: StatusBarItem = (() => {
const item: StatusBarItem = vscode.window.createStatusBarItem(StatusBarAlignment.Right);

item.command = 'extension.background.showAllCommands';
item.name = 'Background';
item.text = '$(file-media) Background';
item.tooltip = new MarkdownString(['#### Background', 'Show all background commands.'].join('\n'));
item.show();

return item;
})();

export async function activate(context: vscode.ExtensionContext): Promise<void> {
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
Expand Down Expand Up @@ -54,6 +67,13 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
}
})
);

context.subscriptions.push(
vscode.commands.registerCommand(statusbar.command as string, async () => {
vscode.commands.executeCommand('workbench.action.quickOpen', '> background: ');
})
);
context.subscriptions.push(statusbar);
}

// this method is called when your extension is deactivated
Expand Down

0 comments on commit ff2b458

Please sign in to comment.