disable semantic tokens in on_init, in lspconfig.lua
This commit is contained in:
parent
2eac8906fc
commit
d0af27648a
@ -54,7 +54,7 @@ end, { desc = "Comment Toggle" })
|
||||
map(
|
||||
"v",
|
||||
"<leader>/",
|
||||
"<ESC>:lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
|
||||
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
|
||||
{ desc = "Comment Toggle" }
|
||||
)
|
||||
|
||||
@ -132,4 +132,4 @@ map("n", "<leader>cc", function()
|
||||
end
|
||||
end, { desc = "Blankline Jump to current context" })
|
||||
|
||||
pcall(require, "custom.mappings")
|
||||
require "custom.mappings"
|
||||
|
@ -1,19 +1,9 @@
|
||||
local M = {}
|
||||
local map = vim.keymap.set
|
||||
local conf = require("nvconfig").ui.lsp
|
||||
|
||||
-- export on_attach & capabilities for custom lspconfigs
|
||||
M.on_attach = function(client, bufnr)
|
||||
local conf = require("nvconfig").ui.lsp
|
||||
|
||||
-- semanticTokens
|
||||
if not conf.semantic_tokens and client.supports_method "textDocument/semanticTokens" then
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end
|
||||
|
||||
if conf.signature and client.server_capabilities.signatureHelpProvider then
|
||||
require("nvchad.signature").setup(client, bufnr)
|
||||
end
|
||||
|
||||
local function opts(desc)
|
||||
return { buffer = bufnr, desc = desc }
|
||||
end
|
||||
@ -38,6 +28,18 @@ M.on_attach = function(client, bufnr)
|
||||
|
||||
map({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts "Lsp Code action")
|
||||
map("n", "gr", vim.lsp.buf.references, opts "Lsp Show references")
|
||||
|
||||
-- setup signature popup
|
||||
if conf.signature and client.server_capabilities.signatureHelpProvider then
|
||||
require("nvchad.signature").setup(client, bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
-- disable semanticTokens
|
||||
M.on_init = function(client, _)
|
||||
if not conf.semantic_tokens and client.supports_method "textDocument/semanticTokens" then
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end
|
||||
end
|
||||
|
||||
M.capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
@ -67,6 +69,7 @@ M.defaults = function()
|
||||
require("lspconfig").lua_ls.setup {
|
||||
on_attach = M.on_attach,
|
||||
capabilities = M.capabilities,
|
||||
on_init = M.on_init,
|
||||
|
||||
settings = {
|
||||
Lua = {
|
||||
|
Loading…
Reference in New Issue
Block a user