diff options
| author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2024-11-26 15:48:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-26 06:48:35 -0800 |
| commit | 3eaab290c73c139d890e5da8a99dc76c274e03d5 (patch) | |
| tree | 4f1228698e34004ac296e41c980c6a027f3c0663 /lua/lspconfig/util.lua | |
| parent | Revert "fix: check existing_client support workspaceFolder (#3452)" (#3459) (diff) | |
| download | nvim-lspconfig-3eaab290c73c139d890e5da8a99dc76c274e03d5.tar nvim-lspconfig-3eaab290c73c139d890e5da8a99dc76c274e03d5.tar.gz nvim-lspconfig-3eaab290c73c139d890e5da8a99dc76c274e03d5.tar.bz2 nvim-lspconfig-3eaab290c73c139d890e5da8a99dc76c274e03d5.tar.lz nvim-lspconfig-3eaab290c73c139d890e5da8a99dc76c274e03d5.tar.xz nvim-lspconfig-3eaab290c73c139d890e5da8a99dc76c274e03d5.tar.zst nvim-lspconfig-3eaab290c73c139d890e5da8a99dc76c274e03d5.zip | |
refactor: remove implementation of util.path.dirname #3460
Instead, just return the result of vim.fs.dirname.
Diffstat (limited to 'lua/lspconfig/util.lua')
| -rw-r--r-- | lua/lspconfig/util.lua | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index 9fb84bfe..dd6c57cf 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -155,20 +155,7 @@ M.path = (function() --- @param path T --- @return T local function dirname(path) - local strip_dir_pat = '/([^/]+)$' - local strip_sep_pat = '/$' - if not path or #path == 0 then - return path - end - local result = path:gsub(strip_sep_pat, ''):gsub(strip_dir_pat, '') - if #result == 0 then - if iswin then - return path:sub(1, 2):upper() - else - return '/' - end - end - return result + return vim.fs.dirname(path) end local function path_join(...) @@ -181,7 +168,7 @@ M.path = (function() local dir = path -- Just in case our algo is buggy, don't infinite loop. for _ = 1, 100 do - dir = dirname(dir) + dir = vim.fs.dirname(dir) if not dir then return end @@ -199,7 +186,7 @@ M.path = (function() local function iterate_parents(path) local function it(_, v) if v and not is_fs_root(v) then - v = dirname(v) + v = vim.fs.dirname(v) else return end |
