wtf is going on with the LSPs?

This commit is contained in:
2pac 2023-11-06 23:00:03 +01:00
parent bb3f8e2914
commit b27b25441c
1 changed files with 20 additions and 3 deletions

View File

@ -15,6 +15,11 @@ if not vim.loop.fs_stat(lazypath) then
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
local get_root_dir = function(fname)
local util = require("lspconfig.util")
return util.root_pattern(".git")(fname) or util.root_pattern("package.json", "tsconfig.json")(fname)
end
require('lazy').setup({ require('lazy').setup({
-- Git related plugins -- Git related plugins
'tpope/vim-fugitive', 'tpope/vim-fugitive',
@ -38,6 +43,17 @@ require('lazy').setup({
-- NOTE(taras) WTF is this -- NOTE(taras) WTF is this
'folke/neodev.nvim', 'folke/neodev.nvim',
}, },
opts = {
servers = {
eslint = {
root_dir = get_root_dir,
},
tsserver = {
root_dir = get_root_dir,
single_file_support = false,
},
},
},
}, },
{ {
@ -386,8 +402,10 @@ local servers = {
gopls = {}, gopls = {},
pyright = {}, pyright = {},
rust_analyzer = {}, rust_analyzer = {},
tsserver = { single_file_support = false }, tsserver = {},
eslint = { filetypes = { 'javascript', 'typescript', 'typescriptreact' } }, eslint = {
filetypes = { 'javascript', 'typescript', 'typescriptreact' },
},
html = { filetypes = { 'html', 'twig', 'hbs' } }, html = { filetypes = { 'html', 'twig', 'hbs' } },
lua_ls = { lua_ls = {
Lua = { Lua = {
@ -418,7 +436,6 @@ mason_lspconfig.setup_handlers {
on_attach = on_attach, on_attach = on_attach,
settings = servers[server_name], settings = servers[server_name],
filetypes = (servers[server_name] or {}).filetypes, filetypes = (servers[server_name] or {}).filetypes,
single_file_support = (servers[server_name] or {}).single_file_support,
} }
end, end,
} }