who knows

This commit is contained in:
Christian Nieves
2025-01-27 20:49:29 +00:00
parent 5e739703d0
commit 1bbcef640d
3 changed files with 330 additions and 349 deletions

View File

@ -2,170 +2,152 @@ local use_google = require("utils").use_google
local flags = require("utils").flags
return {
{
"saghen/blink.compat",
-- use the latest release, via version = '*', if you also use the latest release for blink.cmp
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 = true,
debug = true,
},
},
{
"saghen/blink.cmp",
lazy = false, -- lazy loading handled internally
cond = flags.blink,
dependencies = {
"Exafunction/codeium.nvim",
"chrisgrieser/cmp-nerdfont",
"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',
{
"saghen/blink.compat",
-- use the latest release, via version = '*', if you also use the latest release for blink.cmp
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 = true,
debug = true,
},
},
{
"saghen/blink.cmp",
lazy = false, -- lazy loading handled internally
cond = flags.blink,
dependencies = {
"Exafunction/codeium.nvim",
"chrisgrieser/cmp-nerdfont",
"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',
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
-- stylua: ignore
keymap = {
preset = "none",
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
["<C-e>"] = { "hide", "fallback" },
["<CR>"] = { "accept", "fallback" },
keymap = {
preset = "none",
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
["<C-e>"] = { "hide", "fallback" },
["<CR>"] = { "accept", "fallback" },
["<Tab>"] = { "select_next", "snippet_forward", "accept", "fallback" },
["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" },
["<Tab>"] = { "select_next", "snippet_forward", "accept", "fallback" },
["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" },
["<Up>"] = { "select_prev", "fallback" },
["<Down>"] = { "select_next", "fallback" },
["<Up>"] = { "select_prev", "fallback" },
["<Down>"] = { "select_next", "fallback" },
["<S-Up>"] = { "scroll_documentation_up", "fallback" },
["<S-Down>"] = { "scroll_documentation_down", "fallback" },
},
sources = {
default = function(ctx)
local providerToEnable = {
"lsp",
"path",
"snippets",
"ripgrep",
"emoji",
"nerdfont",
"buffer",
}
if use_google() then
table.insert(providerToEnable, "nvim_ciderlsp")
table.insert(providerToEnable, "buganizer")
else
table.insert(providerToEnable, "codeium")
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 = {
module = "blink-ripgrep",
name = "Ripgrep",
-- the options below are optional, some default values are shown
---@module "blink-ripgrep"
---@type blink-ripgrep.Options
opts = {
prefix_min_len = 3,
context_size = 5,
max_filesize = "1M",
additional_rg_options = {},
},
},
-- 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
},
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,
},
nvim_ciderlsp = {
name = "nvim_ciderlsp",
module = "blink.compat.source",
score_offset = 100,
},
buganizer = {
name = "nvim_buganizer",
module = "blink.compat.source",
},
},
},
-- 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 = {
kind_icon = {
ellipsis = false,
text = function(ctx)
local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind)
return kind_icon
end,
-- Optionally, you may also use the highlights from mini.icons
highlight = function(ctx)
local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
return hl
end,
},
},
},
},
trigger = {
show_on_x_blocked_trigger_characters = { "'", '"', "(", "{" },
},
},
},
["<S-Up>"] = { "scroll_documentation_up", "fallback" },
["<S-Down>"] = { "scroll_documentation_down", "fallback" },
},
sources = {
default = function(ctx)
local providerToEnable = {
"lsp",
"path",
"snippets",
"ripgrep",
"emoji",
"nerdfont",
"buffer",
}
if use_google() then
table.insert(providerToEnable, "nvim_ciderlsp")
table.insert(providerToEnable, "buganizer")
else
table.insert(providerToEnable, "codeium")
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 = {
module = "blink-ripgrep",
name = "Ripgrep",
-- the options below are optional, some default values are shown
---@module "blink-ripgrep"
---@type blink-ripgrep.Options
opts = {
prefix_min_len = 3,
context_size = 5,
max_filesize = "1M",
additional_rg_options = {},
},
},
-- 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
},
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,
},
nvim_ciderlsp = {
name = "nvim_ciderlsp",
module = "blink.compat.source",
score_offset = 100,
},
buganizer = {
name = "nvim_buganizer",
module = "blink.compat.source",
},
},
},
-- 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,
},
trigger = {
show_on_x_blocked_trigger_characters = { "'", '"', "(", "{" },
},
},
},
-- allows extending the providers array elsewhere in your config
-- without having to redefine it
opts_extend = { "sources.default" },
},
-- allows extending the providers array elsewhere in your config
-- without having to redefine it
opts_extend = { "sources.default" },
},
}

View File

@ -1,129 +1,128 @@
return {
"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
"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
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,
}

View File

@ -1,100 +1,100 @@
local M = {
use_google_cache = nil,
flags = { blink = false },
use_google_cache = nil,
flags = { blink = true },
}
function M.exec(command, args)
local Job = require("plenary.job")
local job = Job:new({
command = command,
args = args,
})
job:sync()
job:wait()
return job:result()
local Job = require("plenary.job")
local job = Job:new({
command = command,
args = args,
})
job:sync()
job:wait()
return job:result()
end
function M.map(mode, lhs, rhs, opts)
local options = { noremap = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
-- vim.api.nvim_set_keymap(mode, lhs, rhs, options)
vim.keymap.set(mode, lhs, rhs, options)
local options = { noremap = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
-- vim.api.nvim_set_keymap(mode, lhs, rhs, options)
vim.keymap.set(mode, lhs, rhs, options)
end
function M.use_google()
if M.use_google_cache == nil then
M.use_google_cache = M.file_exists(os.getenv("HOME") .. "/use_google")
end
return M.use_google_cache
if M.use_google_cache == nil then
M.use_google_cache = M.file_exists(os.getenv("HOME") .. "/use_google")
end
return M.use_google_cache
end
function M.file_exists(name)
local f = io.open(name, "r")
if f ~= nil then
io.close(f)
return true
else
return false
end
local f = io.open(name, "r")
if f ~= nil then
io.close(f)
return true
else
return false
end
end
function M.dump(o)
if type(o) == "table" then
local s = "{ "
for k, v in pairs(o) do
if type(k) ~= "number" then
k = '"' .. k .. '"'
end
s = s .. "[" .. k .. "] = " .. M.dump(v) .. ","
end
return s .. "} "
else
return tostring(o)
end
if type(o) == "table" then
local s = "{ "
for k, v in pairs(o) do
if type(k) ~= "number" then
k = '"' .. k .. '"'
end
s = s .. "[" .. k .. "] = " .. M.dump(v) .. ","
end
return s .. "} "
else
return tostring(o)
end
end
function M.tprint(tbl, indent)
if not indent then
indent = 0
end
local toprint = string.rep(" ", indent) .. "{\r\n"
indent = indent + 2
for k, v in pairs(tbl) do
toprint = toprint .. string.rep(" ", indent)
if type(k) == "number" then
toprint = toprint .. "[" .. k .. "] = "
elseif type(k) == "string" then
toprint = toprint .. k .. "= "
end
if type(v) == "number" then
toprint = toprint .. v .. ",\r\n"
elseif type(v) == "string" then
toprint = toprint .. '"' .. v .. '",\r\n'
elseif type(v) == "table" then
toprint = toprint .. M.tprint(v, indent + 2) .. ",\r\n"
else
toprint = toprint .. '"' .. tostring(v) .. '",\r\n'
end
end
toprint = toprint .. string.rep(" ", indent - 2) .. "}"
return toprint
if not indent then
indent = 0
end
local toprint = string.rep(" ", indent) .. "{\r\n"
indent = indent + 2
for k, v in pairs(tbl) do
toprint = toprint .. string.rep(" ", indent)
if type(k) == "number" then
toprint = toprint .. "[" .. k .. "] = "
elseif type(k) == "string" then
toprint = toprint .. k .. "= "
end
if type(v) == "number" then
toprint = toprint .. v .. ",\r\n"
elseif type(v) == "string" then
toprint = toprint .. '"' .. v .. '",\r\n'
elseif type(v) == "table" then
toprint = toprint .. M.tprint(v, indent + 2) .. ",\r\n"
else
toprint = toprint .. '"' .. tostring(v) .. '",\r\n'
end
end
toprint = toprint .. string.rep(" ", indent - 2) .. "}"
return toprint
end
function M.log(message)
local log_file_path = vim.fn.expand("$HOME/nvim.log")
local log_file = io.open(log_file_path, "a")
io.output(log_file)
io.write(message .. "\n")
io.close(log_file)
local log_file_path = vim.fn.expand("$HOME/nvim.log")
local log_file = io.open(log_file_path, "a")
io.output(log_file)
io.write(message .. "\n")
io.close(log_file)
end
function M.TableConcat(t1, t2)
for i = 1, #t2 do
t1[#t1 + 1] = t2[i]
end
return t1
for i = 1, #t2 do
t1[#t1 + 1] = t2[i]
end
return t1
end
return M