aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-01-18 12:57:43 -0800
committerGitHub <noreply@github.com>2021-01-18 12:57:43 -0800
commit1f88798c0efe9331e83243ce05605fbac0433e9d (patch)
tree3b8ddab7557e28997ab7084fd469510f69832d0f /lua
parentvimls: change to use cwd instead of home for root (diff)
parentpyright: add current file directory as fallback for root (diff)
downloadnvim-lspconfig-1f88798c0efe9331e83243ce05605fbac0433e9d.tar
nvim-lspconfig-1f88798c0efe9331e83243ce05605fbac0433e9d.tar.gz
nvim-lspconfig-1f88798c0efe9331e83243ce05605fbac0433e9d.tar.bz2
nvim-lspconfig-1f88798c0efe9331e83243ce05605fbac0433e9d.tar.lz
nvim-lspconfig-1f88798c0efe9331e83243ce05605fbac0433e9d.tar.xz
nvim-lspconfig-1f88798c0efe9331e83243ce05605fbac0433e9d.tar.zst
nvim-lspconfig-1f88798c0efe9331e83243ce05605fbac0433e9d.zip
Merge pull request #678 from mjlbach/pyright_update_root
pyright: add current file directory as fallback for root
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/pyright.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/lua/lspconfig/pyright.lua b/lua/lspconfig/pyright.lua
index 6559fc1b..70b6a092 100644
--- a/lua/lspconfig/pyright.lua
+++ b/lua/lspconfig/pyright.lua
@@ -7,11 +7,22 @@ if vim.fn.has('win32') == 1 then
bin_name = bin_name..".cmd"
end
+local root_files = {
+ 'setup.py',
+ 'pyproject.toml',
+ 'setup.cfg',
+ 'requirements.txt',
+ '.git',
+}
+
configs[server_name] = {
default_config = {
cmd = {bin_name, "--stdio"};
filetypes = {"python"};
- root_dir = util.root_pattern(".git", "setup.py", "setup.cfg", "pyproject.toml", "requirements.txt");
+ root_dir = function(filename)
+ return util.root_pattern(unpack(root_files))(filename) or
+ util.path.dirname(filename)
+ end;
settings = {
python = {
analysis = {