forked from cursorless-everywhere/cursorless
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a status bar item for cursorless (cursorless-dev#881)
* first pass at status bar item * capitalize cursorless Co-authored-by: Pokey Rule <[email protected]> * add showDocumentation command Co-authored-by: Pokey Rule <[email protected]>
- Loading branch information
Showing
7 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import * as vscode from "vscode"; | ||
import { Graph } from "../typings/Types"; | ||
|
||
export default class StatusBarItem { | ||
private disposables: vscode.Disposable[] = []; | ||
|
||
constructor(private graph: Graph) { | ||
graph.extensionContext.subscriptions.push(this); | ||
} | ||
|
||
init() { | ||
const commandId = "cursorless.showQuickPick"; | ||
const statusBarItem = vscode.window.createStatusBarItem( | ||
vscode.StatusBarAlignment.Right, | ||
100 | ||
); | ||
statusBarItem.command = commandId; | ||
statusBarItem.text = "$(cursorless-icon) Cursorless"; | ||
statusBarItem.show(); | ||
|
||
this.disposables.push( | ||
vscode.commands.registerCommand("cursorless.showDocumentation", () => | ||
vscode.env.openExternal( | ||
vscode.Uri.parse("https://www.cursorless.org/docs/") | ||
) | ||
), | ||
vscode.commands.registerCommand(commandId, this.showQuickOpen), | ||
statusBarItem | ||
); | ||
} | ||
|
||
private showQuickOpen = () => | ||
vscode.commands.executeCommand("workbench.action.quickOpen", ">Cursorless"); | ||
|
||
dispose() { | ||
this.disposables.forEach(({ dispose }) => dispose()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters