GithubHelp home page GithubHelp logo

octarect / nvim-lspservers Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 114 KB

๐Ÿ› ๏ธ Easy way to automate installation and setup of language server for neovim/nvim-lspconfig

License: MIT License

Dockerfile 4.22% Makefile 1.92% Lua 83.80% Shell 5.97% Vim Script 4.09%
neovim nvim vim language-server nvim-lua neovim-plugin

nvim-lspservers's Introduction

nvim-lspservers

Test

Easy to install a language server for neovim/nvim-lspconfig.

nvim-lspservers is in early stage and a breaking change may happen suddenly. Stay tuned ๐Ÿ˜Ž

Features

  • ๐Ÿญ Automate installation and setup of language servers
  • ๐Ÿš€ Just call require'lspservers'.setup() to configure
  • โš™๏ธ Easy to customize language server

Getting Started

Dependencies

Obviously you must have neovim/nvim-lspconfig.

Some servers may require an additional tool (e.g. npm) to install them. You can check if they are available by :checkhealth lspservers after installation of plugin.

Installation

Using dein

call dein#add('neovim/nvim-lspconfig')
call dein#add('octarect/nvim-lspservers')

Usage

See also Available Language Servers for examples of :LspServersInstall.

The following code will install and setup language servers.

require'lspservers'.setup{
  -- List servers you want to use. Each value of RHS should be `true` or dictionary.
  servers = {
    gopls = true,

    -- You can write server-specific configuration as follows;
    -- vimls = {
    --   filetypes = { "vim", ... },
    --   init_options = {
    --     ...
    --   },
    -- },
  },

  -- `global` configuration will be applied to all language servers.
  global = {
    on_attach = on_attach,
  },
}

Available options

You can configure the plugin by passing options to setup() function as dictionary. The following options are available.

Top level

Option Description Type Default
installation_path Where to install servers. String $HOME/.local/share/nvim/lspservers
global Configuration for all servers. Dictionary {}
servers Configuration for each server. See also Server level. Dictionary {}

Server level

You can use same server name as nvim-lspconfig. See https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md

Some special fields is defined for nvim-lspservers and they will be ignored as server configuration.

Option Description Type Default
auto_config Determine whether to apply recommended config or not. Boolean true

Update language servers

You can update language servers by the following command:

:LspServersUpdate

Available language servers

TODO: I am planning to expand our supported servers in series. For the time being, we will focus to add same servers as nvim-lspconfig.

Language Language Server Auto config
Ansible ansiblels
Bash bashls
C/C++ clangd
CSS cssls Yes
Dockerfile dockerls
Elixir elixirls
Erlang erlangls
Go gopls
HTML html Yes
JSON jsonls
Lua sumneko_lua Yes
Python jedi_language_server
Python pyright
Ruby solargraph
Rust rust_analyzer
TypeScript tsserver
Terraform terraformls
Terraform tflint
Vim vimls
YAML yamlls

Development

Additional dependencies

You need to install plenary.nvim for automated testing.

See https://github.com/nvim-lua/plenary.nvim#installation

Adding new server

  1. Create new lua file in ./lua/lspservers/servers/. (e.g. vimls.lua)

  2. Edit vimls.lua

installer and cmd will be executed in server's installation path. In this example, working directry is <installation_path>/vimls/.

local server = require'lspservers/server'

return server.new({
  name = 'vimls',
  cmd = { './node_modules/.bin/vim-language-server', '--stdio' },
  installer = [[
    set -e
    npm install vim-language-server@latest
  ]]
})
  1. Commit your changes and submit pull request.

nvim-lspservers's People

Contributors

octarect avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

dundargoc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.