Skip to content

Commit 981eb81

Browse files
committed
Refactor LSP configuration
1 parent 8d9c2ac commit 981eb81

24 files changed

+311
-638
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
return {
2+
cmd = { "cssmodules-language-server", "--stdio" },
3+
filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact" },
4+
root_markers = { ".git" },
5+
on_attach = function (client)
6+
client.server_capabilities.definitionProvider = false
7+
end,
8+
}

configs/nvim/after/lsp/efm.lua

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
local eslint = {
2+
lintCommand = "eslint_d -f visualstudio --stdin --stdin-filename ${INPUT}",
3+
lintStdin = true,
4+
lintFormats = { "%f(%l,%c): %tarning %m", "%f(%l,%c): %rror %m" },
5+
lintIgnoreExitCode = true,
6+
formatCommand = "eslint_d --fix-to-stdout --stdin --stdin-filename=${INPUT}",
7+
formatStdin = true,
8+
}
9+
10+
local flake8 = {
11+
lintCommand = "flake8 ${INPUT}",
12+
lintStdin = true,
13+
}
14+
15+
local black = {
16+
formatCommand = "black --quiet -",
17+
formatStdin = true,
18+
}
19+
20+
local luacheck = {
21+
lintCommand = "luacheck --codes --no-color --quiet -",
22+
lintStdin = true,
23+
lintFormats = { "%.%#:%l:%c: (%t%n) %m" },
24+
}
25+
26+
local stylua = {
27+
formatCommand = "stylua --search-parent-directories -",
28+
formatStdin = true,
29+
}
30+
31+
return {
32+
cmd = { "efm-langserver" },
33+
settings = {
34+
rootMarkers = { ".git/" },
35+
languages = {
36+
javascript = { eslint },
37+
javascriptreact = { eslint },
38+
typescript = { eslint },
39+
typescriptreact = { eslint },
40+
python = { flake8, black },
41+
},
42+
},
43+
filetypes = {
44+
"javascript",
45+
"javascriptreact",
46+
"typescript",
47+
"typescriptreact",
48+
"json",
49+
"go",
50+
"python",
51+
"lua",
52+
"php",
53+
},
54+
init_options = { documentFormatting = true, codeAction = true },
55+
}

configs/nvim/init.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
-- bootstrap lazy.nvim, LazyVim and your plugins
2-
require("config.lazy")
1+
require("core.lazy")
2+
require("core.lsp")

