Well, what shall I say? It’s just fun

Let’s take a look at my VScode extension der resume:

The name pressMusic
Part 1 When codeing, do re mi notes are played
Part 2 When codeing for an hour, there will be a Time for relax sound prompt
Part 3 The bottom status bar of vscode provides a button to pause do re mi music

Use a name search to find and install ~

After installation in the editor to play: “qqttyytrreewwqttrreewttrreewqqttyytrreewwq” – are you sure you heard ~ ~ HHHHH

How is it done?

Tip 1: Listen for keyboard events

Vscode does not provide a way to listen for keyboard events, but onDidChangeTextDocument can do the same. vscode.workspace.onDidChangeTextDocument(onDidChangeTextDocument)

Tip 2: Play prepared audio

Spawn (this.player, videoPath, options) spawn(this.player, videoPath, options)

Tip 3: Set the bottom state item

Create an item using the createStatusBarItem method provided by vscode. statusBarPause = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 300);

Tip 4: Bind the bottom item function

  • You need to register a command:vscode.commands.registerCommand(pauseCommandId, onchangeVolume)
  • Mount this command to the above item:statusBarPause.command = pauseCommandId

Very simple, attach the full source codehere