Compare commits
2 Commits
ea0a0c68c6
...
68c12127c2
Author | SHA1 | Date | |
---|---|---|---|
68c12127c2 | |||
17b1d19a93 |
@ -1,190 +1,212 @@
|
|||||||
return {
|
return {
|
||||||
-- lsp configuration
|
-- lsp configuration
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||||
"mfussenegger/nvim-jdtls",
|
"mfussenegger/nvim-jdtls",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- import lspconfig plugin
|
local lsp = vim.lsp
|
||||||
local lspconfig = require("lspconfig")
|
local enable = vim.lsp.enable
|
||||||
|
|
||||||
-- import cmp-nvim-lsp plugin
|
local capabilities = require("lsp-options").capabilities
|
||||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
local on_attach = require("lsp-options").on_attach
|
||||||
|
|
||||||
local capabilities = require("lsp-options").capabilities
|
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||||
local on_attach = require("lsp-options").on_attach
|
local signs = { Error = " ", Warn = " ", Hint = "", Info = " " }
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||||
|
end
|
||||||
|
|
||||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
-- ┌ ┐
|
||||||
local signs = { Error = " ", Warn = " ", Hint = "", Info = " " }
|
-- │ Bash │
|
||||||
for type, icon in pairs(signs) do
|
-- └ ┘
|
||||||
local hl = "DiagnosticSign" .. type
|
lsp.config("bashls", {
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
capabilities = capabilities,
|
||||||
end
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
-- ┌ ┐
|
-- ┌ ┐
|
||||||
-- │ Bash │
|
-- │ C, Cpp, objc │
|
||||||
-- └ ┘
|
-- └ ┘
|
||||||
lspconfig.bashls.setup({
|
lsp.config("clangd", {
|
||||||
capabilities = capabilities,
|
cmd = {
|
||||||
on_attach = on_attach,
|
"clangd",
|
||||||
})
|
"--suggest-missing-includes",
|
||||||
|
"--clang-tidy",
|
||||||
|
},
|
||||||
|
filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto", "ino" },
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
-- ┌ ┐
|
-- ┌ ┐
|
||||||
-- │ C, Cpp, objc │
|
-- │ Rust │
|
||||||
-- └ ┘
|
-- └ ┘
|
||||||
lspconfig.clangd.setup({
|
lsp.config("rust_analyzer", {
|
||||||
cmd = {
|
settings = {
|
||||||
"clangd",
|
["rust-analyzer"] = {
|
||||||
"--suggest-missing-includes",
|
diagnostics = {
|
||||||
"--clang-tidy",
|
enable = true,
|
||||||
},
|
},
|
||||||
filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto", "ino" },
|
},
|
||||||
capabilities = capabilities,
|
},
|
||||||
on_attach = on_attach,
|
capabilities = capabilities,
|
||||||
})
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
-- ┌ ┐
|
-- ┌ ┐
|
||||||
-- │ Rust │
|
-- │ HTML, CSS, JSON │
|
||||||
-- └ ┘
|
-- └ ┘
|
||||||
lspconfig.rust_analyzer.setup({
|
lsp.config("cssls", {
|
||||||
settings = {
|
capabilities = capabilities,
|
||||||
["rust-analyzer"] = {
|
on_attach = on_attach,
|
||||||
diagnostics = {
|
})
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- ┌ ┐
|
lsp.config("html", {
|
||||||
-- │ HTML, CSS, JSON │
|
capabilities = capabilities,
|
||||||
-- └ ┘
|
on_attach = on_attach,
|
||||||
lspconfig.cssls.setup({
|
})
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.html.setup({
|
lsp.config("jsonls", {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
})
|
})
|
||||||
|
|
||||||
lspconfig.jsonls.setup({
|
-- ┌ ┐
|
||||||
capabilities = capabilities,
|
-- │ LUA │
|
||||||
on_attach = on_attach,
|
-- └ ┘
|
||||||
})
|
lsp.config("lua_ls", {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
-- make the language server recognize "vim" global
|
||||||
|
diagnostics = {
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
-- make language server aware of runtime files
|
||||||
|
library = {
|
||||||
|
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||||
|
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
-- ┌ ┐
|
-- ┌ ┐
|
||||||
-- │ LUA │
|
-- │ Markdown │
|
||||||
-- └ ┘
|
-- └ ┘
|
||||||
lspconfig.lua_ls.setup({
|
lsp.config("marksman", {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
settings = {
|
})
|
||||||
Lua = {
|
|
||||||
-- make the language server recognize "vim" global
|
|
||||||
diagnostics = {
|
|
||||||
globals = { "vim" },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
-- make language server aware of runtime files
|
|
||||||
library = {
|
|
||||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
|
||||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- ┌ ┐
|
-- ┌ ┐
|
||||||
-- │ Markdown │
|
-- │ Python │
|
||||||
-- └ ┘
|
-- └ ┘
|
||||||
lspconfig.marksman.setup({
|
lsp.config("pyright", {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- ┌ ┐
|
-- ┌ ┐
|
||||||
-- │ Python │
|
-- │ Vue │
|
||||||
-- └ ┘
|
-- └ ┘
|
||||||
lspconfig.pyright.setup({
|
lsp.config("vue_ls", {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
})
|
filetypes = {
|
||||||
|
"vue",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
-- ┌ ┐
|
-- ┌ ┐
|
||||||
-- │ Vue, TS, JS, TSX & JSX │
|
-- │ TS, JS, TSX, JSX │
|
||||||
-- └ ┘
|
-- └ ┘
|
||||||
local mason_packages = vim.fn.stdpath("data") .. "/mason/packages"
|
lsp.config("ts_ls", {
|
||||||
local volar_path = mason_packages .. "/vue-language-server/node_modules/@vue/language-server"
|
capabilities = capabilities,
|
||||||
lspconfig.ts_ls.setup({
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
init_options = {
|
||||||
on_attach = on_attach,
|
plugins = {
|
||||||
init_options = {
|
{
|
||||||
plugins = {
|
name = "@vue/typescript-plugin",
|
||||||
{
|
location = "/usr/lib/node_modules/@vue/typescript-plugin",
|
||||||
name = "@vue/typescript-plugin",
|
languages = { "javascript", "typescript", "vue" },
|
||||||
-- location = "/usr/lib/node_modules/@vue/typescript-plugin",
|
},
|
||||||
location = volar_path,
|
},
|
||||||
languages = { "vue" },
|
},
|
||||||
},
|
filetypes = {
|
||||||
},
|
"javascript",
|
||||||
},
|
"typescript",
|
||||||
filetypes = {
|
"typescriptreact",
|
||||||
"javascript",
|
"javascriptreact",
|
||||||
"typescript",
|
"vue",
|
||||||
"typescriptreact",
|
},
|
||||||
"javascriptreact",
|
})
|
||||||
"vue",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- ┌ ┐
|
-- ┌ ┐
|
||||||
-- │ ASM │
|
-- │ ASM │
|
||||||
-- └ ┘
|
-- └ ┘
|
||||||
lspconfig.asm_lsp.setup({
|
lsp.config("asm_lsp", {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- ┌ ┐
|
-- ┌ ┐
|
||||||
-- │ LaTeX │
|
-- │ LaTeX │
|
||||||
-- └ ┘
|
-- └ ┘
|
||||||
lspconfig.texlab.setup({
|
lsp.config("texlab", {
|
||||||
cmd = { "texlab" },
|
cmd = { "texlab" },
|
||||||
filetypes = { "tex", "latex", "bib" },
|
filetypes = { "tex", "latex", "bib" },
|
||||||
root_dir = function(fname)
|
root_dir = function(fname)
|
||||||
return vim.loop.cwd()
|
return vim.loop.cwd()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- ┌ ┐
|
-- ┌ ┐
|
||||||
-- │ Verilog │
|
-- │ Verilog │
|
||||||
-- └ ┘
|
-- └ ┘
|
||||||
local lspconfutil = require("lspconfig/util")
|
local lspconfutil = require("lspconfig/util")
|
||||||
local root_pattern = lspconfutil.root_pattern("veridian.yml", ".git", ".xpr")
|
local root_pattern = lspconfutil.root_pattern("veridian.yml", ".git", ".xpr")
|
||||||
local verilog_root_dir = function()
|
local verilog_root_dir = function()
|
||||||
local filename = lspconfutil.path.join(vim.loop.cwd(), fname)
|
local filename = lspconfutil.path.join(vim.loop.cwd(), fname)
|
||||||
return root_pattern(filename) or lspconfutil.path.dirname(filename)
|
return root_pattern(filename) or lspconfutil.path.dirname(filename)
|
||||||
end
|
end
|
||||||
lspconfig.veridian.setup({
|
lsp.config("veridian", {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
root_dir = verilog_root_dir,
|
root_dir = verilog_root_dir,
|
||||||
})
|
})
|
||||||
|
|
||||||
lspconfig.verible.setup({
|
lsp.config("verible", {
|
||||||
-- cmd = { 'verible-verilog-ls', '--rules_config=/home/janis/.config/nvim/util/verible-conf.json' },
|
-- cmd = { 'verible-verilog-ls', '--rules_config=/home/janis/.config/nvim/util/verible-conf.json' },
|
||||||
cmd = { "verible-verilog-ls", "--rules=-no-trailing-spaces", "" },
|
cmd = { "verible-verilog-ls", "--rules=-no-trailing-spaces", "" },
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
root_dir = verilog_root_dir,
|
root_dir = verilog_root_dir,
|
||||||
})
|
})
|
||||||
end,
|
|
||||||
|
-- ╭───────────────────────────────────────────────╮
|
||||||
|
-- │ Enable the configs │
|
||||||
|
-- ╰───────────────────────────────────────────────╯
|
||||||
|
enable("bashls")
|
||||||
|
enable("clangd")
|
||||||
|
enable("rust_analyzer")
|
||||||
|
enable("marksman")
|
||||||
|
enable("vue_ls")
|
||||||
|
enable("ts_ls")
|
||||||
|
enable("texlab")
|
||||||
|
enable("asm_lsp")
|
||||||
|
enable("jsonls")
|
||||||
|
enable("cssls")
|
||||||
|
enable("html")
|
||||||
|
enable("lua_ls")
|
||||||
|
enable("pyright")
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ return {
|
|||||||
mason_lspconfig.setup({
|
mason_lspconfig.setup({
|
||||||
-- list of servers for mason to install
|
-- list of servers for mason to install
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
|
"asm-lsp",
|
||||||
-- "bashls",
|
-- "bashls",
|
||||||
-- "clangd",
|
-- "clangd",
|
||||||
-- "cssls",
|
-- "cssls",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user