-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
70 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,93 @@ | ||
-- LSP servers | ||
local servers = { | ||
lua_ls = { | ||
Lua = { | ||
workspace = { checkThirdParty = false }, | ||
telemetry = { enable = false }, | ||
}, | ||
}, | ||
nil_ls = {}, | ||
statix = {}, | ||
biome = {}, | ||
tsserver = {}, | ||
jsonls = {}, | ||
cssls = {}, | ||
eslint = {}, | ||
bashls = {}, | ||
texlab = {}, | ||
ltex = {}, | ||
lua_ls = { | ||
Lua = { | ||
workspace = { checkThirdParty = false }, | ||
telemetry = { enable = false }, | ||
}, | ||
}, | ||
nil_ls = {}, | ||
statix = {}, | ||
biome = {}, | ||
tsserver = {}, | ||
jsonls = {}, | ||
cssls = {}, | ||
eslint = {}, | ||
bashls = {}, | ||
texlab = {}, | ||
ltex = {}, | ||
|
||
lemminx = {}, | ||
jdtls = {}, | ||
kotlin_language_server = {} | ||
lemminx = {}, | ||
jdtls = {}, | ||
kotlin_language_server = {}, | ||
} | ||
|
||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) | ||
|
||
local on_attach = function(client, bufnr) | ||
local nmap = function(keys, func, desc) | ||
if desc then | ||
desc = 'LSP: ' .. desc | ||
end | ||
local nmap = function(keys, func, desc) | ||
if desc then | ||
desc = "LSP: " .. desc | ||
end | ||
|
||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) | ||
end | ||
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc }) | ||
end | ||
|
||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction') | ||
nmap('<leader>cf', vim.lsp.buf.format, '[C]ode [F]ormat') | ||
nmap('<leader>cr', vim.lsp.buf.rename, '[C]ode [R]ename') | ||
nmap("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction") | ||
nmap("<leader>cf", vim.lsp.buf.format, "[C]ode [F]ormat") | ||
nmap("<leader>cr", vim.lsp.buf.rename, "[C]ode [R]ename") | ||
|
||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') | ||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') | ||
nmap("<leader>ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols") | ||
nmap("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols") | ||
|
||
-- See `:help K` for why this keymap | ||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation') | ||
nmap('<C-p>', vim.lsp.buf.signature_help, 'Signature Documentation') | ||
-- See `:help K` for why this keymap | ||
nmap("K", vim.lsp.buf.hover, "Hover Documentation") | ||
nmap("<C-p>", vim.lsp.buf.signature_help, "Signature Documentation") | ||
|
||
-- Lesser used LSP functionality | ||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') | ||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') | ||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') | ||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') | ||
nmap('<leader>wl', function() | ||
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) | ||
end, '[W]orkspace [L]ist Folders') | ||
-- Lesser used LSP functionality | ||
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition") | ||
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") | ||
nmap("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder") | ||
nmap("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder") | ||
nmap("<leader>wl", function() | ||
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) | ||
end, "[W]orkspace [L]ist Folders") | ||
|
||
if client.supports_method("textDocument/formatting") then | ||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) | ||
vim.api.nvim_create_autocmd("BufWritePre", { | ||
group = augroup, | ||
buffer = bufnr, | ||
callback = function() | ||
vim.lsp.buf.format({ bufnr = bufnr }) | ||
end, | ||
}) | ||
end | ||
if client.supports_method("textDocument/formatting") then | ||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) | ||
vim.api.nvim_create_autocmd("BufWritePre", { | ||
group = augroup, | ||
buffer = bufnr, | ||
callback = function() | ||
vim.lsp.buf.format({ bufnr = bufnr }) | ||
end, | ||
}) | ||
end | ||
end | ||
|
||
-- Setup neovim lua configuration | ||
require('neodev').setup() | ||
require("neodev").setup() | ||
|
||
local lsp = require 'lspconfig' | ||
local lsp = require("lspconfig") | ||
|
||
for server_name, config in pairs(servers) do | ||
lsp[server_name].setup { | ||
on_attach = on_attach, | ||
settings = config, | ||
} | ||
lsp[server_name].setup({ | ||
on_attach = on_attach, | ||
settings = config, | ||
}) | ||
end | ||
|
||
local null_ls = require 'null-ls' | ||
local null_ls = require("null-ls") | ||
null_ls.setup({ | ||
sources = { | ||
null_ls.builtins.diagnostics.luacheck, | ||
null_ls.builtins.formatting.stylua, | ||
null_ls.builtins.diagnostics.ktlint, | ||
null_ls.builtins.formatting.ktlint | ||
} | ||
sources = { | ||
null_ls.builtins.diagnostics.luacheck, | ||
null_ls.builtins.diagnostics.tidy, | ||
null_ls.builtins.diagnostics.ktlint, | ||
null_ls.builtins.formatting.stylua, | ||
null_ls.builtins.formatting.ktlint, | ||
null_ls.builtins.formatting.tidy, | ||
}, | ||
}) | ||
|
||
local telescope = require 'telescope' | ||
telescope.load_extension('ui-select') | ||
local telescope = require("telescope") | ||
telescope.load_extension("ui-select") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,9 @@ | |
nil | ||
statix | ||
|
||
# XML | ||
# XML/HTML | ||
lemminx | ||
html-tidy | ||
|
||
# Kotlin/Java | ||
jdt-language-server | ||
|