Skip to content

Instantly share code, notes, and snippets.

Last active June 18, 2021 18:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save brandongregoryscott/a99b9a83478ce37145cdf978a9b81a51 to your computer and use it in GitHub Desktop.
A collection of common VS Code Extension API examples
// Register a command and binding it to a handler function
const handleUpdateText = () => {
console.log("Running command handler for 'updateText'");
vscode.commands.registerCommand("myExtension.updateText", handleUpdateText);
// Show an informational toast message to the user
vscode.window.showInformationMessage("This is an informational toast - don't overuse this!");
// Show a warning toast message to the user
vscode.window.showWarningMessage("This is a warning toast - don't overuse this!");
// Show an error toast message to the user
vscode.window.showErrorMessage("This is an error toast - don't overuse this!");
// Ask the user for a value via an input box
const name: string | undefined = await vscode.window.showInputBox({
prompt: "Enter your name to continue:"
// Ask the user to select a value from a dropdown
const fruitSelection: string | undefined = await vscode.window.showQuickPick([
// Retrieve the current settings object ("kazoo" is the key to retrieve)
const settings: unknown = vscode.workspace.getConfiguration().get("kazoo");
// Retrieve a strongly typed settings object
interface ExtensionConfiguration {
cultureFilePaths: string[];
cultureInterfacePath: string;
insertionPosition: InsertionPosition;
const settings: ExtensionConfiguration = vscode.workspace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment