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

bazel-stack-vscode-api

v1.2.2

Published

API for the bazel-stack-vscode extension

Downloads

4

Readme

bazel-stack-vscode API

This package contains the APIs used to interact with the bazel-stack-vscode extension.

Implementing Problem Matchers

Problem matchers can be registered with the bazel-stack-vscode extension to extend its diagnostic capabilities. Problem Matchers are named regular expressions that are used to match lines in the stdout/stderr of a particular tool. Matching results are displayed in the editor making it easy to see and navigate to problem areas in a source file.

For example, consider the proto_library rule. When a rule of this class is executed, a ProtoCompile action is spawned that performs the actual work and runs the protoc tool (the name ProtoCompile is called the action mnemonic). The protoc tool complains about errors in a format like proto/example.proto:111:17: Field number 5 has already been used in "foo.Message" by field "finished".

The corresponding problem matcher associates the mnemonic name ProtoCompile with a regular expression (as well as metadata that instructs how to map the matching parts into meaningful tokens):

{
    "name": "ProtoCompile",
    "fileLocation": [
        "relative",
        "${workspaceRoot}"
    ],
    "pattern": [
        {
            "regexp": "(.*):(\\d+):(\\d+): (.*)$",
            "file": 1,
            "line": 2,
            "column": 3,
            "message": 4
        }
    ]
}

Note that the format & design of problem matchers is nearly identical to https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher. Please refer to that documentation for more specifics about the format.

To register the same matcher under multiple names, use a comma-separated list for the name: field (e.g. ProtoCompile,GenProtoDescriptorSet).

Creating a Problem Matcher Extension

For example, let's say you are working with haskell, and you'd like to make it easier to find problems in ghc output. Here are the steps you'd take to create this extension:

  1. Fork an existing example such as stackb/bazel-stack-vscode-go.
  2. Replace the name to match the language or tool: s/bazel-stack-vscode-rules-go/bazel-stack-vscode-rules-haskell/g.
  3. Delete the golang problem matchers in package.json and replace with your tool specific matchers in your package.json. In order to do this properly, you'll need to know the mnemonic names of the actions spawned by haskell rules and ensure these are an exact string match (the mnemonic name of the action is used to find the correct problem matcher).
  4. Make sure your problem matcher definitions have tests. The API has a test runner that makes it easy to write tests with examples.
  5. Publish your extension to the vscode marketplace.
  6. Install the extension within vscode. At extension load time, your extension will find the bazel-stack-vscode extension and populate it with your problem matchers. At runtime, these problem matchers will be used to create tool-specific diagnostics.

Problem Matcher Extensions