diff options
| author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-11-11 01:00:24 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-11 01:00:24 -0800 |
| commit | 0d1ce78d231773046320caa45fe1a18dfa366761 (patch) | |
| tree | fde488c8490f93b6ad88ef8a32e77ff9b4e49d34 /lua/lspconfig/pyright.lua | |
| parent | docs: make CONTRIBUTING more visible via move (#1396) (diff) | |
| download | nvim-lspconfig-0d1ce78d231773046320caa45fe1a18dfa366761.tar nvim-lspconfig-0d1ce78d231773046320caa45fe1a18dfa366761.tar.gz nvim-lspconfig-0d1ce78d231773046320caa45fe1a18dfa366761.tar.bz2 nvim-lspconfig-0d1ce78d231773046320caa45fe1a18dfa366761.tar.lz nvim-lspconfig-0d1ce78d231773046320caa45fe1a18dfa366761.tar.xz nvim-lspconfig-0d1ce78d231773046320caa45fe1a18dfa366761.tar.zst nvim-lspconfig-0d1ce78d231773046320caa45fe1a18dfa366761.zip | |
feat: add single file mode (#1385)
* This adds a "single file mode" option for each language server
* Currently, if a root is not detected, a new language server is started
for each file opened.
* Root directory is set to `nil` in start_client. Some servers will
refuse to start, or otherwise panic. This is opt-in per server.
* Some servers, such as rust-analyzer, explicitly have a "single file
mode", we will not support that until it is officially part of the LSP
specification
Co-authored-by: Peter Lithammer <peter.lithammer@gmail.com>
Diffstat (limited to 'lua/lspconfig/pyright.lua')
| -rw-r--r-- | lua/lspconfig/pyright.lua | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lua/lspconfig/pyright.lua b/lua/lspconfig/pyright.lua index f9fe56d6..d17aac5e 100644 --- a/lua/lspconfig/pyright.lua +++ b/lua/lspconfig/pyright.lua @@ -7,6 +7,15 @@ if vim.fn.has 'win32' == 1 then bin_name = bin_name .. '.cmd' end +local root_files = { + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + 'pyrightconfig.json', +} + local function organize_imports() local params = { command = 'pyright.organizeimports', @@ -19,17 +28,8 @@ configs[server_name] = { default_config = { cmd = { bin_name, '--stdio' }, filetypes = { 'python' }, - root_dir = function(fname) - local root_files = { - 'pyproject.toml', - 'setup.py', - 'setup.cfg', - 'requirements.txt', - 'Pipfile', - 'pyrightconfig.json', - } - return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname) - end, + root_dir = util.root_pattern(unpack(root_files)), + single_file_support = true, settings = { python = { analysis = { |
