From d0b81f87cbc71b4de68910c64d1511f645f20556 Mon Sep 17 00:00:00 2001 From: Christian Nieves Date: Fri, 24 Jan 2025 19:10:02 +0000 Subject: [PATCH] plz --- vim/.vim/lua/config/lsp-google.lua | 11 +- vim/.vim/lua/plugins/blink.lua | 71 +++++--- vim/.vim/lua/plugins/cmp.lua | 2 +- vim/.vim/lua/plugins/diagnostics.lua | 2 +- vim/.vim/lua/plugins/google.lua | 6 - vim/.vim/lua/plugins/lsp.lua | 24 +-- vim/.vim/lua/plugins/luasnip.lua | 35 ---- vim/.vim/lua/plugins/mason.lua | 233 ++++++++++++++------------- vim/.vim/lua/utils.lua | 2 +- 9 files changed, 186 insertions(+), 200 deletions(-) delete mode 100644 vim/.vim/lua/plugins/luasnip.lua diff --git a/vim/.vim/lua/config/lsp-google.lua b/vim/.vim/lua/config/lsp-google.lua index 84474d7..936f9bf 100644 --- a/vim/.vim/lua/config/lsp-google.lua +++ b/vim/.vim/lua/config/lsp-google.lua @@ -7,7 +7,7 @@ function M.setup(capabilities) local configs = require("lspconfig.configs") configs.ciderlsp = { default_config = { - offset_encoding = "utf-16", + -- offset_encoding = "utf-16", cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-lsp", @@ -51,11 +51,10 @@ function M.setup(capabilities) vim.b["is_cider_lsp_attached"] = "no" end - local cider_lsp_handlers = { - ["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - focusable = false, - }), - } + local cider_lsp_handlers = {} + -- cider_lsp_handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + -- focusable = false, + -- }) cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx) local first_fire = vim.b["is_cider_lsp_attached"] == "no" diff --git a/vim/.vim/lua/plugins/blink.lua b/vim/.vim/lua/plugins/blink.lua index 2513785..7d5f293 100644 --- a/vim/.vim/lua/plugins/blink.lua +++ b/vim/.vim/lua/plugins/blink.lua @@ -8,11 +8,12 @@ return { version = "*", -- lazy.nvim will automatically load the plugin when it's required by blink.cmp lazy = true, + cond = flags.blink, -- make sure to set opts so that lazy.nvim calls blink.compat's setup opts = { - impersonate_nvim_cmp = use_google(), -- only cider needs this + impersonate_nvim_cmp = true, + debug = true, }, - cond = not use_google(), }, { "saghen/blink.cmp", @@ -20,10 +21,12 @@ return { cond = flags.blink, dependencies = { "Exafunction/codeium.nvim", - "mikavilpas/blink-ripgrep.nvim", "chrisgrieser/cmp-nerdfont", - "hrsh7th/cmp-emoji", + "hrsh7th/cmp-nvim-lsp", + "mikavilpas/blink-ripgrep.nvim", + "moyiz/blink-emoji.nvim", "rafamadriz/friendly-snippets", -- optional: provides snippets for the snippet source + "saghen/blink.compat", }, version = "v0.*", -- use a release tag to download pre-built binaries -- build = 'cargo build --release', @@ -31,7 +34,9 @@ return { ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { + -- stylua: ignore keymap = { + preset = "none", [""] = { "show", "show_documentation", "hide_documentation" }, [""] = { "hide", "fallback" }, [""] = { "accept", "fallback" }, @@ -64,7 +69,9 @@ return { end return providerToEnable end, + -- default = { "lsp" }, providers = { + lsp = { name = "LSP", module = "blink.cmp.sources.lsp", score_offset = 90 }, -- dont show LuaLS require statements when lazydev has items lazydev = { name = "LazyDev", module = "lazydev.integrations.blink", fallbacks = { "lsp" } }, ripgrep = { @@ -80,24 +87,38 @@ return { additional_rg_options = {}, }, }, - nvim_ciderlsp = { - name = "nvim_ciderlsp", - module = "blink.compat.source", + -- https://github.com/moyiz/blink-emoji.nvim + emoji = { + module = "blink-emoji", + name = "Emoji", + score_offset = 15, -- the higher the number, the higher the priority + opts = { insert = true }, -- Insert emoji (default) or complete its name }, - buganizer = { - name = "nvim_buganizer", + buffer = { + name = "Buffer", + enabled = true, + max_items = 3, + module = "blink.cmp.sources.buffer", + min_keyword_length = 4, + score_offset = 15, -- the higher the number, the higher the priority + }, + -- compat sources + nerdfont = { + name = "nerdfont", module = "blink.compat.source", }, codeium = { name = "codeium", module = "blink.compat.source", + score_offset = 100, }, - emoji = { - name = "emoji", + nvim_ciderlsp = { + name = "nvim_ciderlsp", module = "blink.compat.source", + score_offset = 100, }, - nerdfont = { - name = "nerdfont", + buganizer = { + name = "nvim_buganizer", module = "blink.compat.source", }, }, @@ -105,6 +126,20 @@ return { -- experimental signature help support signature = { enabled = true }, completion = { + list = { + -- stylua: ignore + selection = { + preselect = function(ctx) return ctx.mode ~= 'cmdline' end, + auto_insert = function(ctx) return ctx.mode ~= 'cmdline' end, + }, + }, + documentation = { + auto_show = true, + }, + -- Displays a preview of the selected item on the current line + ghost_text = { + enabled = true, + }, menu = { draw = { components = { @@ -123,16 +158,6 @@ return { }, }, }, - list = { - selection = { - preselect = function(ctx) - return ctx.mode ~= "cmdline" - end, - auto_insert = function(ctx) - return ctx.mode ~= "cmdline" - end, - }, - }, trigger = { show_on_x_blocked_trigger_characters = { "'", '"', "(", "{" }, }, diff --git a/vim/.vim/lua/plugins/cmp.lua b/vim/.vim/lua/plugins/cmp.lua index 7fc0c2b..03ddbbe 100644 --- a/vim/.vim/lua/plugins/cmp.lua +++ b/vim/.vim/lua/plugins/cmp.lua @@ -1,4 +1,4 @@ -local use_google = require("utils").use_googlecmp +local use_google = require("utils").use_google local flags = require("utils").flags return { diff --git a/vim/.vim/lua/plugins/diagnostics.lua b/vim/.vim/lua/plugins/diagnostics.lua index 91673bb..7effffb 100644 --- a/vim/.vim/lua/plugins/diagnostics.lua +++ b/vim/.vim/lua/plugins/diagnostics.lua @@ -60,7 +60,7 @@ return { -- end, -- }, { - "https://git.sr.ht/~whynothugo/lsp_lines.nvim", + "ErichDonGubler/lsp_lines.nvim", event = { "LspAttach" }, name = "lsp_lines.nvim", config = function() diff --git a/vim/.vim/lua/plugins/google.lua b/vim/.vim/lua/plugins/google.lua index bf90180..5bb1993 100644 --- a/vim/.vim/lua/plugins/google.lua +++ b/vim/.vim/lua/plugins/google.lua @@ -244,17 +244,11 @@ return { name = "cmp-nvim-ciderlsp", url = "sso://googler@user/piloto/cmp-nvim-ciderlsp", event = "VimEnter", - dependencies = { - "hrsh7th/nvim-cmp", - }, }, { name = "ciderlsp-nvim", url = "sso://googler@user/kdark/ciderlsp-nvim", event = "VimEnter", - dependencies = { - "hrsh7th/nvim-cmp", - }, }, -- { -- name = "nvim_figtree", diff --git a/vim/.vim/lua/plugins/lsp.lua b/vim/.vim/lua/plugins/lsp.lua index d95dec1..0285b58 100644 --- a/vim/.vim/lua/plugins/lsp.lua +++ b/vim/.vim/lua/plugins/lsp.lua @@ -2,17 +2,17 @@ local use_google = require("utils").use_google local flags = require("utils").flags return { - { - "ray-x/lsp_signature.nvim", - event = "VeryLazy", - opts = { - floating_window = true, - hint_prefix = "󰡱 ", - }, - config = function(_, opts) - require("lsp_signature").setup(opts) - end, - }, + -- { + -- "ray-x/lsp_signature.nvim", + -- event = "VeryLazy", + -- opts = { + -- floating_window = true, + -- hint_prefix = "󰡱 ", + -- }, + -- config = function(_, opts) + -- require("lsp_signature").setup(opts) + -- end, + -- }, { "kosayoda/nvim-lightbulb", commit = "1cae7b7153ae98dcf1b11173a443ac1b6d8e3d49", @@ -89,6 +89,8 @@ return { "neovim/nvim-lspconfig", dependencies = { "hrsh7th/nvim-cmp", + "saghen/blink.cmp", + "saghen/blink.compat", "nvim-lua/lsp-status.nvim", "VonHeikemen/lsp-zero.nvim", }, diff --git a/vim/.vim/lua/plugins/luasnip.lua b/vim/.vim/lua/plugins/luasnip.lua deleted file mode 100644 index 078eb8a..0000000 --- a/vim/.vim/lua/plugins/luasnip.lua +++ /dev/null @@ -1,35 +0,0 @@ -return { - { - "danymat/neogen", - config = function() - require("neogen").setup({ snippet_engine = "luasnip" }) - end, - }, - { - "L3MON4D3/LuaSnip", - -- follow latest release. - version = ".*", -- Replace by the latest released major (first number of latest release) - -- install jsregexp (optional!). - build = "make install_jsregexp", - }, - { "saadparwaiz1/cmp_luasnip" }, - config = function() - local ls = require("luasnip") - - vim.keymap.set({ "i" }, "", function() - ls.expand() - end, { silent = true }) - vim.keymap.set({ "i", "s" }, "", function() - ls.jump(1) - end, { silent = true }) - vim.keymap.set({ "i", "s" }, "", function() - ls.jump(-1) - end, { silent = true }) - - vim.keymap.set({ "i", "s" }, "", function() - if ls.choice_active() then - ls.change_choice(1) - end - end, { silent = true }) - end, -} diff --git a/vim/.vim/lua/plugins/mason.lua b/vim/.vim/lua/plugins/mason.lua index 67c3c61..4ef4f88 100644 --- a/vim/.vim/lua/plugins/mason.lua +++ b/vim/.vim/lua/plugins/mason.lua @@ -1,128 +1,129 @@ return { - "williamboman/mason-lspconfig.nvim", - dependencies = { - "williamboman/mason.nvim", - "Hoffs/omnisharp-extended-lsp.nvim", - }, - config = function() - local TableConcat = require("utils").TableConcat - local use_google = require("utils").use_google + "williamboman/mason-lspconfig.nvim", + cond = false, + dependencies = { + "williamboman/mason.nvim", + "Hoffs/omnisharp-extended-lsp.nvim", + }, + config = function() + local TableConcat = require("utils").TableConcat + local use_google = require("utils").use_google - local lsps = { - "lua_ls", - "html", - "marksman", - "sqlls", - "bashls", - "dotls", - "golangci_lint_ls", - "gopls", - } + local lsps = { + "lua_ls", + "html", + "marksman", + "sqlls", + "bashls", + "dotls", + "golangci_lint_ls", + "gopls", + } - if not use_google() then - TableConcat(lsps, { - "pyright", - "omnisharp_mono", - "docker_compose_language_service", - "dockerls", - "graphql", - "kotlin_language_server", - "arduino_language_server", - "clangd", - }) - end + if not use_google() then + TableConcat(lsps, { + "pyright", + "omnisharp_mono", + "docker_compose_language_service", + "dockerls", + "graphql", + "kotlin_language_server", + "arduino_language_server", + "clangd", + }) + end - require("mason").setup() - require("mason-lspconfig").setup({ - automatic_installation = false, - ensure_installed = lsps, - handlers = { - -- The first entry (without a key) will be the default handler - -- and will be called for each installed server that doesn't have - -- a dedicated handler. - function(server_name) -- default handler (optional) - -- vim.notify("Mason LSP:" .. server_name) - require("lspconfig")[server_name].setup({}) - end, - -- Prevent mason from setting up rust_analyzer since that's handled by rustaceanvim - ["rust_analyzer"] = function() end, - ["omnisharp_mono"] = function() - require("lspconfig").omnisharp_mono.setup({ - handlers = { - ["textDocument/definition"] = require("omnisharp_extended").handler, - }, - -- cmd = { "dotnet", "/path/to/omnisharp/OmniSharp.dll" }, + require("mason").setup() + require("mason-lspconfig").setup({ + automatic_installation = false, + ensure_installed = lsps, + handlers = { + -- The first entry (without a key) will be the default handler + -- and will be called for each installed server that doesn't have + -- a dedicated handler. + function(server_name) -- default handler (optional) + -- vim.notify("Mason LSP:" .. server_name) + require("lspconfig")[server_name].setup({}) + end, + -- Prevent mason from setting up rust_analyzer since that's handled by rustaceanvim + ["rust_analyzer"] = function() end, + ["omnisharp_mono"] = function() + require("lspconfig").omnisharp_mono.setup({ + handlers = { + ["textDocument/definition"] = require("omnisharp_extended").handler, + }, + -- cmd = { "dotnet", "/path/to/omnisharp/OmniSharp.dll" }, - -- Enables support for reading code style, naming convention and analyzer - -- settings from .editorconfig. - enable_editorconfig_support = true, + -- Enables support for reading code style, naming convention and analyzer + -- settings from .editorconfig. + enable_editorconfig_support = true, - -- If true, MSBuild project system will only load projects for files that - -- were opened in the editor. This setting is useful for big C# codebases - -- and allows for faster initialization of code navigation features only - -- for projects that are relevant to code that is being edited. With this - -- setting enabled OmniSharp may load fewer projects and may thus display - -- incomplete reference lists for symbols. - enable_ms_build_load_projects_on_demand = false, -- default false + -- If true, MSBuild project system will only load projects for files that + -- were opened in the editor. This setting is useful for big C# codebases + -- and allows for faster initialization of code navigation features only + -- for projects that are relevant to code that is being edited. With this + -- setting enabled OmniSharp may load fewer projects and may thus display + -- incomplete reference lists for symbols. + enable_ms_build_load_projects_on_demand = false, -- default false - -- Enables support for roslyn analyzers, code fixes and rulesets. - enable_roslyn_analyzers = true, -- default false + -- Enables support for roslyn analyzers, code fixes and rulesets. + enable_roslyn_analyzers = true, -- default false - -- Specifies whether 'using' directives should be grouped and sorted during - -- document formatting. - organize_imports_on_format = true, -- default false + -- Specifies whether 'using' directives should be grouped and sorted during + -- document formatting. + organize_imports_on_format = true, -- default false - -- Enables support for showing unimported types and unimported extension - -- methods in completion lists. When committed, the appropriate using - -- directive will be added at the top of the current file. This option can - -- have a negative impact on initial completion responsiveness, - -- particularly for the first few completion sessions after opening a - -- solution. - enable_import_completion = true, -- default false + -- Enables support for showing unimported types and unimported extension + -- methods in completion lists. When committed, the appropriate using + -- directive will be added at the top of the current file. This option can + -- have a negative impact on initial completion responsiveness, + -- particularly for the first few completion sessions after opening a + -- solution. + enable_import_completion = true, -- default false - -- Specifies whether to include preview versions of the .NET SDK when - -- determining which version to use for project loading. - sdk_include_prereleases = true, + -- Specifies whether to include preview versions of the .NET SDK when + -- determining which version to use for project loading. + sdk_include_prereleases = true, - -- Only run analyzers against open files when 'enableRoslynAnalyzers' is - -- true - analyze_open_documents_only = true, -- default false - }) - end, - ["lua_ls"] = function() - require("lspconfig").lua_ls.setup({ - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using - -- (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { - "vim", - "require", - }, - }, - workspace = { - checkThirdParty = false, -- stop a annoying dialog on startup - -- Make the server aware of Neovim runtime files - -- library = vim.api.nvim_get_runtime_file("", true), - library = { - [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true, - }, - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - }, - }, - }) - end, - }, - }) - end, + -- Only run analyzers against open files when 'enableRoslynAnalyzers' is + -- true + analyze_open_documents_only = true, -- default false + }) + end, + ["lua_ls"] = function() + require("lspconfig").lua_ls.setup({ + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { + "vim", + "require", + }, + }, + workspace = { + checkThirdParty = false, -- stop a annoying dialog on startup + -- Make the server aware of Neovim runtime files + -- library = vim.api.nvim_get_runtime_file("", true), + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true, + }, + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, + }) + end, + }, + }) + end, } diff --git a/vim/.vim/lua/utils.lua b/vim/.vim/lua/utils.lua index b3da80c..5d89b9e 100644 --- a/vim/.vim/lua/utils.lua +++ b/vim/.vim/lua/utils.lua @@ -1,6 +1,6 @@ local M = { use_google_cache = nil, - flags = { blink = true }, + flags = { blink = false }, } function M.exec(command, args)