mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-30 22:59:22 +02:00
avoid using smart_cwd if root_dir is not found
This commit is contained in:
parent
93b37d6e86
commit
6b98bc1378
1 changed files with 9 additions and 4 deletions
|
@ -51,6 +51,14 @@ local function add_lsp_buffer_keybindings(bufnr)
|
||||||
wk.register(keys, { mode = "n", buffer = bufnr })
|
wk.register(keys, { mode = "n", buffer = bufnr })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function set_smart_cwd(client)
|
||||||
|
local proj_dir = client.config.root_dir
|
||||||
|
if lvim.lsp.smart_cwd and proj_dir ~= "/" then
|
||||||
|
vim.api.nvim_set_current_dir(proj_dir)
|
||||||
|
require("core.nvimtree").change_tree_dir(proj_dir)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function M.common_capabilities()
|
function M.common_capabilities()
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
@ -113,10 +121,7 @@ function M.common_on_attach(client, bufnr)
|
||||||
end
|
end
|
||||||
lsp_highlight_document(client)
|
lsp_highlight_document(client)
|
||||||
add_lsp_buffer_keybindings(bufnr)
|
add_lsp_buffer_keybindings(bufnr)
|
||||||
if lvim.lsp.smart_cwd then
|
set_smart_cwd(client)
|
||||||
vim.api.nvim_set_current_dir(client.config.root_dir)
|
|
||||||
require("core.nvimtree").change_tree_dir(client.config.root_dir)
|
|
||||||
end
|
|
||||||
require("lsp.null-ls").setup(vim.bo.filetype)
|
require("lsp.null-ls").setup(vim.bo.filetype)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue