WIP: update-upstream #4

Closed
cscherrNT wants to merge 69 commits from update-upstream into master
2 changed files with 16 additions and 13 deletions
Showing only changes of commit 6608363bd9 - Show all commits

View File

@ -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 = {

View File

@ -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"