aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/ci/lint.sh10
-rw-r--r--lsp/intelephense.lua4
-rw-r--r--lsp/phan.lua4
-rw-r--r--lsp/phpactor.lua4
-rw-r--r--lsp/rust_analyzer.lua2
-rw-r--r--lsp/smarty_ls.lua4
6 files changed, 19 insertions, 9 deletions
diff --git a/.github/ci/lint.sh b/.github/ci/lint.sh
index ccd23b5b..1b8647ed 100644
--- a/.github/ci/lint.sh
+++ b/.github/ci/lint.sh
@@ -45,6 +45,15 @@ _check_exec_cmd() {
fi
}
+# Disallow util functions in Nvim 0.11+ (lsp/) configs.
+_check_deprecated_in_nvim_0_11() {
+ if git grep -P 'is_descendant' -- 'lsp/*.lua' ; then
+ echo
+ echo 'Use vim.fs.relpath() instead of util.path.is_descendant()'
+ exit 1
+ fi
+}
+
_check_deprecated_utils() {
# checks for added lines that contain search pattern and prints them
SEARCH_PATTERN='(path\.dirname|fn\.cwd)'
@@ -70,4 +79,5 @@ _check_cmd_buflocal
_check_brief_placement
_check_lsp_cmd_prefix
_check_exec_cmd
+_check_deprecated_in_nvim_0_11
_check_deprecated_utils
diff --git a/lsp/intelephense.lua b/lsp/intelephense.lua
index 9910e207..bf03985d 100644
--- a/lsp/intelephense.lua
+++ b/lsp/intelephense.lua
@@ -32,10 +32,10 @@ return {
filetypes = { 'php' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
- local cwd = vim.uv.cwd()
+ local cwd = assert(vim.uv.cwd())
local root = util.root_pattern('composer.json', '.git')(fname)
-- prefer cwd if root is a descendant
- on_dir(util.path.is_descendant(cwd, root) and cwd or root)
+ on_dir(vim.fs.relpath(cwd, root) and cwd or root)
end,
}
diff --git a/lsp/phan.lua b/lsp/phan.lua
index c2fc12cb..c001f39c 100644
--- a/lsp/phan.lua
+++ b/lsp/phan.lua
@@ -24,10 +24,10 @@ return {
filetypes = { 'php' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
- local cwd = vim.uv.cwd()
+ local cwd = assert(vim.uv.cwd())
local root = util.root_pattern('composer.json', '.git')(fname)
-- prefer cwd if root is a descendant
- on_dir(util.path.is_descendant(cwd, root) and cwd or root)
+ on_dir(vim.fs.relpath(cwd, root) and cwd or root)
end,
}
diff --git a/lsp/phpactor.lua b/lsp/phpactor.lua
index 638cf217..87e6c59d 100644
--- a/lsp/phpactor.lua
+++ b/lsp/phpactor.lua
@@ -11,10 +11,10 @@ return {
filetypes = { 'php' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
- local cwd = vim.uv.cwd()
+ local cwd = assert(vim.uv.cwd())
local root = util.root_pattern('composer.json', '.git', '.phpactor.json', '.phpactor.yml')(fname)
-- prefer cwd if root is a descendant
- on_dir(util.path.is_descendant(cwd, root) and cwd or root)
+ on_dir(vim.fs.relpath(cwd, root) and cwd or root)
end,
}
diff --git a/lsp/rust_analyzer.lua b/lsp/rust_analyzer.lua
index ada5243d..aaa618c3 100644
--- a/lsp/rust_analyzer.lua
+++ b/lsp/rust_analyzer.lua
@@ -47,7 +47,7 @@ local function is_library(fname)
local toolchains = rustup_home .. '/toolchains'
for _, item in ipairs { toolchains, registry, git_registry } do
- if util.path.is_descendant(item, fname) then
+ if vim.fs.relpath(item, fname) then
local clients = vim.lsp.get_clients { name = 'rust_analyzer' }
return #clients > 0 and clients[#clients].config.root_dir or nil
end
diff --git a/lsp/smarty_ls.lua b/lsp/smarty_ls.lua
index 6fbaea02..a01cae4c 100644
--- a/lsp/smarty_ls.lua
+++ b/lsp/smarty_ls.lua
@@ -17,11 +17,11 @@ return {
filetypes = { 'smarty' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
- local cwd = vim.uv.cwd()
+ local cwd = assert(vim.uv.cwd())
local root = util.root_pattern('composer.json', '.git')(fname)
-- prefer cwd if root is a descendant
- on_dir(util.path.is_descendant(cwd, root) and cwd or root)
+ on_dir(vim.fs.relpath(cwd, root) and cwd or root)
end,
settings = {
smarty = {