diff options
| author | erw7 <erw7.github@gmail.com> | 2019-11-21 13:41:14 +0900 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2019-11-20 20:41:14 -0800 |
| commit | 2c6f8dbd7e5adc732c0d679351b2a18d025c650b (patch) | |
| tree | 712e919fe0ce30d7c15ca0c7d27329068dd606e8 /lua/nvim_lsp/util.lua | |
| parent | Update util.lua (#38) (diff) | |
| download | nvim-lspconfig-2c6f8dbd7e5adc732c0d679351b2a18d025c650b.tar nvim-lspconfig-2c6f8dbd7e5adc732c0d679351b2a18d025c650b.tar.gz nvim-lspconfig-2c6f8dbd7e5adc732c0d679351b2a18d025c650b.tar.bz2 nvim-lspconfig-2c6f8dbd7e5adc732c0d679351b2a18d025c650b.tar.lz nvim-lspconfig-2c6f8dbd7e5adc732c0d679351b2a18d025c650b.tar.xz nvim-lspconfig-2c6f8dbd7e5adc732c0d679351b2a18d025c650b.tar.zst nvim-lspconfig-2c6f8dbd7e5adc732c0d679351b2a18d025c650b.zip | |
Fix iterate_parents infinite loop on Windows (#42)
- Fix the problem that Windows identification fails because
uv.os_uname().sysname is different between MSVC(Windows_NT)
and MINGW(MINGW32_NT-XX.X).
- Fixes an issue where is_fs_root() does not return true in the root
directory because dirname() returns a value (such as C:) that does
not include the last path_sep.
- Fix problem where path_join('/', 'home') return '//home'.
Diffstat (limited to 'lua/nvim_lsp/util.lua')
| -rw-r--r-- | lua/nvim_lsp/util.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lua/nvim_lsp/util.lua b/lua/nvim_lsp/util.lua index 70d8c823..407088cd 100644 --- a/lua/nvim_lsp/util.lua +++ b/lua/nvim_lsp/util.lua @@ -114,13 +114,13 @@ M.path = (function() return exists(filename) == 'file' end - local is_windows = uv.os_uname().sysname == "Windows" + local is_windows = uv.os_uname().version:match("Windows") local path_sep = is_windows and "\\" or "/" local is_fs_root if is_windows then is_fs_root = function(path) - return path:match("^%a:\\\\$") + return path:match("^%a:$") end else is_fs_root = function(path) @@ -143,7 +143,10 @@ M.path = (function() end local function path_join(...) - return table.concat(vim.tbl_flatten {...}, path_sep) + local result = + table.concat( + vim.tbl_flatten {...}, path_sep):gsub(path_sep.."+", path_sep) + return result end -- Traverse the path calling cb along the way. |
