Skip to content

Commit

Permalink
Merge pull request #303 from mjlbach/feature/add-pyright-languageserver
Browse files Browse the repository at this point in the history
  • Loading branch information
h-michael authored Nov 16, 2020
2 parents 35b0064 + ccb91bb commit df9cd18
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions lua/nvim_lsp/pyright.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
local configs = require 'lspconfig/configs'
local util = require 'lspconfig/util'

local server_name = "pyright"

local installer = util.npm_installer {
server_name = server_name;
packages = {server_name};
binaries = {server_name};
}

configs[server_name] = {
default_config = {
cmd = {"pyright-langserver", "--stdio"};
filetypes = {"python"};
root_dir = util.root_pattern(".git", "setup.py", "setup.cfg", "pyproject.toml", "requirements.txt");
settings = {
analysis = { autoSearchPaths= true; };
pyright = { useLibraryCodeForTypes = true; };
};
-- The following before_init function can be removed once https://github.com/neovim/neovim/pull/12638 is merged
before_init = function(initialize_params)
initialize_params['workspaceFolders'] = {{
name = 'workspace',
uri = initialize_params['rootUri']
}}
end
};
docs = {
description = [[
https://github.com/microsoft/pyright
`pyright`, a static type checker and language server for python
]];
};
}

configs[server_name].install = installer.install
configs[server_name].install_info = installer.info
-- vim:et ts=2 sw=2

0 comments on commit df9cd18

Please sign in to comment.