Skip to content

alexandre-abrioux/blink-cmp-npm.nvim

Repository files navigation

blink-cmp-npm

A blink.cmp source that provides completions for NPM packages and versions in package.json files.

This plugin is an adaptation of cmp-npm, modified to work natively with blink.cmp.

Demo Gif

Requirements

Installation

Add the plugin to your packer manager and make sure it is loaded before blink.cmp.

Using lazy.nvim

{
  "saghen/blink.cmp",
  dependencies = { "alexandre-abrioux/blink-cmp-npm.nvim" },
  opts = {
    sources = {
      default = {
        -- enable "npm" in your sources list
        "npm"
      },
      providers = {
        -- configure the provider
        npm = {
          name = "npm",
          module = "blink-cmp-npm",
          async = true,
          -- optional - make blink-cmp-npm completions top priority (see `:h blink.cmp`)
          score_offset = 100,
          -- optional - blink-cmp-npm config
          ---@module "blink-cmp-npm"
          ---@type blink-cmp-npm.Options
          opts = {
            ignore = {},
            only_semantic_versions = true,
            only_latest_version = false,
          }
        },
      },
    },
  },
},

Options

Option Type Default Description
ignore string[] {} Ignore versions that match any of these strings.
only_semantic_versions boolean true Ignore versions that do not match semantic versioning.
only_latest_version boolean false When suggesting versions, only show the latest.

Usage

Once installed and enabled, completions will automatically be provided when working with package.json files.

Contributing

Contributions are welcome! Feel free to submit a Pull Request.

Acknowledgements

Special thanks to:

About

Completion for packages.json in Neovim

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •