mirror of
https://github.com/kristoferssolo/SoloVim.git
synced 2026-02-04 06:42:05 +00:00
feat(cmp): update to blink.cmp
This commit is contained in:
140
lua/plugins/blink.lua
Normal file
140
lua/plugins/blink.lua
Normal file
@@ -0,0 +1,140 @@
|
||||
return {
|
||||
{
|
||||
|
||||
"saghen/blink.cmp",
|
||||
dependencies = {
|
||||
"folke/lazydev.nvim",
|
||||
"echasnovski/mini.icons",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"Saecki/crates.nvim",
|
||||
"davidsierradz/cmp-conventionalcommits",
|
||||
"petertriho/cmp-git", -- TODO: make this work
|
||||
"mikavilpas/blink-ripgrep.nvim",
|
||||
{
|
||||
"MattiasMTS/cmp-dbee",
|
||||
dependencies = {
|
||||
{ "kndndrj/nvim-dbee" },
|
||||
},
|
||||
ft = { "sql", "mysql", "plsql" },
|
||||
opts = {},
|
||||
},
|
||||
},
|
||||
version = "*",
|
||||
-- build = "cargo build --release", -- build from source
|
||||
|
||||
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 full "keymap" documentation for information on defining your own keymap.
|
||||
keymap = {
|
||||
preset = "default",
|
||||
["<C-e>"] = { "hide", "show", "fallback" },
|
||||
["<cr>"] = { "select_and_accept", "fallback" },
|
||||
["<C-u>"] = { "scroll_documentation_up", "fallback" },
|
||||
["<C-d>"] = { "scroll_documentation_down", "fallback" },
|
||||
["<C-g>"] = {
|
||||
function()
|
||||
require("blink-cmp").show({ sources = { "ripgrep" } })
|
||||
end,
|
||||
},
|
||||
["<Tab>"] = {},
|
||||
["<S-Tab>"] = {},
|
||||
},
|
||||
|
||||
appearance = {
|
||||
use_nvim_cmp_as_default = true,
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
|
||||
-- Default list of enabled providers defined so that you can extend it
|
||||
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||
sources = {
|
||||
default = { "lazydev", "crates", "lsp", "path", "luasnip", "buffer", "dbee" },
|
||||
providers = {
|
||||
lazydev = {
|
||||
name = "LazyDev",
|
||||
module = "lazydev.integrations.blink",
|
||||
score_offset = 100,
|
||||
},
|
||||
crates = {
|
||||
name = "crates",
|
||||
module = "blink.compat.source",
|
||||
score_offset = 10,
|
||||
},
|
||||
git = {
|
||||
name = "git",
|
||||
module = "blink.compat.source",
|
||||
score_offset = 10,
|
||||
},
|
||||
dbee = {
|
||||
name = "cmp-dbee",
|
||||
module = "blink.compat.source",
|
||||
score_offset = 50,
|
||||
},
|
||||
ripgrep = {
|
||||
module = "blink-ripgrep",
|
||||
name = "Ripgrep",
|
||||
opts = {
|
||||
prefix_min_len = 3,
|
||||
context_size = 5,
|
||||
max_filesize = "1M",
|
||||
project_root_marker = { ".git", "package.json", ".root" },
|
||||
search_casing = "--smart-case",
|
||||
additional_rg_options = {},
|
||||
fallback_to_regex_highlighting = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
documentation = { window = { border = "single" }, auto_show = true },
|
||||
ghost_text = { enabled = true },
|
||||
menu = {
|
||||
border = "single",
|
||||
auto_show = function(ctx)
|
||||
return ctx.mode ~= "cmdline"
|
||||
end,
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
signature = { enabled = true, window = { border = "single" } },
|
||||
snippets = {
|
||||
expand = function(snippet)
|
||||
require("luasnip").lsp_expand(snippet)
|
||||
end,
|
||||
active = function(filter)
|
||||
if filter and filter.direction then
|
||||
return require("luasnip").jumpable(filter.direction)
|
||||
end
|
||||
return require("luasnip").in_snippet()
|
||||
end,
|
||||
jump = function(direction)
|
||||
require("luasnip").jump(direction)
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts_extend = { "sources.default" },
|
||||
},
|
||||
{
|
||||
"saghen/blink.compat",
|
||||
version = "*",
|
||||
lazy = true,
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
@@ -7,7 +7,7 @@ return {
|
||||
|
||||
require("cmp_git").setup({
|
||||
-- defaults
|
||||
filetypes = { "gitcommit", "octo", "NeogitCommitMessage" },
|
||||
filetypes = { "gitcommit", "octo" },
|
||||
remotes = { "upstream", "origin" }, -- in order of most to least prioritized
|
||||
enableRemoteUrlRewrites = false, -- enable git url rewrites, see https://git-scm.com/docs/git-config#Documentation/git-config.txt-urlltbasegtinsteadOf
|
||||
git = {
|
||||
@@ -41,7 +41,9 @@ return {
|
||||
},
|
||||
},
|
||||
gitlab = {
|
||||
hosts = {}, -- list of private instances of gitlab
|
||||
hosts = {
|
||||
"git.modulation.lv",
|
||||
}, -- list of private instances of gitlab
|
||||
issues = {
|
||||
limit = 100,
|
||||
state = "opened", -- opened, closed, all
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = { "InsertEnter", "CmdlineEnter" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer", -- buffer completions
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"FelipeLema/cmp-async-path", -- path completions
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
{ "Saecki/crates.nvim", event = { "BufRead Cargo.toml" } },
|
||||
{
|
||||
"vrslev/cmp-pypi",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
event = { "BufRead pyproject.toml" },
|
||||
},
|
||||
"SergioRibera/cmp-dotenv",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-calc",
|
||||
"Exafunction/codeium.nvim",
|
||||
"zbirenbaum/copilot-cmp",
|
||||
"petertriho/cmp-git",
|
||||
"davidsierradz/cmp-conventionalcommits",
|
||||
"supermaven-inc/supermaven-nvim",
|
||||
"zjp-CN/nvim-cmp-lsp-rs",
|
||||
{
|
||||
"MattiasMTS/cmp-dbee",
|
||||
dependencies = {
|
||||
{ "kndndrj/nvim-dbee" },
|
||||
},
|
||||
ft = { "sql", "mysql", "plsql" },
|
||||
opts = {},
|
||||
},
|
||||
},
|
||||
opts = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local cmp_lsp_rs = require("cmp_lsp_rs")
|
||||
local comparators = cmp_lsp_rs.comparators
|
||||
local compare = require("cmp").config.compare
|
||||
local kind_icons = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
Copilot = "",
|
||||
Codeium = "",
|
||||
Supermaven = "",
|
||||
}
|
||||
opts = {
|
||||
mapping = {
|
||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
-- Accept currently selected item. If none selected, `select` first item.
|
||||
-- Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "crates" },
|
||||
{ name = "async_path" },
|
||||
{ name = "cmp-dbee" },
|
||||
{ name = "buffer", keyword_length = 4 },
|
||||
{ name = "luasnip" },
|
||||
{ name = "neorg" },
|
||||
{ name = "pypi" },
|
||||
{ name = "dotenv" },
|
||||
{ name = "calc" },
|
||||
{ name = "git" },
|
||||
{ name = "conventionalcommits" },
|
||||
{ name = "supermaven" },
|
||||
-- { name = "copilot" },
|
||||
-- { name = "codeium" },
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
vim_item.kind = kind_icons[vim_item.kind]
|
||||
vim_item.menu = ({
|
||||
git = "[git]",
|
||||
conventionalcommits = "[CC]",
|
||||
calc = "[calc]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[lua]",
|
||||
async_path = "[path]",
|
||||
codeium = "[codeium]",
|
||||
copilot = "[copilot]",
|
||||
luasnip = "[snip]",
|
||||
neorg = "[neorg]",
|
||||
crates = "[crates]",
|
||||
pypi = "[pypi]",
|
||||
dotenv = "[env]",
|
||||
buffer = "[buf]",
|
||||
supermaven = "[AI]",
|
||||
["cmp-dbee"] = "[DB]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
expandable_indicator = true,
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
confirm_opts = {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
},
|
||||
sorting = {
|
||||
comparators = {
|
||||
compare.exact,
|
||||
compare.score,
|
||||
-- comparators.inherent_import_inscope,
|
||||
comparators.inscope_inherent_import,
|
||||
comparators.sort_by_label_but_underscore_last,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, source in ipairs(opts.sources) do
|
||||
cmp_lsp_rs.filter_out.entry_filter(source)
|
||||
end
|
||||
return opts
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("cmp").setup(opts)
|
||||
end,
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
return {
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
--[[ lazy = false,
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = {
|
||||
style = "night",
|
||||
@@ -15,8 +15,8 @@ return {
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("tokyonight").setup(opts)
|
||||
vim.cmd.colorscheme("tokyonight")
|
||||
end, ]]
|
||||
-- vim.cmd.colorscheme("tokyonight")
|
||||
end,
|
||||
},
|
||||
{ "lunarvim/darkplus.nvim" },
|
||||
{ "catppuccin/nvim", name = "catppuccin.nvim" },
|
||||
|
||||
@@ -13,6 +13,11 @@ return {
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
completion = {
|
||||
cmp = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
smart_insert = true,
|
||||
insert_closing_quote = true,
|
||||
autoload = true,
|
||||
|
||||
@@ -5,7 +5,6 @@ return {
|
||||
"williamboman/mason.nvim",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"mfussenegger/nvim-dap",
|
||||
-- { "simrat39/rust-tools.nvim", ft = "rust" },
|
||||
"nvim-neotest/nvim-nio",
|
||||
{ "mfussenegger/nvim-dap-python", ft = "python" },
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
|
||||
@@ -5,17 +5,13 @@ return {
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
|
||||
"<leader>od",
|
||||
function()
|
||||
require("dbee").toggle()
|
||||
end,
|
||||
require("dbee").toggle,
|
||||
desc = "Toggle Dbee",
|
||||
},
|
||||
},
|
||||
cmd = "Dbee",
|
||||
cmd = { "Dbee" },
|
||||
build = function()
|
||||
-- go install github.com/kndndrj/nvim-dbee/dbee@latest
|
||||
require("dbee").install("go")
|
||||
end,
|
||||
opts = {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
return {
|
||||
"zeioth/garbage-day.nvim",
|
||||
dependencies = { "neovim/nvim-lspconfig" },
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
aggressive_mode = false,
|
||||
excluded_lsp_clients = { "rust_analyzer" },
|
||||
grace_period = 60 * 15,
|
||||
wakeup_delay = 0,
|
||||
},
|
||||
}
|
||||
11
lua/plugins/lazydev.lua
Normal file
11
lua/plugins/lazydev.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua", -- only load on lua files
|
||||
opts = {
|
||||
library = {
|
||||
-- See the configuration section for more details
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function(lsp, capabilities)
|
||||
lsp.basedpyright.setup({
|
||||
capabilities = capabilities,
|
||||
basedpyright = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
diagnosticMode = "openFilesOnly",
|
||||
useLibraryCodeForTypes = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,14 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function(lsp, capabilities)
|
||||
lsp.bashls.setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = {
|
||||
"sh",
|
||||
"bash",
|
||||
"zsh",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,21 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function(lsp, capabilities)
|
||||
capabilities = capabilities
|
||||
lsp.clangd.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
clangd = {
|
||||
InlayHints = {
|
||||
Designators = true,
|
||||
Enabled = true,
|
||||
ParameterNames = true,
|
||||
DeducedTypes = true,
|
||||
},
|
||||
fallbackFlags = { "-std=c++20" },
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,20 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function(lsp, capabilities)
|
||||
lsp.emmet_ls.setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = {
|
||||
"html",
|
||||
"htmldjango",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"css",
|
||||
"sass",
|
||||
"scss",
|
||||
"less",
|
||||
"eruby",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,20 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function(lsp, capabilities)
|
||||
lsp.gopls.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
hints = {
|
||||
rangeVariableTypes = true,
|
||||
parameterNames = true,
|
||||
constantValues = true,
|
||||
assignVariableTypes = true,
|
||||
compositeLiteralFields = true,
|
||||
compositeLiteralTypes = true,
|
||||
functionTypeParameters = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,17 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function(lsp, capabilities)
|
||||
lsp.html.setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = {
|
||||
"html",
|
||||
"htmldjango",
|
||||
"templ",
|
||||
},
|
||||
init_options = {
|
||||
provideFormatter = false,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,45 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function(lsp, capabilities)
|
||||
lsp.lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
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", "awesome", "client" },
|
||||
},
|
||||
-- workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
-- library = vim.api.nvim_get_runtime_file("", true),
|
||||
-- },
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
root_pattern = {
|
||||
".stylua.toml",
|
||||
".luarc.json",
|
||||
".luarc.jsonc",
|
||||
".luacheckrc",
|
||||
"stylua.toml",
|
||||
"selene.toml",
|
||||
"selene.yml",
|
||||
".git",
|
||||
},
|
||||
format = {
|
||||
enable = false,
|
||||
},
|
||||
hint = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,29 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function(lsp, capabilities)
|
||||
lsp.pylsp.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
autopep8 = { enabled = false },
|
||||
flake8 = { enabled = false },
|
||||
pylint = { enabled = false },
|
||||
yapf = { enabled = false },
|
||||
pydocstyle = { enabled = false },
|
||||
mccabe = { enabled = false },
|
||||
rope_autoimport = { enabled = true },
|
||||
rope_completion = {
|
||||
enabled = true,
|
||||
eager = true,
|
||||
},
|
||||
pycodestyle = {
|
||||
maxLineLength = nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,17 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function(lsp, capabilities)
|
||||
lsp.pylyzer.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
python = {
|
||||
diagnostics = true,
|
||||
inlayHints = true,
|
||||
smartCompletion = true,
|
||||
checkOnType = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,32 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function(lsp, capabilities)
|
||||
lsp.texlab.setup({
|
||||
capabilities = capabilities,
|
||||
texlab = {
|
||||
auxDirectory = ".",
|
||||
bibtexFormatter = "texlab",
|
||||
build = {
|
||||
args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
|
||||
executable = "xelatex",
|
||||
forwardSearchAfter = false,
|
||||
onSave = false,
|
||||
},
|
||||
chktex = {
|
||||
onEdit = false,
|
||||
onOpenAndSave = false,
|
||||
},
|
||||
diagnosticsDelay = 0,
|
||||
formatterLineLength = 120,
|
||||
forwardSearch = {
|
||||
args = {},
|
||||
},
|
||||
latexFormatter = "latexindent",
|
||||
latexindent = {
|
||||
modifyLineBreaks = false,
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,14 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.setup = function(lsp, capabilities)
|
||||
lsp.tinymist.setup({
|
||||
capabilities = capabilities,
|
||||
offset_encoding = "utf-8",
|
||||
settings = {
|
||||
exportPdf = "onType",
|
||||
outputPath = "$root/target/$dir/$name",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -3,34 +3,43 @@ return {
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"folke/neodev.nvim",
|
||||
"saghen/blink.cmp",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"folke/trouble.nvim",
|
||||
"folke/neoconf.nvim",
|
||||
"piersolenski/telescope-import.nvim",
|
||||
"mrcjkb/rustaceanvim",
|
||||
},
|
||||
|
||||
config = function()
|
||||
opts = function()
|
||||
return require("solo.lspconfig-opts")
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("mason").setup()
|
||||
local lsp = require("lspconfig")
|
||||
local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
lsp_capabilities = vim.tbl_deep_extend("keep", lsp_capabilities, {
|
||||
textDocument = {
|
||||
foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
local default_setup = function(server)
|
||||
lsp[server].setup({
|
||||
capabilities = lsp_capabilities,
|
||||
local function extend_capabilities(capabilities)
|
||||
return vim.tbl_deep_extend("keep", capabilities, {
|
||||
textDocument = {
|
||||
foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
for server, config in pairs(opts.servers) do
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
|
||||
config.capabilities = extend_capabilities(capabilities)
|
||||
lspconfig[server].setup(config)
|
||||
end
|
||||
|
||||
local default_setup = function(server)
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
lspconfig[server].setup({
|
||||
capabilities = extend_capabilities(capabilities),
|
||||
})
|
||||
end
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
desc = "LSP actions",
|
||||
callback = function(event)
|
||||
@@ -43,6 +52,7 @@ return {
|
||||
end
|
||||
vim.keymap.set("n", keys, func, { buffer = event.buf, desc = desc })
|
||||
end
|
||||
local trouble = require("trouble")
|
||||
|
||||
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
|
||||
@@ -66,11 +76,9 @@ return {
|
||||
nmap("<leader>lj", vim.diagnostic.goto_next, "Diagnostic Next")
|
||||
nmap("<leader>lk", vim.diagnostic.goto_prev, "Diagnostic Prev")
|
||||
nmap("]d", function()
|
||||
local trouble = require("trouble")
|
||||
trouble.next({ mode = "diagnostics", skip_groups = true, jump = true })
|
||||
end, "LSP: Trouble Next")
|
||||
nmap("[d", function()
|
||||
local trouble = require("trouble")
|
||||
trouble.prev({ mode = "diagnostics", skip_groups = true, jump = true })
|
||||
end, "Trouble Prev")
|
||||
vim.keymap.set(
|
||||
@@ -120,9 +128,6 @@ return {
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "rounded",
|
||||
})
|
||||
local html_opts = {
|
||||
filetypes = { "html", "htmldjango", "templ" },
|
||||
}
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
automatic_installation = true,
|
||||
@@ -139,46 +144,11 @@ return {
|
||||
"lua_ls",
|
||||
"tailwindcss",
|
||||
"texlab",
|
||||
-- "tinymist",
|
||||
"tinymist",
|
||||
"ts_ls",
|
||||
},
|
||||
handlers = {
|
||||
default_setup,
|
||||
clangd = function()
|
||||
lsp_capabilities.offsetEncoding = { "utf-16" }
|
||||
require("plugins.lsp.clangd").setup(lsp, lsp_capabilities)
|
||||
end,
|
||||
bashls = function()
|
||||
require("plugins.lsp.bash").setup(lsp, lsp_capabilities)
|
||||
end,
|
||||
emmet_ls = function()
|
||||
require("plugins.lsp.emmet").setup(lsp, lsp_capabilities)
|
||||
end,
|
||||
texlab = function()
|
||||
require("plugins.lsp.tex").setup(lsp, lsp_capabilities)
|
||||
end,
|
||||
lua_ls = function()
|
||||
require("plugins.lsp.lua").setup(lsp, lsp_capabilities)
|
||||
end,
|
||||
htmx = function()
|
||||
lsp.htmx.setup(html_opts)
|
||||
end,
|
||||
pylyzer = function()
|
||||
require("plugins.lsp.pylyzer").setup(lsp, lsp_capabilities)
|
||||
end,
|
||||
basedpyright = function()
|
||||
require("plugins.lsp.basedpyright").setup(lsp, lsp_capabilities)
|
||||
end,
|
||||
jinja_lsp = function()
|
||||
lsp.jinja_lsp.setup(html_opts)
|
||||
end,
|
||||
html = function()
|
||||
require("plugins.lsp.html").setup(lsp, lsp_capabilities)
|
||||
end,
|
||||
tinymist = function()
|
||||
require("plugins.lsp.tinymist").setup(lsp, lsp_capabilities)
|
||||
end,
|
||||
ts_ls = function() end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
|
||||
@@ -5,7 +5,7 @@ return {
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets", -- a bunch of snippets to use
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
-- "saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
return {
|
||||
"folke/neodev.nvim",
|
||||
dependencies = { "rcarriga/nvim-dap-ui" },
|
||||
opts = {
|
||||
library = {
|
||||
enabled = true, -- when not enabled, neodev will not change any settings to the LSP server
|
||||
-- these settings will be used for your Neovim config directory
|
||||
runtime = true, -- runtime path
|
||||
types = true, -- full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others
|
||||
-- plugins = true, -- installed opt or start plugins in packpath
|
||||
-- you can also specify the list of plugins to make available as a workspace library
|
||||
plugins = { "nvim-treesitter", "plenary.nvim", "telescope.nvim", "nvim-dap-ui" },
|
||||
},
|
||||
setup_jsonls = true, -- configures jsonls to provide completion for project specific .luarc.json files
|
||||
-- for your Neovim config directory, the config.library settings will be used as is
|
||||
-- for plugin directories (root_dirs having a /lua directory), config.library.plugins will be disabled
|
||||
-- for any other directory, config.library.enabled will be set to false
|
||||
override = function(root_dir, options) end,
|
||||
-- With lspconfig, Neodev will automatically setup your lua-language-server
|
||||
-- If you disable this, then you have to set {before_init=require("neodev.lsp").before_init}
|
||||
-- in your lsp start options
|
||||
lspconfig = true,
|
||||
-- much faster, but needs a recent built of lua-language-server
|
||||
-- needs lua-language-server >= 3.6.0
|
||||
pathStrict = true,
|
||||
},
|
||||
}
|
||||
@@ -23,6 +23,7 @@ return {
|
||||
fg = "NONE", -- The gui style to use for the fg highlight group.
|
||||
bg = "BOLD", -- The gui style to use for the bg highlight group.
|
||||
},
|
||||
|
||||
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
|
||||
-- highlighting of the line containing the todo comment
|
||||
-- * before: highlights before the keyword (typically comment characters)
|
||||
|
||||
@@ -112,12 +112,12 @@ return {
|
||||
["[M"] = "@function.outer",
|
||||
["[]"] = "@class.outer",
|
||||
},
|
||||
-- goto_next = {
|
||||
-- [']i'] = "@conditional.inner",
|
||||
-- },
|
||||
-- goto_previous = {
|
||||
-- ['[i'] = "@conditional.inner",
|
||||
-- }
|
||||
goto_next = {
|
||||
["]i"] = "@conditional.inner",
|
||||
},
|
||||
goto_previous = {
|
||||
["[i"] = "@conditional.inner",
|
||||
},
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
return {
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
-- version = "*",
|
||||
cmd = "Trouble",
|
||||
keys = {
|
||||
{
|
||||
|
||||
181
lua/solo/lspconfig-opts.lua
Normal file
181
lua/solo/lspconfig-opts.lua
Normal file
@@ -0,0 +1,181 @@
|
||||
return {
|
||||
servers = {
|
||||
gopls = {
|
||||
settings = {
|
||||
hints = {
|
||||
rangeVariableTypes = true,
|
||||
parameterNames = true,
|
||||
constantValues = true,
|
||||
assignVariableTypes = true,
|
||||
compositeLiteralFields = true,
|
||||
compositeLiteralTypes = true,
|
||||
functionTypeParameters = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
lua_ls = {
|
||||
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", "awesome", "client" },
|
||||
},
|
||||
-- workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
-- library = vim.api.nvim_get_runtime_file("", true),
|
||||
-- },
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
root_pattern = {
|
||||
".stylua.toml",
|
||||
".luarc.json",
|
||||
".luarc.jsonc",
|
||||
".luacheckrc",
|
||||
"stylua.toml",
|
||||
"selene.toml",
|
||||
"selene.yml",
|
||||
".git",
|
||||
},
|
||||
format = {
|
||||
enable = false,
|
||||
},
|
||||
hint = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
clangd = {
|
||||
capabilities = {
|
||||
offsetEncoding = { "utf-16" },
|
||||
},
|
||||
settings = {
|
||||
clangd = {
|
||||
InlayHints = {
|
||||
Designators = true,
|
||||
Enabled = true,
|
||||
ParameterNames = true,
|
||||
DeducedTypes = true,
|
||||
},
|
||||
fallbackFlags = { "-std=c++20" },
|
||||
},
|
||||
},
|
||||
},
|
||||
bashls = {
|
||||
filetypes = {
|
||||
"sh",
|
||||
"bash",
|
||||
"zsh",
|
||||
},
|
||||
},
|
||||
emmet_ls = {
|
||||
filetypes = {
|
||||
"html",
|
||||
"htmldjango",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"css",
|
||||
"sass",
|
||||
"scss",
|
||||
"less",
|
||||
"eruby",
|
||||
},
|
||||
},
|
||||
texlab = {
|
||||
texlab = {
|
||||
auxDirectory = ".",
|
||||
bibtexFormatter = "texlab",
|
||||
build = {
|
||||
args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
|
||||
executable = "xelatex",
|
||||
forwardSearchAfter = false,
|
||||
onSave = false,
|
||||
},
|
||||
chktex = {
|
||||
onEdit = false,
|
||||
onOpenAndSave = false,
|
||||
},
|
||||
diagnosticsDelay = 0,
|
||||
formatterLineLength = 120,
|
||||
forwardSearch = {
|
||||
args = {},
|
||||
},
|
||||
latexFormatter = "latexindent",
|
||||
latexindent = {
|
||||
modifyLineBreaks = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
htmx = {
|
||||
filetypes = { "html", "htmldjango", "templ" },
|
||||
},
|
||||
--[[ pylyzer = {
|
||||
settings = {
|
||||
python = {
|
||||
diagnostics = true,
|
||||
inlayHints = true,
|
||||
smartCompletion = true,
|
||||
checkOnType = true,
|
||||
},
|
||||
},
|
||||
}, ]]
|
||||
--[[ basedpyright = {
|
||||
basedpyright = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
diagnosticMode = "openFilesOnly",
|
||||
useLibraryCodeForTypes = true,
|
||||
},
|
||||
},
|
||||
}, ]]
|
||||
--[[ pylsp = {
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
autopep8 = { enabled = false },
|
||||
flake8 = { enabled = false },
|
||||
pylint = { enabled = false },
|
||||
yapf = { enabled = false },
|
||||
pydocstyle = { enabled = false },
|
||||
mccabe = { enabled = false },
|
||||
rope_autoimport = { enabled = true },
|
||||
rope_completion = {
|
||||
enabled = true,
|
||||
eager = true,
|
||||
},
|
||||
pycodestyle = {
|
||||
maxLineLength = nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, ]]
|
||||
jinja_lsp = {
|
||||
filetypes = { "html", "htmldjango", "templ" },
|
||||
},
|
||||
html = {
|
||||
filetypes = {
|
||||
"html",
|
||||
"htmldjango",
|
||||
"templ",
|
||||
},
|
||||
init_options = {
|
||||
provideFormatter = false,
|
||||
},
|
||||
},
|
||||
tinymist = {
|
||||
offset_encoding = "utf-8",
|
||||
settings = {
|
||||
exportPdf = "onType",
|
||||
outputPath = "$root/target/$dir/$name",
|
||||
},
|
||||
},
|
||||
ts_ls = {},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user