I'm not gonna bother

This commit is contained in:
2025-08-10 13:10:05 -04:00
parent 7c96b43098
commit d320577772
18 changed files with 182 additions and 192 deletions

29
lua/core/lsp/wtf.lua Normal file
View File

@ -0,0 +1,29 @@
-- wtf why does the language server protocol have these features?
-- partially stolen from https://github.com/glepnir/nvim
local misc = require("core.misc")
local auto = misc.auto
local wtf_group = misc.augroup("lsp.wtf")
auto('LspAttach', {
group = wtf_group,
callback = function(ctx)
local client = vim.lsp.get_client_by_id(ctx.data.client_id)
if not client then
return
end
-- highlight color codes via lsp (supported by cssls)
-- #ff0000
if client:supports_method('textDocument/documentColor') then
vim.lsp.document_color.enable(true, ctx.buf)
end
-- enable linked editing this allows lsps to modify things like html tags
-- for example when you change <p> to <a> </p> will be changed by the lsp
-- to </a>
if client:supports_method('textDocument/linkedEditingRange') then
vim.lsp.linked_editing_range.enable(true, { client_id = client.id })
end
end
})