configs/nvim/lazy-lock.json

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,33 @@
11
{
2-
"CodeGPT.nvim": { "branch": "master", "commit": "9d0a58a0bdc858f2e9729b8b5ac8b994c3453c8f" },
3-
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
4-
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
5-
"cmp-calc": { "branch": "main", "commit": "5947b412da67306c5b68698a02a846760059be2e" },
6-
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
7-
"cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" },
8-
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
9-
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
10-
"cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" },
11-
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
12-
"codecompanion.nvim": { "branch": "main", "commit": "12a1f0e8c8512e69d3ed64b7ac179a024794e4e4" },
13-
"comment-hide": { "branch": "main", "commit": "7bb91543facfeaf4e1d4e61f02cbb2c2230b98c4" },
14-
"conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" },
15-
"editorconfig-vim": { "branch": "master", "commit": "6a58b7c11f79c0e1d0f20533b3f42f2a11490cf8" },
16-
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
17-
"fzf-lua": { "branch": "main", "commit": "6302f7ac9de6e293c3eb6c20c015155e117b598b" },
18-
"gitsigns.nvim": { "branch": "main", "commit": "43b0c856ae5f32a195d83f4a27fe21d63e6c966c" },
2+
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
3+
"conform.nvim": { "branch": "master", "commit": "cde4da5c1083d3527776fee69536107d98dae6c9" },
4+
"editorconfig-vim": { "branch": "master", "commit": "13b86c5c691785ffbf2d6508c621dabb08e93df0" },
5+
"fzf-lua": { "branch": "main", "commit": "a8458b79a957a6e3e217d84106a0fd4b9470ff4c" },
6+
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
197
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
20-
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
21-
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
22-
"lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" },
23-
"lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
24-
"lspsaga.nvim": { "branch": "main", "commit": "920b1253e1a26732e53fac78412f6da7f674671d" },
25-
"lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" },
26-
"lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" },
27-
"luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" },
28-
"marksman": { "branch": "main", "commit": "179831ffc9b9454b4cc463df0926f0bff847805b" },
29-
"mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" },
30-
"mason.nvim": { "branch": "main", "commit": "7c7318e8bae7e3536ef6b9e86b9e38e74f2e125e" },
31-
"mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" },
32-
"mini.nvim": { "branch": "main", "commit": "6105b69d79fef0afed5ed576081b1997ef2b4be1" },
33-
"nerdtree": { "branch": "master", "commit": "9b465acb2745beb988eff3c1e4aa75f349738230" },
8+
"lazy.nvim": { "branch": "main", "commit": "e6a8824858757ca9cd4f5ae1a72d845fa5c46a39" },
9+
"lsp-lens.nvim": { "branch": "main", "commit": "48bb1a7e271424c15f3d588d54adc9b7c319d977" },
10+
"lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" },
11+
"lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" },
12+
"marksman": { "branch": "main", "commit": "5d29df63519d62c11b3c707049d4f006aef29f65" },
13+
"mason-lspconfig.nvim": { "branch": "main", "commit": "d7b5feb6e769e995f7fcf44d92f49f811c51d10c" },
14+
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
15+
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
16+
"mini.icons": { "branch": "main", "commit": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428" },
17+
"nerdtree": { "branch": "master", "commit": "690d061b591525890f1471c6675bcb5bdc8cdff9" },
3418
"nerdtree-git-plugin": { "branch": "master", "commit": "e1fe727127a813095854a5b063c15e955a77eafb" },
35-
"nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" },
36-
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
37-
"nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" },
19+
"nvim-colorizer.lua": { "branch": "master", "commit": "81e676d3203c9eb6e4c0ccf1eba1679296ef923f" },
3820
"nvim-fzf": { "branch": "master", "commit": "305aa90aeb8409b4bd2af1812a4b6e157ee93953" },
39-
"nvim-lspconfig": { "branch": "master", "commit": "4bc481b6f0c0cf3671fc894debd0e00347089a4e" },
40-
"nvim-markdown": { "branch": "master", "commit": "cfe80a1054ccc168ae9ef28062472e78f710f9f4" },
41-
"nvim-navic": { "branch": "master", "commit": "d0a8c17c4dc721b00bc2ac305c6ffbb036beeb74" },
42-
"nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" },
21+
"nvim-lspconfig": { "branch": "master", "commit": "2010fc6ec03e2da552b4886fceb2f7bc0fc2e9c0" },
22+
"nvim-markdown": { "branch": "master", "commit": "37850581fdaec153ce84af677d43bf8fce60813a" },
23+
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
4324
"nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" },
44-
"nvim-treesitter": { "branch": "master", "commit": "28d480e0624b259095e56f353ec911f9f2a0f404" },
45-
"nvim-web-devicons": { "branch": "master", "commit": "2c2b4eafce6cdd0cb165036faa17396eff18f847" },
25+
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
26+
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
27+
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
4628
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
47-
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
4829
"pretty-fold.nvim": { "branch": "master", "commit": "a7d8b424abe0eedf50116c460fbe6dfd5783b1d5" },
49-
"tailwind-tools": { "branch": "master", "commit": "4b2d88cc7d49a92f28b9942712f1a53d2c3d5b27" },
50-
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" },
51-
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
52-
"vim-rhubarb": { "branch": "master", "commit": "386daa2e9d98e23e27ad089afcbe5c5a903e488d" },
53-
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
30+
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
31+
"vim-rhubarb": { "branch": "master", "commit": "5496d7c94581c4c9ad7430357449bb57fc59f501" },
32+
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
5433
}

