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]),
    })
This commit is contained in:
Mathias Fußenegger
2022-06-03 14:59:19 +02:00
committed by GitHub
parent 61e33f312e
commit 69774e3179
3 changed files with 203 additions and 74 deletions

View File

@@ -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