all repos

init.lua @ ab4c49b09e88490e750db15cbe818ddcab29c2c8

my nvim config
2 files changed, 20 insertions(+), 5 deletions(-)
fix(lsp.attach)!: update to nvim 0.10
Author: Smirnov Oleksandr ss2316544@gmail.com
Committed at: 2024-05-01 19:04:23 +0300
Parent: c1837ec
M lua/plugins/completion.lua

@@ -3,11 +3,13 @@ return {

{ "hrsh7th/nvim-cmp", event = "InsertEnter", + keys = { ":" }, dependencies = { "hrsh7th/cmp-buffer", "saadparwaiz1/cmp_luasnip", "hrsh7th/cmp-path", "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-cmdline", { "zbirenbaum/copilot-cmp", dependencies = "copilot.lua",

@@ -20,8 +22,15 @@ local cmp = require "cmp"

local cmp_autopairs = require "nvim-autopairs.completion.cmp" cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + ---@diagnostic disable-next-line: missing-fields cmp.setup.filetype({ "gitcommit", "NeogitCommitMessage" }, { sources = { { name = "buffer" }, { name = "luasnip" } }, + }) + + ---@diagnostic disable-next-line: missing-fields + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = { { name = "path" }, { name = "cmdline" } }, }) cmp.setup {
M lua/plugins/lsp/attach.lua

@@ -1,3 +1,5 @@

+-- TODO: migrate to `:h LspAttach` + local u = require "core.utils" local attach = {}

@@ -16,9 +18,11 @@ u.map("n", "]D", vim.diagnostic.goto_next, true)

u.map("n", "[D", vim.diagnostic.goto_prev, true) end +---@param client vim.lsp.Client +---@param bufnr vim.lsp.inlay_hint.enable.Filter function attach.common(client, bufnr) - if client.name == "gopls" then - vim.lsp.codelens.refresh() + if client.supports_method "textDocument/codeLens" then + vim.lsp.codelens.run() end attach.basic(client, bufnr)

@@ -33,11 +37,13 @@ u.map("n", "<leader>lr", vim.lsp.buf.rename, true)

u.map("n", "<leader>ss", "<cmd>Telescope lsp_document_symbols<cr>", true) u.map("n", "<leader>ll", vim.lsp.codelens.run, true) u.map("n", "<leader>li", function() - if vim.lsp.inlay_hint.is_enabled(bufnr) then - vim.lsp.inlay_hint.enable(bufnr, false) + if + vim.lsp.inlay_hint.is_enabled(bufnr --[[@as number]]) + then + vim.lsp.inlay_hint.enable(false, bufnr) vim.print "Inlay hints disabled" else - vim.lsp.inlay_hint.enable(bufnr, true) + vim.lsp.inlay_hint.enable(true, bufnr) vim.print "Inlay hints enabled" end end, true)