[LSP] Separate all configs, add new LS
This commit is contained in:
parent
4d6a5a431c
commit
d134abbfda
17
nvim/lua/plugins/lsp/ls/bashls.lua
Normal file
17
nvim/lua/plugins/lsp/ls/bashls.lua
Normal file
@ -0,0 +1,17 @@
|
||||
-- ┌ ┐
|
||||
-- │ Bash │
|
||||
-- └ ┘
|
||||
local lsp = vim.lsp
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").on_attach
|
||||
|
||||
lsp.config("bashls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
|
||||
-- ── Enable configs ───────────────────────────────────────────────
|
||||
local enable = vim.lsp.enable
|
||||
enable("bashls")
|
28
nvim/lua/plugins/lsp/ls/c.lua
Normal file
28
nvim/lua/plugins/lsp/ls/c.lua
Normal file
@ -0,0 +1,28 @@
|
||||
-- ┌ ┐
|
||||
-- │ C, Cpp, objc │
|
||||
-- └ ┘
|
||||
local lsp = vim.lsp
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").on_attach
|
||||
|
||||
lsp.config("clangd", {
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--suggest-missing-includes",
|
||||
"--clang-tidy",
|
||||
},
|
||||
filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto", "ino" },
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.config("cmake", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ── Enable configs ───────────────────────────────────────────────
|
||||
local enable = vim.lsp.enable
|
||||
enable("clangd")
|
||||
enable("cmake")
|
17
nvim/lua/plugins/lsp/ls/go.lua
Normal file
17
nvim/lua/plugins/lsp/ls/go.lua
Normal file
@ -0,0 +1,17 @@
|
||||
-- ┌ ┐
|
||||
-- │ GO │
|
||||
-- └ ┘
|
||||
local lsp = vim.lsp
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").on_attach
|
||||
|
||||
lsp.config("gopls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
|
||||
-- ── Enable configs ───────────────────────────────────────────────
|
||||
local enable = vim.lsp.enable
|
||||
enable("gopls")
|
17
nvim/lua/plugins/lsp/ls/hypr.lua
Normal file
17
nvim/lua/plugins/lsp/ls/hypr.lua
Normal file
@ -0,0 +1,17 @@
|
||||
-- ┌ ┐
|
||||
-- │ Hyprland │
|
||||
-- └ ┘
|
||||
local lsp = vim.lsp
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").on_attach
|
||||
|
||||
lsp.config("hyprls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
|
||||
-- ── Enable configs ───────────────────────────────────────────────
|
||||
local enable = vim.lsp.enable
|
||||
enable("hyprls")
|
45
nvim/lua/plugins/lsp/ls/low-level.lua
Normal file
45
nvim/lua/plugins/lsp/ls/low-level.lua
Normal file
@ -0,0 +1,45 @@
|
||||
-- ┌ ┐
|
||||
-- │ Low-level (HDL and ASM) │
|
||||
-- └ ┘
|
||||
local lsp = vim.lsp
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").on_attach
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ ASM │
|
||||
-- └ ┘
|
||||
lsp.config("asm_lsp", {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ Verilog │
|
||||
-- └ ┘
|
||||
local lspconfutil = require("lspconfig/util")
|
||||
local root_pattern = lspconfutil.root_pattern("veridian.yml", ".git", ".xpr")
|
||||
local verilog_root_dir = function()
|
||||
local filename = lspconfutil.path.join(vim.loop.cwd(), fname)
|
||||
return root_pattern(filename) or lspconfutil.path.dirname(filename)
|
||||
end
|
||||
lsp.config("veridian", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
root_dir = verilog_root_dir,
|
||||
})
|
||||
|
||||
lsp.config("verible", {
|
||||
-- cmd = { 'verible-verilog-ls', '--rules_config=/home/janis/.config/nvim/util/verible-conf.json' },
|
||||
cmd = { "verible-verilog-ls", "--rules=-no-trailing-spaces", "" },
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
root_dir = verilog_root_dir,
|
||||
})
|
||||
|
||||
|
||||
-- ── Enable configs ───────────────────────────────────────────────
|
||||
local enable = vim.lsp.enable
|
||||
enable("veridian")
|
||||
enable("verible")
|
||||
enable("asm_lsp")
|
32
nvim/lua/plugins/lsp/ls/luals.lua
Normal file
32
nvim/lua/plugins/lsp/ls/luals.lua
Normal file
@ -0,0 +1,32 @@
|
||||
-- ┌ ┐
|
||||
-- │ LUA │
|
||||
-- └ ┘
|
||||
local lsp = vim.lsp
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
-- ── Enable configs ───────────────────────────────────────────────
|
||||
local enable = vim.lsp.enable
|
||||
enable("lua_ls")
|
17
nvim/lua/plugins/lsp/ls/pyright.lua
Normal file
17
nvim/lua/plugins/lsp/ls/pyright.lua
Normal file
@ -0,0 +1,17 @@
|
||||
-- ┌ ┐
|
||||
-- │ Python │
|
||||
-- └ ┘
|
||||
local lsp = vim.lsp
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").on_attach
|
||||
|
||||
lsp.config("pyright", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
|
||||
-- ── Enable configs ───────────────────────────────────────────────
|
||||
local enable = vim.lsp.enable
|
||||
enable("pyright")
|
17
nvim/lua/plugins/lsp/ls/ruby.lua
Normal file
17
nvim/lua/plugins/lsp/ls/ruby.lua
Normal file
@ -0,0 +1,17 @@
|
||||
-- ┌ ┐
|
||||
-- │ Ruby │
|
||||
-- └ ┘
|
||||
local lsp = vim.lsp
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").on_attach
|
||||
|
||||
lsp.config("ruby_lsp", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
|
||||
-- ── Enable configs ───────────────────────────────────────────────
|
||||
local enable = vim.lsp.enable
|
||||
enable("ruby_lsp")
|
24
nvim/lua/plugins/lsp/ls/rust-analyzer.lua
Normal file
24
nvim/lua/plugins/lsp/ls/rust-analyzer.lua
Normal file
@ -0,0 +1,24 @@
|
||||
-- ┌ ┐
|
||||
-- │ Rust │
|
||||
-- └ ┘
|
||||
local lsp = vim.lsp
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").on_attach
|
||||
|
||||
lsp.config("rust_analyzer", {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
|
||||
-- ── Enable configs ───────────────────────────────────────────────
|
||||
local enable = vim.lsp.enable
|
||||
enable("rust_analyzer")
|
36
nvim/lua/plugins/lsp/ls/text.lua
Normal file
36
nvim/lua/plugins/lsp/ls/text.lua
Normal file
@ -0,0 +1,36 @@
|
||||
-- ┌ ┐
|
||||
-- │ Text languages (TeX and MD) │
|
||||
-- └ ┘
|
||||
local lsp = vim.lsp
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").on_attach
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ Markdown │
|
||||
-- └ ┘
|
||||
lsp.config("marksman", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ LaTeX │
|
||||
-- └ ┘
|
||||
lsp.config("texlab", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ Spell checking │
|
||||
-- └ ┘
|
||||
lsp.config("textlsp", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ── Enable configs ───────────────────────────────────────────────
|
||||
local enable = vim.lsp.enable
|
||||
enable("marksman")
|
||||
enable("texlab")
|
69
nvim/lua/plugins/lsp/ls/web.lua
Normal file
69
nvim/lua/plugins/lsp/ls/web.lua
Normal file
@ -0,0 +1,69 @@
|
||||
-- ┌ ┐
|
||||
-- │ Web technology │
|
||||
-- └ ┘
|
||||
local lsp = vim.lsp
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").on_attach
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ HTML, CSS, JSON │
|
||||
-- └ ┘
|
||||
lsp.config("cssls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.config("html", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.config("jsonls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ Vue │
|
||||
-- └ ┘
|
||||
lsp.config("vue_ls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = {
|
||||
"vue",
|
||||
},
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ TS, JS, TSX, JSX │
|
||||
-- └ ┘
|
||||
lsp.config("ts_ls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
init_options = {
|
||||
plugins = {
|
||||
{
|
||||
name = "@vue/typescript-plugin",
|
||||
location = "/usr/lib/node_modules/@vue/typescript-plugin",
|
||||
languages = { "javascript", "typescript", "vue" },
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
"javascript",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"vue",
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
-- ── Enable configs ───────────────────────────────────────────────
|
||||
local enable = vim.lsp.enable
|
||||
enable("jsonls")
|
||||
enable("html")
|
||||
enable("css")
|
||||
enable("vue_ls")
|
||||
enable("ts_ls")
|
@ -1,3 +1,7 @@
|
||||
-- ───────────────────────────────────────────────────────────────────
|
||||
-- ╭───────────────────────────────────────────────╮
|
||||
-- │ LSP Configuration │
|
||||
-- ╰───────────────────────────────────────────────╯
|
||||
return {
|
||||
-- lsp configuration
|
||||
"neovim/nvim-lspconfig",
|
||||
@ -8,12 +12,8 @@ return {
|
||||
"mfussenegger/nvim-jdtls",
|
||||
},
|
||||
config = function()
|
||||
local lsp = vim.lsp
|
||||
local enable = vim.lsp.enable
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").on_attach
|
||||
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
local signs = { Error = " ", Warn = " ", Hint = "", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
@ -21,189 +21,22 @@ return {
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ Bash │
|
||||
-- └ ┘
|
||||
lsp.config("bashls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ C, Cpp, objc │
|
||||
-- └ ┘
|
||||
lsp.config("clangd", {
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--suggest-missing-includes",
|
||||
"--clang-tidy",
|
||||
},
|
||||
filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto", "ino" },
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ Rust │
|
||||
-- └ ┘
|
||||
lsp.config("rust_analyzer", {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ HTML, CSS, JSON │
|
||||
-- └ ┘
|
||||
lsp.config("cssls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.config("html", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.config("jsonls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ LUA │
|
||||
-- └ ┘
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ Markdown │
|
||||
-- └ ┘
|
||||
lsp.config("marksman", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ Python │
|
||||
-- └ ┘
|
||||
lsp.config("pyright", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ Vue │
|
||||
-- └ ┘
|
||||
lsp.config("vue_ls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = {
|
||||
"vue",
|
||||
},
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ TS, JS, TSX, JSX │
|
||||
-- └ ┘
|
||||
lsp.config("ts_ls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
init_options = {
|
||||
plugins = {
|
||||
{
|
||||
name = "@vue/typescript-plugin",
|
||||
location = "/usr/lib/node_modules/@vue/typescript-plugin",
|
||||
languages = { "javascript", "typescript", "vue" },
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
"javascript",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"vue",
|
||||
},
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ ASM │
|
||||
-- └ ┘
|
||||
lsp.config("asm_lsp", {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ LaTeX │
|
||||
-- └ ┘
|
||||
lsp.config("texlab", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ Verilog │
|
||||
-- └ ┘
|
||||
local lspconfutil = require("lspconfig/util")
|
||||
local root_pattern = lspconfutil.root_pattern("veridian.yml", ".git", ".xpr")
|
||||
local verilog_root_dir = function()
|
||||
local filename = lspconfutil.path.join(vim.loop.cwd(), fname)
|
||||
return root_pattern(filename) or lspconfutil.path.dirname(filename)
|
||||
end
|
||||
lsp.config("veridian", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
root_dir = verilog_root_dir,
|
||||
})
|
||||
|
||||
lsp.config("verible", {
|
||||
-- cmd = { 'verible-verilog-ls', '--rules_config=/home/janis/.config/nvim/util/verible-conf.json' },
|
||||
cmd = { "verible-verilog-ls", "--rules=-no-trailing-spaces", "" },
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
root_dir = verilog_root_dir,
|
||||
})
|
||||
|
||||
-- ───────────────────────────────────────────────────────────────────
|
||||
-- ╭───────────────────────────────────────────────╮
|
||||
-- │ Enable the configs │
|
||||
-- │ Import configs from other files │
|
||||
-- ╰───────────────────────────────────────────────╯
|
||||
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")
|
||||
require("plugins.lsp.ls.bashls")
|
||||
require("plugins.lsp.ls.c")
|
||||
require("plugins.lsp.ls.go")
|
||||
require("plugins.lsp.ls.hypr")
|
||||
require("plugins.lsp.ls.low-level")
|
||||
require("plugins.lsp.ls.luals")
|
||||
require("plugins.lsp.ls.pyright")
|
||||
require("plugins.lsp.ls.rust-analyzer")
|
||||
require("plugins.lsp.ls.ruby")
|
||||
require("plugins.lsp.ls.text")
|
||||
require("plugins.lsp.ls.web")
|
||||
-- ───────────────────────────────────────────────────────────────────
|
||||
end,
|
||||
}
|
||||
-- ───────────────────────────────────────────────────────────────────
|
||||
|
Loading…
x
Reference in New Issue
Block a user