npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vscode-commands

v1.0.0

Published

Trigger arbitrary commands from the statusbar. Supports passing arguments!

Downloads

22

Readme

VSC Commands

Trigger arbitrary commands from the statusbar. Supports passing arguments!

It comes packed with a lot of features:

  • Supports passing arguments: No other extension of this kind supports passing arguments to commands. This feature makes it quite powerful, for instance adding the ability to trigger custom terminal commands via Terminals, more about it below.
  • Configuration based: No need to create an extension just for adding some simple items to the statusbar, just edit the configuration.
  • Global and local commands: Define commands in your settings to make them global, define them in a local configuration file to make them project-specific.
  • Configurable: Many aspects of the statusbar items can be configured, including text, tooltip, color, position etc.
  • Per language commands: Show a particular statusbar item only if the currently opened file's language matches a provided regex.
  • Per file commands: Show a particular statusbar item only if the currently opened file's path matches a provided regex.

Install

Run the following in the command palette:

ext install vscode-commands

Usage

It adds 2 commands to the command palette:

Commands: Edit Configuration // Open the local configuration file
Commands: Refresh // Force a refresh, must be called after editing the local configuration

Configuration

Run the Commands: Edit Configuration command to create the local configuration file. If you want to define global commands simply add them to your Visual Studio Code settings under the key commands.commands.

The configuration is an object that looks like this, most options are optional:

{
  "commands": [ // Array of commands
    { // An object describing a command, most entries are optional
      "alignment": "left", // Should the item be placed to the left or right?
      "priority": 0, // The priority of this item. Higher value means the item should be shown more to the left.
      "color": "#FFCC00", // The foreground color for this item.
      "text": "$(gear) Settings", // The text to show for the entry
      "tooltip": "Open User Settings", // The tooltip text when you hover over this item.
      "command": "workbench.action.openGlobalSettings", // Command to execute.
      "arguments": [1, 2, 3], // Arguments to pass to the command handler.
      "filterLanguageRegex": "markdown", // Show only if current file's language matches this regex. Requires double escaping.
      "filterFileRegex": ".*\\.ext", // Show only if the current file's path matches this regex. Requires double escaping.
    }
  ]
}

Examples

Click on the description to see the configuration used to achieve that particular result.

Simple commands

{
  "text": "$(chevron-right)",
  "command": "workbench.action.showCommands",
  "tooltip": "Show commands"
},
{
  "text": "$(gear)",
  "command": "workbench.action.openGlobalSettings",
  "tooltip": "Settings"
},
{
  "text": "Zen",
  "command": "workbench.action.toggleZenMode",
  "tooltip": "Toggle zen mode"
}

Basic

{
  "text": "$(file-code) New file",
  "command": "workbench.action.files.newUntitledFile",
  "tooltip": "New file"
},
{
  "text": "$(checklist) Save all",
  "command": "workbench.action.files.saveAll",
  "tooltip": "Save all files"
}

File-Related

{
  "text": "$(markdown)",
  "command": "markdown.showPreviewToSide",
  "tooltip": "Open markdown preview",
  "filterFileRegex": ".*\\.md"
}

Markdown

Implementing existing extensions' functionality

{
  "text": "$(terminal) 1",
  "command": "workbench.action.terminal.focusAtIndex1",
  "tooltip": "Focus to terminal #1"
},
{
  "text": "$(terminal) 2",
  "command": "workbench.action.terminal.focusAtIndex2",
  "tooltip": "Focus to terminal #2"
},
{
  "text": "$(terminal) 3",
  "command": "workbench.action.terminal.focusAtIndex3",
  "tooltip": "Focus to terminal #3"
}

Terminal Tabs

{
  "text": "$(file-directory)",
  "command": "workbench.view.explorer",
  "tooltip": "Explorer"
},
{
  "text": "$(search)",
  "command": "workbench.view.search",
  "tooltip": "Search"
},
{
  "text": "$(repo-forked)",
  "command": "workbench.view.scm",
  "tooltip": "Source Control"
},
{
  "text": "$(bug)",
  "command": "workbench.view.debug",
  "tooltip": "Debug"
},
{
  "text": "$(package)",
  "command": "workbench.view.extensions",
  "tooltip": "Extensions"
}

Activitus Bar

{
  "text": "$(triangle-right)",
  "command": "workbench.action.debug.start",
  "tooltip": "Start debugging"
},
{
  "text": "$(primitive-square)",
  "command": "workbench.action.debug.stop",
  "tooltip": "Stop debugging"
}

StatusBar Debugger

Plays well with others

{
  "text": "$(file-submodule)",
  "command": "projects.open",
  "tooltip": "Open a project"
},
{
  "text": "Projects+",
  "command": "projects.openByName",
  "arguments": ["vscode-projects-plus"],
  "tooltip": "Open Projects+"
},
{
  "text": "Todo+",
  "command": "projects.openByName",
  "arguments": ["vscode-todo-plus", true],
  "tooltip": "Open Todo+ in a new window"
},
{
  "text": "My Group",
  "command": "projects.openByName",
  "arguments": ["My Group", false, true],
  "tooltip": "Switch to the My Group"
}

Projects+

{
  "text": "$(check)",
  "command": "todo.open",
  "tooltip": "Open todo"
},
{
  "text": "$(checklist)",
  "command": "projects.todo",
  "tooltip": "Open global todo",
  "filterLanguageRegex": "todo"
}

Todo+

{
  "text": "$(terminal)",
  "command": "terminals.runTerminal",
  "tooltip": "Run a terminal"
},
{
  "text": "Init",
  "command": "terminals.runTerminalByName",
  "arguments": ["init"],
  "tooltip": "Init the project"
},
{
  "text": "Serve",
  "command": "terminals.runTerminalByName",
  "arguments": ["serve"],
  "tooltip": "Serve the project"
}

Terminals

Hits:

  • Icons: here you can browse a list of supported icons. If for instance you click the first icon, you'll get a page with .octicon-alert written in it, to get the string to use simply remove the .octicon- part, so in this case the icon name would be alert.
  • Live Refresh: Even if you're crafting some local commands, it's advisable to start by adding them globally, since every time you edit your global settings your commands will be automatically refresh. Once you're done just move them to the local configuration file.

License

MIT © Fabio Spampinato