added blink completion

This commit is contained in:
MasterGordon 2024-11-11 07:40:44 +01:00
parent a07446db2a
commit 0b40d67ae7
4 changed files with 91 additions and 113 deletions

View File

@ -2,19 +2,14 @@
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "blink.cmp": { "branch": "main", "commit": "75cadbcd2657ed01326ca2b0e5e4d78a77127ca3" },
"cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" },
"cmp-npm": { "branch": "main", "commit": "2337f109f51a09297596dd6b538b70ccba92b4e4" }, "cmp-npm": { "branch": "main", "commit": "2337f109f51a09297596dd6b538b70ccba92b4e4" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"crates.nvim": { "branch": "main", "commit": "8bf8358ee326d5d8c11dcd7ac0bcc9ff97dbc785" }, "crates.nvim": { "branch": "main", "commit": "8bf8358ee326d5d8c11dcd7ac0bcc9ff97dbc785" },
"cspell.nvim": { "branch": "main", "commit": "2c29bf573292c8f5053383d1be4ab908f4ecfc47" }, "cspell.nvim": { "branch": "main", "commit": "2c29bf573292c8f5053383d1be4ab908f4ecfc47" },
"editorconfig-vim": { "branch": "master", "commit": "3c2813f2566d9392ff3614248c5db43c3fda9d5f" }, "editorconfig-vim": { "branch": "master", "commit": "3c2813f2566d9392ff3614248c5db43c3fda9d5f" },
"fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" }, "fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" },
"formatter.nvim": { "branch": "master", "commit": "eb89a1f3e079f1b9680bc7293b75fffccb5e1598" }, "formatter.nvim": { "branch": "master", "commit": "eb89a1f3e079f1b9680bc7293b75fffccb5e1598" },
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
"gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" }, "gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" },
"heirline.nvim": { "branch": "master", "commit": "7a79753c1a42c3f52e89a6c42429e7f871e560cd" }, "heirline.nvim": { "branch": "master", "commit": "7a79753c1a42c3f52e89a6c42429e7f871e560cd" },
"lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" },
@ -34,7 +29,6 @@
"none-ls.nvim": { "branch": "main", "commit": "dcc8cd4efdcb29275681a3c95786a816330dbca6" }, "none-ls.nvim": { "branch": "main", "commit": "dcc8cd4efdcb29275681a3c95786a816330dbca6" },
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
"nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" },
"nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-dap": { "branch": "master", "commit": "8517126e9323e346f6a99b3b594c5a940b914dcd" }, "nvim-dap": { "branch": "master", "commit": "8517126e9323e346f6a99b3b594c5a940b914dcd" },
"nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },

View File

@ -57,3 +57,22 @@ end
vim.keymap.set("n", "<leader>u", insert_random_uuid, {noremap = true, silent = true}) vim.keymap.set("n", "<leader>u", insert_random_uuid, {noremap = true, silent = true})
vim.keymap.set("n", "<leader>U", insert_random_uuid_dashed, {noremap = true, silent = true}) vim.keymap.set("n", "<leader>U", insert_random_uuid_dashed, {noremap = true, silent = true})
local print_namespace = function()
local cmd = 'bash -c "xq *.csproj -q RootNamespace"'
-- insert namespace NAMESPACE.PATH.TO.FILE; at the start of the file
local output = vim.fn.system(cmd):gsub("\n", "")
local relative_path = vim.fn.expand("%:h")
local short_path = relative_path:gsub("/", ".")
local namespace = output .. "." .. short_path
if relative_path == "." then
namespace = output
end
vim.cmd [[normal! gg]]
vim.cmd [[normal! }]]
vim.cmd [[normal! o]]
vim.api.nvim_put({"namespace " .. namespace .. ";"}, "c", true, true)
vim.cmd [[normal! o]]
end
vim.keymap.set("n", "<leader>n", print_namespace, {silent = true})

View File