configs/nvim/lua/config/options.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ vim.cmd([[iabbrev <expr> ymd% strftime("%y%m%d")]])
7171
-- vim.api.nvim_create_autocmd({ "insertenter" }, { command = "hi cursorline ctermbg=16" })
7272
-- vim.api.nvim_create_autocmd({ "insertleave" }, { command = "hi cursorline ctermbg=none" })
7373
--
74-
vim.o.winbar = "  %{%v:lua.require'lib.filepath'.eval()%} %{%v:lua.require'nvim-navic'.get_location()%}"
74+
-- vim.o.winbar = "  %{%v:lua.require'lib.filepath'.eval()%} %{%v:lua.require'nvim-navic'.get_location()%}"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ require("lazy").setup({
1717
spec = {
1818
-- import your plugins
1919
{ import = "plugins" },
20+
{ import = "lsp" },
2021
},
2122
-- Configure any other settings here. See the documentation for more details.
2223
-- colorscheme that will be used when installing plugins.

configs/nvim/lua/core/lsp.lua

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
vim.diagnostic.config({
2+
-- virtual_lines = true,
3+
virtual_text = true,
4+
underline = true,
5+
update_in_insert = false,
6+
severity_sort = true,
7+
float = {
8+
border = "rounded",
9+
source = true,
10+
},
11+
signs = {
12+
text = {
13+
[vim.diagnostic.severity.ERROR] = "󰅚 ",
14+
[vim.diagnostic.severity.WARN] = "󰀪 ",
15+
[vim.diagnostic.severity.INFO] = "󰋽 ",
16+
[vim.diagnostic.severity.HINT] = "󰌶 ",
17+
},
18+
numhl = {
19+
[vim.diagnostic.severity.ERROR] = "ErrorMsg",
20+
[vim.diagnostic.severity.WARN] = "WarningMsg",
21+
},
22+
},
23+
})
24+
25+
vim.api.nvim_create_user_command("LspList", function()
26+
local clients = vim.lsp.get_active_clients()
27+
if #clients == 0 then
28+
print("No active LSP clients")
29+
return
30+
end
31+
for _, client in ipairs(clients) do
32+
print(string.format("• %s (id: %d)", client.name, client.id))
33+
end
34+
end, {})

configs/nvim/lua/lsp/mason.lua

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
return {
2+
{
3+
"mason-org/mason-lspconfig.nvim",
4+
opts = {
5+
ensure_installed = {
6+
"ansiblels",
7+
"ts_ls",
8+
"basedpyright",
9+
"cssls",
10+
"cssmodules_ls",
11+
"docker_language_server",
12+
"efm",
13+
-- "emmet_ls",
14+
"gh_actions_ls",
15+
"helm_ls",
16+
"html",
17+
"lua_ls",
18+
"markdown_oxide",
19+
},
20+
},
21+
dependencies = {
22+
{
23+
"mason-org/mason.nvim",
24+
opts = {
25+
ui = {
26+
icons = {
27+
package_installed = "",
28+
package_pending = "",
29+
package_uninstalled = "",
30+
},
31+
},
32+
},
33+
},
34+
"neovim/nvim-lspconfig",
35+
},
36+
},
37+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
return {
2+
"saghen/blink.cmp",
3+
version = "*",
4+
event = "InsertEnter",
5+
-- dependencies = {
6+
-- "rafamadriz/friendly-snippets",
7+
-- },
8+
opts = {
9+
keymap = {
10+
preset = "default",
11+
["<C-b>"] = { "scroll_documentation_up", "fallback" },
12+
["<C-f>"] = { "scroll_documentation_down", "fallback" },
13+
["<C-Space>"] = { "show", "show_documentation", "hide_documentation" },
14+
["<C-CR>"] = { "cancel", "fallback" },
15+
},
16+
17+
appearance = {
18+
use_nvim_cmp_as_default = true,
19+
nerd_font_variant = "mono",
20+
},
21+
22+
completion = {
23+
accept = {
24+
auto_brackets = {
25+
enabled = true,
26+
},
27+
},
28+
menu = {
29+
draw = {
30+
columns = { { "label", "label_description", gap = 1 }, { "kind_icon", "kind" } },
31+
components = {
32+
label = {
33+
width = { fill = true, max = 40 },
34+
text = function(ctx)
35+
return ctx.label .. (ctx.label_detail or "")
36+
end,
37+
},
38+
kind_icon = {
39+
ellipsis = false,
40+
text = function(ctx)
41+
return ctx.kind_icon .. ctx.icon_gap
42+
end,
43+
},
44+
kind = {
45+
width = { max = 30 },
46+
ellipsis = true,
47+
},
48+
},
49+
},
50+
},
51+
documentation = {
52+
auto_show = true,
53+
auto_show_delay_ms = 200,
54+
window = {
55+
border = "rounded",
56+
},
57+
},
58+
ghost_text = {
59+
enabled = true,
60+
},
61+
},
62+
63+
sources = {
64+
default = { "lsp", "path", "buffer" },
65+
},
66+
67+
signature = {
68+
enabled = true,
69+
window = {
70+
border = "rounded",
71+
},
72+
},
73+
},
74+
}

configs/nvim/lua/plugins/chatgpt.lua

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)