Home > Blockchain >  VSCode StatusBar button creation in extension
VSCode StatusBar button creation in extension

Time:06-24

How do I add a button in my VSCode extension which you can click like this: enter image description here

What I've tried is:

const pres = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left)
pres.text = 'Click to Connect to Discord Presence'
pres.command = 'test-extension.presence'
pres.show()

but that doesn't seem to work, It does show when I run the command in CTRL SHIFT P/Command Pallete, but how do I make the button show without needing to run the command first?

CodePudding user response:

Set the activation of the extension to "*" in package.json and create the status bar button in the activate() function

  • Related