@ -88,9 +88,9 @@ require("lazy").setup(
"yioneko/nvim-vtsls", "yioneko/nvim-vtsls",
"williamboman/mason.nvim", "williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
"jay-babu/mason-null-ls.nvim", "jay-babu/mason-null-ls.nvim",
"seblj/roslyn.nvim" "seblj/roslyn.nvim",
"blink.cmp"
} }
}, },
{ {
@ -169,21 +169,73 @@ require("lazy").setup(
end end
}, },
"editorconfig/editorconfig-vim", "editorconfig/editorconfig-vim",
-- {
-- "hrsh7th/nvim-cmp",
-- config = function()
-- require("plugins/cmp")
-- end,
-- dependencies = {
-- "hrsh7th/cmp-buffer",
-- "hrsh7th/cmp-nvim-lsp",
-- "hrsh7th/cmp-path",
-- "hrsh7th/cmp-nvim-lua",
-- "hrsh7th/cmp-emoji",
-- "David-Kunz/cmp-npm",
-- "hrsh7th/cmp-nvim-lsp-signature-help",
-- "saadparwaiz1/cmp_luasnip"
-- }
-- },
{ {
"hrsh7th/nvim-cmp", "saghen/blink.cmp",
config = function() lazy = false, -- lazy loading handled internally
require("plugins/cmp") -- optional: provides snippets for the snippet source
end, dependencies = "rafamadriz/friendly-snippets",
dependencies = { -- use a release tag to download pre-built binaries
"hrsh7th/cmp-buffer", version = "v0.*",
"hrsh7th/cmp-nvim-lsp", -- OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
"hrsh7th/cmp-path", -- build = 'cargo build --release',
"hrsh7th/cmp-nvim-lua", -- If you use nix, you can build from source using latest nightly rust with:
"hrsh7th/cmp-emoji", -- build = 'nix run .#build-plugin',
"David-Kunz/cmp-npm",
"hrsh7th/cmp-nvim-lsp-signature-help", ---@module 'blink.cmp'
"saadparwaiz1/cmp_luasnip" ---@type blink.cmp.Config
} opts = {
-- 'default' for mappings similar to built-in completion
-- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
-- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
-- see the "default configuration" section below for full documentation on how to define
-- your own keymap.
keymap = {
preset = "enter",
["<C-f>"] = {"show", "show_documentation", "hide_documentation"}
},
highlight = {
-- sets the fallback highlight groups to nvim-cmp's highlight groups
-- useful for when your theme doesn't support blink.cmp
-- will be removed in a future release, assuming themes add support
use_nvim_cmp_as_default = true
},
-- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- adjusts spacing to ensure icons are aligned
nerd_font_variant = "mono",
windows = {
autocomplete = {
max_height = 20
},
documentation = {
auto_show = true
}
}
-- experimental auto-brackets support
-- accept = { auto_brackets = { enabled = true } }
-- experimental signature help support
-- trigger = { signature_help = { enabled = true } }
},
-- allows extending the enabled_providers array elsewhere in your config
-- without having to redefining it
opts_extend = {"sources.completion.enabled_providers"}
}, },
{ {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",

View File

@ -122,7 +122,8 @@ local on_attach = function(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, ...) vim.api.nvim_buf_set_option(bufnr, ...)
end end
end end
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) -- local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities())
require "lspconfig".jsonls.setup { require "lspconfig".jsonls.setup {
on_attach = on_attach, on_attach = on_attach,
@ -254,94 +255,6 @@ require("roslyn").setup(
} }
) )
-- nvim_lsp.omnisharp.setup {
-- cmd = {"OmniSharp"},
-- enable_editorconfig_support = true,
-- enable_roslyn_analyzers = true,
-- enable_import_completion = true,
-- on_attach = function(client, bufnr)
-- client.server_capabilities.semanticTokensProvider = {
-- full = vim.empty_dict(),
-- legend = {
-- tokenModifiers = {"static_symbol"},
-- tokenTypes = {
-- "comment",
-- "excluded_code",
-- "identifier",
-- "keyword",
-- "keyword_control",
-- "number",
-- "operator",
-- "operator_overloaded",
-- "preprocessor_keyword",
-- "string",
-- "whitespace",
-- "text",
-- "static_symbol",
-- "preprocessor_text",
-- "punctuation",
-- "string_verbatim",
-- "string_escape_character",
-- "class_name",
-- "delegate_name",
-- "enum_name",
-- "interface_name",
-- "module_name",
-- "struct_name",
-- "type_parameter_name",
-- "field_name",
-- "enum_member_name",
-- "constant_name",
-- "local_name",
-- "parameter_name",
-- "method_name",
-- "extension_method_name",
-- "property_name",
-- "event_name",
-- "namespace_name",
-- "label_name",
-- "xml_doc_comment_attribute_name",
-- "xml_doc_comment_attribute_quotes",
-- "xml_doc_comment_attribute_value",
-- "xml_doc_comment_cdata_section",
-- "xml_doc_comment_comment",
-- "xml_doc_comment_delimiter",
-- "xml_doc_comment_entity_reference",
-- "xml_doc_comment_name",
-- "xml_doc_comment_processing_instruction",
-- "xml_doc_comment_text",
-- "xml_literal_attribute_name",
-- "xml_literal_attribute_quotes",
-- "xml_literal_attribute_value",
-- "xml_literal_cdata_section",
-- "xml_literal_comment",
-- "xml_literal_delimiter",
-- "xml_literal_embedded_expression",
-- "xml_literal_entity_reference",
-- "xml_literal_name",
-- "xml_literal_processing_instruction",
-- "xml_literal_text",
-- "regex_comment",
-- "regex_character_class",
-- "regex_anchor",
-- "regex_quantifier",
-- "regex_grouping",
-- "regex_alternation",
-- "regex_text",
-- "regex_self_escaped_character",
-- "regex_other_escape"
-- }
-- },
-- range = true
-- }
-- on_attach(client, bufnr)
-- end,
-- flags = {
-- debounce_text_changes = 150
-- },
-- capabilities = capabilities
-- }
nvim_lsp.rust_analyzer.setup { nvim_lsp.rust_analyzer.setup {
on_attach = on_attach, on_attach = on_attach,
flags = { flags = {