lina/nvim/lua/_lsp.lua
2025-06-01 18:24:01 +03:30

120 lines
2.3 KiB
Lua

local function supported_by_prettier(filetype)
local filetypes = {
'javascript',
'javascriptreact',
'javascript.jsx',
'typescript',
'typescriptreact',
'typescript.tsx',
'vue',
'svelte',
'astro',
-- html
'aspnetcorerazor',
'astro',
'astro-markdown',
'blade',
'clojure',
'django-html',
'htmldjango',
'edge',
'eelixir', -- vim ft
'elixir',
'ejs',
'erb',
'eruby', -- vim ft
'gohtml',
'gohtmltmpl',
'haml',
'handlebars',
'hbs',
'html',
'htmlangular',
'html-eex',
'heex',
'jade',
'leaf',
'liquid',
'markdown',
'mdx',
'mustache',
'njk',
'nunjucks',
'php',
'razor',
'slim',
'twig',
-- css
'css',
'less',
'postcss',
'sass',
'scss',
'stylus',
'sugarss',
-- js
'javascript',
'javascriptreact',
'reason',
'rescript',
'typescript',
'typescriptreact',
-- mixed
'vue',
'svelte',
'templ',
}
for _, v in ipairs(filetypes) do
if v == filetype then
return true
end
end
return false
end
local config = {
virtual_text = true,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = '',
[vim.diagnostic.severity.WARN] = '',
[vim.diagnostic.severity.INFO] = '',
[vim.diagnostic.severity.HINT] = '',
}
},
update_in_insert = true,
underline = true,
severity_sort = true,
float = {
focusable = false,
style = "normal",
border = "rounded",
source = "always",
header = "",
prefix = "",
},
}
vim.filetype.add({
extension = {
svx = "markdown",
}
})
vim.diagnostic.config(config)
vim.lsp.buf.hover({ border = "rounded" })
vim.lsp.buf.signature_help({ border = "rounded" })
vim.lsp.enable({
'clangd',
'luals',
'svelte',
'tailwindcss',
"ts_ls",
"cssls",
"eslint",
"mdx_analyzer",
})