aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/fs.lua
diff options
context:
space:
mode:
authorMathias Fußenegger <mfussenegger@users.noreply.github.com>2022-06-03 14:59:19 +0200
committerGitHub <noreply@github.com>2022-06-03 14:59:19 +0200
commit69774e317982edbe943c7d75cb0369fc001dec39 (patch)
treec49450622e6f2feafea05dac0eed6b72e07ead35 /runtime/lua/vim/fs.lua
parent61e33f312e8ceafb9c4fa1bccca02e0ff989ff6a (diff)
downloadrneovim-69774e317982edbe943c7d75cb0369fc001dec39.tar.gz
rneovim-69774e317982edbe943c7d75cb0369fc001dec39.tar.bz2
rneovim-69774e317982edbe943c7d75cb0369fc001dec39.zip
feat(lsp): add a start function (#18631)
A alternative/subset of https://github.com/neovim/neovim/pull/18506 that should be forward compatible with a potential project system. Configuration of LSP clients (without lspconfig) now looks like this: vim.lsp.start({ name = 'my-server-name', cmd = {'name-of-language-server-executable'}, root_dir = vim.fs.dirname(vim.fs.find({'setup.py', 'pyproject.toml'}, { upward = true })[1]), })
Diffstat (limited to 'runtime/lua/vim/fs.lua')
-rw-r--r--runtime/lua/vim/fs.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua
index 9bf38f7bc3..6f9c48ca24 100644
--- a/runtime/lua/vim/fs.lua
+++ b/runtime/lua/vim/fs.lua
@@ -37,6 +37,9 @@ end
---@param file (string) File or directory
---@return (string) Parent directory of {file}
function M.dirname(file)
+ if file == nil then
+ return nil
+ end
return vim.fn.fnamemodify(file, ':h')
end