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

coc-nix

v0.0.2

Published

Nix language support with formatting and error report.

Downloads

134

Readme

nix-ide

Ported from vscode-nix-ide.

Because some APIs of vscode are missing in coc.nvim, disable some features temporarily:

  • validate range: miss vscode.document.validateRange()
  • rerun linter only when document is dirty: miss vscode.document.isDirty
  • open URL of language server: miss vscode.env.openExternal()

Install

" command line
CocInstall coc-nix
" or add the following code to your vimrc
let g:coc_global_extensions = ['coc-nix', 'other coc-plugins']

Adds nix language support for VSCode Editor.

Features

  • Syntax Highlight

    • Thanks to https://github.com/wmertens/sublime-nix for the grammar file

    • Nix code snippets inside markdown files also work.

Language Servers

Full editing support when using a language server. Generally, any nix LSP implementation should work. The following are tested so far:

{
  "nix.enableLanguageServer": true,
  "nix.serverPath": "nil"
  // "nix.serverPath": "nixd"
}

Pass settings to the language server via serverSettings.

{
  "nix.serverSettings": {
    // settings for 'nil' LSP
    "nil": {
      "diagnostics": {
        "ignored": ["unused_binding", "unused_with"]
      },
      "formatting": {
        "command": ["nixpkgs-fmt"]
      }
    }
  }
}
{
    "nix.serverSettings": {
        // settings for 'nixd' LSP
        "nixd": {
            "formatting": {
                "command": [ "nixpkgs-fmt" ]
            },
            "options": {
                // By default, this entriy will be read from `import <nixpkgs> { }`
                // You can write arbitary nix expression here, to produce valid "options" declaration result.
                // Tip: for flake-based configuration, utilize `builtins.getFlake`
                "nixos": {
                    "expr": "(builtins.getFlake \"/absolute/path/to/flake\").nixosConfigurations.<name>.options"
                },
                "home-manager": {
                    "expr": "(builtins.getFlake \"/absolute/path/to/flake\").homeConfigurations.<name>.options"
                }
            }
        }
  }
}

Standalone (No LSP)

When Language Server support is not enabled some tools can still be used.

  • Enable formatting support by setting nix.formatterPath to any command which can accept file contents on stdin and return formatted text on stdout; e.g.,
{
  "nix.formatterPath": "nixpkgs-fmt" // default
  // "nix.formatterPath": "nixfmt"
  // "nix.formatterPath": ["treefmt", "--stdin", "{file}"]
  // "nix.formatterPath": ["nix", "fmt", "--", "-"] // using flakes with `formatter = pkgs.alejandra;`
}
  • Error Report

    • Using nix-instantiate errors reported

    example of linting hover

  • Snippets

Todos

PRs welcome for them

  • embedded language syntax support for bash
  • path completion - https://github.com/ChristianKohler/PathIntellisense

Installation

Visual Studio Code

Hit F1 and enter the ext install jnoortheen.nix-ide command or search for nix-ide.

*.vsix file

The extension can be downloaded from the release page.

Installing the extension Locally

Just clone the GitHub repository under your local extensions folder:

  • Windows: %USERPROFILE%\.vscode\extensions
  • Mac / Linux: $HOME/.vscode/extensions

Contributing

  • Document the purpose of functions and classes.
  • Please mention a new feature in the README.md Features section when adding it. Use screenshots when applicable.
  • Conventional Commit style should be used for commit messages as it is used to generate changelog.

Development

There is direnv and nix-shell support so a dev environment can be created with the nix-shell command or a one-time direnv allow at the root of the repo.

Press F5 in VSCode to run an Extension Development Host instance with the extension installed.

TypeScript is used to develop the extension.

yarn install # install dependencies
yarn build   # build the extension

Releasing a new version

  • fill .env from .env.template
# this is needed to publish extensions to [openvsx](https://open-vsx.org/) from local machine.
yarn env-cmd

# this will generate changelog and will create a GitHub release. This will also trigger jobs to publish the extension.
yarn release

# to manually publish the extension
yarn publish

Special thanks to

  • wmertens for writing the syntax definitions.
  • The extension vscode-fish is modified to work for nix .

Links

  • Extension page at vscode marketplace
  • https://open-vsx.org/extension/jnoortheen/nix-ide