Skip to content

Commit 3f40fcd

Browse files
committed
LSP fixes.
1 parent 72bea7f commit 3f40fcd

2 files changed

Lines changed: 34 additions & 67 deletions

File tree

lua/plugins/lsp.lua

Lines changed: 32 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,6 @@ return {
2929
emmet_language_server = {
3030
fileeypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "php" },
3131
},
32-
eslint_d = {
33-
root_dir = vim.fs.root(0, { "package.json", ".eslintrc.json", ".eslintrc.js", ".git" }),
34-
filetypes = { "javascript", "typescript", "typescriptreact", "javascriptreact" },
35-
flags = os.getenv("DEBOUNCE_ESLINT") and {
36-
allow_incremental_sync = true,
37-
debounce_text_changes = 1000,
38-
} or nil,
39-
on_attach = function(_, bufnr)
40-
vim.api.nvim_create_autocmd("BufWritePre", {
41-
buffer = bufnr,
42-
command = "EslintFixAll",
43-
})
44-
end,
45-
},
4632
gopls = {},
4733
html = {},
4834
intelephense = {
@@ -154,16 +140,16 @@ return {
154140
jsonls = {},
155141
lua_ls = {
156142
settings = {
157-
Lua = {
143+
lua = {
158144
diagnostics = {
159-
globals = { "vim", "Snacks" },
145+
globals = { "vim", "snacks" },
160146
},
161147
completion = {
162-
callSnippet = "Replace",
148+
callsnippet = "replace",
163149
},
164150
workspace = {
165151
library = vim.api.nvim_get_runtime_file("", true),
166-
checkThirdParty = false,
152+
checkthirdparty = false,
167153
},
168154
},
169155
},
@@ -241,14 +227,28 @@ return {
241227
-- LSP tools
242228
---------------------
243229
local LSP_TOOLS = {
244-
"goimports",
245-
"phpcs", -- PHP CodeSniffer for PHP linting
246-
"prettier",
247-
"shfmt",
248-
"sqlfluff",
249-
"sql-formatter",
250-
"stylelint",
251-
"stylua",
230+
goimports = {},
231+
phpcs = {},
232+
prettier = {},
233+
shfmt = {},
234+
sqlformatter = {},
235+
sqlfluff = {},
236+
stylelint = {},
237+
stylua = {},
238+
eslint_d = {
239+
root_dir = vim.fs.root(0, { "package.json", ".eslintrc.json", ".eslintrc.js", ".git" }),
240+
filetypes = { "javascript", "typescript", "typescriptreact", "javascriptreact" },
241+
flags = os.getenv("DEBOUNCE_ESLINT") and {
242+
allow_incremental_sync = true,
243+
debounce_text_changes = 1000,
244+
} or nil,
245+
on_attach = function(_, bufnr)
246+
vim.api.nvim_create_autocmd("BufWritePre", {
247+
buffer = bufnr,
248+
command = "EslintFixAll",
249+
})
250+
end,
251+
},
252252
}
253253

254254
---------------------
@@ -279,53 +279,19 @@ return {
279279
---------------------
280280
-- mason
281281
---------------------
282+
282283
local ensure_installed = vim.tbl_keys(servers or {})
284+
local ensure_lsptools_installed = vim.tbl_keys(servers or {})
283285

284286
if vim.g.debugger then
285287
local DEBUGGERS = require("utils.debugger").DEBUGGERS
286-
vim.list_extend(ensure_installed, DEBUGGERS)
288+
vim.list_extend(ensure_lsptools_installed, DEBUGGERS)
287289
end
288290

289-
vim.list_extend(ensure_installed, LSP_TOOLS)
290-
291-
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
292-
-- require("mason-lspconfig").setup_handlers({
293-
-- function(server_name)
294-
-- local server = servers[server_name] or {}
295-
-- server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
296-
297-
-- -- Add memory limits for heavy LSP servers
298-
-- local heavy_servers = {
299-
-- "vtsls",
300-
-- "lua_ls",
301-
-- "pyright",
302-
-- "rust_analyzer",
303-
-- "gopls",
304-
-- "clangd",
305-
-- "tailwindcss",
306-
-- "jdtls",
307-
-- "yamlls",
308-
-- "intelephense", -- PHP LSP can be memory hungry
309-
-- }
310-
-- if vim.tbl_contains(heavy_servers, server_name) then
311-
-- server.settings = server.settings or {}
312-
-- server.settings.memory = {
313-
-- limitMb = get_memory_limit_mb(),
314-
-- }
315-
-- end
316-
317-
-- -- Add offsetEncoding capability for clangd
318-
-- if server_name == "clangd" then
319-
-- server.capabilities.offsetEncoding = { "utf-16" }
320-
-- end
291+
vim.list_extend(ensure_lsptools_installed, LSP_TOOLS)
321292

322-
-- -- server.on_attach = function(client, bufnr) -- Attach to every buffer
323-
-- -- Populate Workspace-Diagnostics plugin information
324-
-- -- require("workspace-diagnostics").populate_workspace_diagnostics(client, bufnr)
325-
-- -- end
326-
-- require("lspconfig")[server_name].setup(server)
327-
-- end,
328-
-- })
293+
require("mason-tool-installer").setup({ ensure_installed = ensure_lsptools_installed })
294+
require("mason-lspconfig").setup({ ensure_installed = ensure_installed, automatic_enable = true })
329295

330296
---------------------
331297
-- keybinds

lua/plugins/mini-sessions.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ return {
1515
pre = {
1616
read = nil,
1717
write = function()
18-
local edgy, diffview, dap, dapui = require("edgy"), require("diffview.lib"), require("dap"), require("dapui")
18+
local edgy, diffview, dap, dapui =
19+
require("edgy"), require("diffview.lib"), require("nvim-dap"), require("dapui")
1920

2021
edgy.close()
2122

0 commit comments

Comments
 (0)