Skip to content

Commit e2b6e2a

Browse files
ayamirJint-lzxy
andauthored
fix: LSP start logic (#1504)
* Revert "fix: remove manual `LspStart`, close #1478. (#1479)" This reverts commit 7dab4b9. * Revert "fixup(#1466): load lsp config with proper event. (#1472)" This reverts commit 53eeeec. * fix: LSP start logic This should acc fix #1472 and #1479 cuz iirc the root cause was that lspconfig changed how `LspStart` works. Now it only starts one _specific_ server (passed via the first argument), instead of starting all matching servers automatically. So we gotta manually start all the servers that match the current filetype instead. Signed-off-by: Jint-lzxy <[email protected]> * fix: redundant return Signed-off-by: Jint-lzxy <[email protected]> * fix: invoke `:LspStart` correctly Signed-off-by: Jint-lzxy <[email protected]> --------- Signed-off-by: Jint-lzxy <[email protected]> Co-authored-by: Jint-lzxy <[email protected]>
1 parent b971fd0 commit e2b6e2a

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

lua/modules/configs/completion/lsp.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ return function()
1818
end
1919

2020
pcall(require, "user.configs.lsp")
21+
22+
-- Start LSPs
23+
pcall(vim.cmd.LspStart)
2124
end

lua/modules/configs/editor/persisted.lua

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
return function()
2-
vim.api.nvim_create_autocmd("User", {
3-
pattern = "PersistedLoadPost",
4-
desc = "Fix LSP/Highlighting on auto session restore",
5-
callback = function()
6-
local bufname = vim.api.nvim_buf_get_name(0)
7-
if bufname and bufname ~= "" then
8-
vim.defer_fn(function()
9-
vim.cmd("edit")
10-
end, 1)
11-
end
12-
end,
13-
})
142
require("modules.utils").load_plugin("persisted", {
153
save_dir = vim.fn.expand(vim.fn.stdpath("data") .. "/sessions/"),
164
autostart = true,

lua/modules/plugins/completion.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ local completion = {}
22

33
completion["neovim/nvim-lspconfig"] = {
44
lazy = true,
5-
event = { "BufReadPre", "BufNewFile" },
5+
event = { "CursorHold", "CursorHoldI" },
66
config = require("completion.lsp"),
77
dependencies = {
88
{ "mason-org/mason.nvim" },

0 commit comments

Comments
 (0)