Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pyright languageserver #303

Merged
merged 6 commits into from
Nov 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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