Skip to main content

requirements language server

Project description

requirements-language-server

readthedocs pre-commit.ci status github/workflow codecov DeepSource

github/downloads github/downloads/latest github/issues github/issues-closed github/issues-pr github/issues-pr-closed github/discussions github/milestones github/forks github/stars github/watchers github/contributors github/commit-activity github/last-commit github/release-date

github/license github/languages github/languages/top github/directory-file-count github/code-size github/repo-size github/v

pypi/status pypi/v pypi/downloads pypi/format pypi/implementation pypi/pyversions

Language server for requirements.txt.

  • document hover: requires pip.
  • completion: requires pip-cache. Must pip-cache update before.
  • diagnostic: requires pip-compile.

Screenshots

Document Hover

module

option

Completion

module

option

file

Diagnostic

module

Usage

Vim/Neovim

coc.nvim

{
  "languageserver": {
    "requirements": {
      "command": "requirements-language-server",
      "filetypes": [
        "requirements"
      ]
    }
  }
}

vim-lsp

if executable('requirements-language-server')
  augroup lsp
    autocmd!
    autocmd User lsp_setup call lsp#register_server({
          \ 'name': 'requirements',
          \ 'cmd': {server_info->['requirements-language-server']},
          \ 'whitelist': ['requirements'],
          \ })
  augroup END
endif

Neovim

vim.api.nvim_create_autocmd({ "BufEnter" }, {
  pattern = { "requirements*.txt*" },
  callback = function()
    vim.lsp.start({
      name = "requirements",
      cmd = { "requirements-language-server" }
    })
  end,
})

Emacs

(make-lsp-client :new-connection
(lsp-stdio-connection
  `(,(executable-find "requirements-language-server")))
  :activation-fn (lsp-activate-on "requirements*.txt*")
  :server-id "requirements")))

Sublime

{
  "clients": {
    "requirements": {
      "command": [
        "requirements-language-server"
      ],
      "enabled": true,
      "selector": "source.requirements"
    }
  }
}

Customization

You can customize the document hover template. A default template is here. The syntax rule is jinja. The template path is decided by your OS:

$ requirements-language-server --print-config template
/home/wzy/.config/pip/template.md.j2

You can generate cache by requirements-language-server --generate-cache to fasten document hover and completion. Every time you change template, the cache must be regenerated.

$ requirements-language-server --print-config cache
/home/wzy/.cache/pip/pip.json

Related Projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requirements-language-server-0.0.2.tar.gz (30.1 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page