I'm not gonna bother
This commit is contained in:
29
lua/core/lsp/wtf.lua
Normal file
29
lua/core/lsp/wtf.lua
Normal 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
|
||||
})
|
Reference in New Issue
Block a user