make lspconfig sane
This commit is contained in:
1 parent
be1c9c6c7d
commit
fdc5ae7fcf
5 files changed
+73
-120
No files matched your search
@@ -1,12 +1,6 @@
|
|||||||
local settings = require 'config.lsp-settings'
|
|
||||||
local on_attach = settings.on_attach
|
|
||||||
local capabilities = settings.capabilities
|
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
cmd = {'/bin/jdtls'},
|
cmd = {'/bin/jdtls'},
|
||||||
root_dir = vim.fs.dirname(vim.fs.find({'.gradlew', '.git', 'mvnw'}, { upward = true })[1]),
|
root_dir = vim.fs.dirname(vim.fs.find({'.gradlew', '.git', 'mvnw'}, { upward = true })[1]),
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
require('jdtls').start_or_attach(config)
|
require('jdtls').start_or_attach(config)
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
local on_attach = function(_, bufnr)
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||||
|
callback = function(ev)
|
||||||
|
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||||
vim.o.signcolumn = "yes"
|
vim.o.signcolumn = "yes"
|
||||||
|
|
||||||
local map = function(from, to)
|
local map = function(from, to)
|
||||||
vim.keymap.set("n", from, to,
|
vim.keymap.set("n", from, to,
|
||||||
{ noremap = true, silent = true, buffer = bufnr }
|
{ noremap = true, silent = true, buffer = ev.buf }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -31,12 +33,4 @@ local on_attach = function(_, bufnr)
|
|||||||
vim.lsp.buf.format { async = true }
|
vim.lsp.buf.format { async = true }
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
})
|
||||||
local capabilities = require "cmp_nvim_lsp".default_capabilities(
|
|
||||||
vim.lsp.protocol.make_client_capabilities()
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities
|
|
||||||
}
|
|
||||||
@@ -10,4 +10,5 @@ for _, mod in ipairs({
|
|||||||
"mappings",
|
"mappings",
|
||||||
"utils",
|
"utils",
|
||||||
"theme",
|
"theme",
|
||||||
|
"lsp-settings",
|
||||||
}) do u.mod_post_write(g, "config." .. mod, u.reload) end
|
}) do u.mod_post_write(g, "config." .. mod, u.reload) end
|
||||||
+5
-102
@@ -1,106 +1,11 @@
|
|||||||
local config = function()
|
|
||||||
local settings = require("config.lsp-settings")
|
|
||||||
local on_attach = settings.on_attach
|
|
||||||
local capabilities = settings.capabilities
|
|
||||||
|
|
||||||
require("lspconfig").lua_ls.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
diagnostics = {
|
|
||||||
globals = { "vim" },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
library = vim.api.nvim_get_runtime_file("", true),
|
|
||||||
checkThirdParty = false
|
|
||||||
},
|
|
||||||
telemetry = {
|
|
||||||
enable = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.g.markdown_fenced_languages = {
|
|
||||||
"ts=typescript"
|
|
||||||
}
|
|
||||||
local c = require("lspconfig")
|
|
||||||
c.clangd.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
c.asm_lsp.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
c.pylsp.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
c.kotlin_language_server.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
c.denols.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
root_dir = c.util.root_pattern("deno.json", "deno.jsonc"),
|
|
||||||
}
|
|
||||||
c.angularls.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
c.tsserver.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
root_dir = c.util.root_pattern("package.json", "tsconfig.json", "jsconfig.json"),
|
|
||||||
single_file_support = false,
|
|
||||||
}
|
|
||||||
c.jsonls.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
c.omnisharp.setup {
|
|
||||||
cmd = { "omnisharp" },
|
|
||||||
|
|
||||||
enable_editorconfig_support = true,
|
|
||||||
enable_ms_build_load_projects_on_demand = false,
|
|
||||||
enable_roslyn_analyzers = false,
|
|
||||||
organize_imports_on_format = false,
|
|
||||||
enable_import_completion = false,
|
|
||||||
sdk_include_prereleases = true,
|
|
||||||
analyze_open_documents_only = false,
|
|
||||||
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local rs_config = function()
|
|
||||||
local settings = require "config.lsp-settings"
|
|
||||||
local on_attach = settings.on_attach
|
|
||||||
local capabilities = settings.capabilities
|
|
||||||
require "rust-tools".setup {
|
|
||||||
server = {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
config = config
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"simrat39/rust-tools.nvim",
|
"simrat39/rust-tools.nvim",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
},
|
},
|
||||||
config = rs_config
|
config = function() require "rust-tools".setup {} end
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"windwp/nvim-autopairs",
|
"windwp/nvim-autopairs",
|
||||||
@@ -110,12 +15,10 @@ return {
|
|||||||
"scalameta/nvim-metals",
|
"scalameta/nvim-metals",
|
||||||
dependencies = { "nvim-lua/plenary.nvim" }
|
dependencies = { "nvim-lua/plenary.nvim" }
|
||||||
},
|
},
|
||||||
"mfussenegger/nvim-jdtls",
|
|
||||||
"folke/neodev.nvim",
|
|
||||||
{
|
{
|
||||||
"lervag/vimtex",
|
"lervag/vimtex",
|
||||||
config = function()
|
config = function() vim.g.vimtex_view_method = 'zathura' end
|
||||||
vim.g.vimtex_view_method = 'zathura'
|
},
|
||||||
end
|
"mfussenegger/nvim-jdtls",
|
||||||
}
|
"folke/neodev.nvim",
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
local config = function()
|
||||||
|
local c = require("lspconfig")
|
||||||
|
|
||||||
|
vim.g.markdown_fenced_languages = {
|
||||||
|
"ts=typescript"
|
||||||
|
}
|
||||||
|
|
||||||
|
c.lua_ls.setup {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
|
checkThirdParty = false
|
||||||
|
},
|
||||||
|
telemetry = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
c.denols.setup {
|
||||||
|
root_dir = c.util.root_pattern("deno.json", "deno.jsonc"),
|
||||||
|
}
|
||||||
|
c.tsserver.setup {
|
||||||
|
root_dir = c.util.root_pattern("package.json", "tsconfig.json", "jsconfig.json"),
|
||||||
|
single_file_support = false,
|
||||||
|
}
|
||||||
|
c.omnisharp.setup {
|
||||||
|
cmd = { "omnisharp" },
|
||||||
|
|
||||||
|
enable_editorconfig_support = true,
|
||||||
|
enable_ms_build_load_projects_on_demand = false,
|
||||||
|
enable_roslyn_analyzers = false,
|
||||||
|
organize_imports_on_format = false,
|
||||||
|
enable_import_completion = false,
|
||||||
|
sdk_include_prereleases = true,
|
||||||
|
analyze_open_documents_only = false,
|
||||||
|
}
|
||||||
|
c.typst_lsp.setup {
|
||||||
|
cmd = { "/home/bryan/repos/typst-lsp/target/release/typst-lsp" },
|
||||||
|
}
|
||||||
|
|
||||||
|
c.angularls.setup {}
|
||||||
|
c.clangd.setup {}
|
||||||
|
c.asm_lsp.setup {}
|
||||||
|
c.pylsp.setup {}
|
||||||
|
c.kotlin_language_server.setup {}
|
||||||
|
c.jsonls.setup {}
|
||||||
|
|
||||||
|
require 'config.lsp-settings'
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
config = config
|
||||||
|
},
|
||||||
|
}
|
||||||
Reference in new issue
Block a user