mirror of
https://github.com/pnx/dotfiles
synced 2026-06-16 11:24:55 +02:00
68 lines
1.9 KiB
Lua
68 lines
1.9 KiB
Lua
return {
|
|
'neovim/nvim-lspconfig',
|
|
dependencies = {
|
|
'williamboman/mason.nvim',
|
|
'williamboman/mason-lspconfig.nvim',
|
|
},
|
|
config = function()
|
|
-- Setup Mason to automatically install LSP servers
|
|
require('mason').setup()
|
|
require('mason-lspconfig').setup({ automatic_installation = true })
|
|
local lspconfig = require('lspconfig')
|
|
-- local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
|
|
|
-- php - phpactor
|
|
lspconfig.phpactor.setup({
|
|
init_options = {
|
|
["language_server_phpstan.enabled"] = true,
|
|
["language_server_psalm.enabled"] = false,
|
|
}
|
|
})
|
|
|
|
-- GO
|
|
lspconfig.gopls.setup({})
|
|
-- Tailwind CSS
|
|
--require('lspconfig').tailwindcss.setup({ capabilities = capabilities })
|
|
|
|
-- Format on save.
|
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
pattern = '*.go',
|
|
callback = function()
|
|
vim.lsp.buf.format { async = false }
|
|
end
|
|
})
|
|
|
|
-- Typescript
|
|
lspconfig.tsserver.setup({})
|
|
|
|
-- lua
|
|
lspconfig.lua_ls.setup({
|
|
on_init = function(client)
|
|
local path = client.workspace_folders[1].name
|
|
if not vim.loop.fs_stat(path..'/.luarc.json') and not vim.loop.fs_stat(path..'/.luarc.jsonc') then
|
|
client.config.settings = vim.tbl_deep_extend('force', client.config.settings, {
|
|
Lua = {
|
|
runtime = {
|
|
version = 'LuaJIT'
|
|
},
|
|
workspace = {
|
|
checkThirdParty = false,
|
|
library = {
|
|
vim.env.VIMRUNTIME
|
|
}
|
|
}
|
|
}
|
|
})
|
|
end
|
|
return true
|
|
end
|
|
})
|
|
|
|
-- Config
|
|
-- Sign configuration
|
|
vim.fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' })
|
|
vim.fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' })
|
|
vim.fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' })
|
|
vim.fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' })
|
|
end
|
|
}
|