Skip to content

Commit 6dad31f

Browse files
ayamirJint-lzxycharliie-dev
authored
feat: support for neovim 0.11 stable.
* feat(options): make omnifunc support fuzzy matching (#1441) Signed-off-by: Jint-lzxy <[email protected]> * feat(treesitter): remove performance limitations (#1442) This commit removes all previous performance restrictions as treesitter now supports full asynchronous parsing. Signed-off-by: Jint-lzxy <[email protected]> * fix(lualine): resolve background color defaulting issue (#1443) This commit addresses the root cause of #1381 by allowing lualine to automatically select the default background color. Previously, lualine attempted to retrieve the background manually, which could lead to issues when querying in a different namespace (and resulting in an empty dictionary). Signed-off-by: Jint-lzxy <[email protected]> * fix(keymap): prevent new builtins from interfering with our keymap (#1444) This commit prevents lag when using `gr` by avoiding conflicts with new keymaps Neovim defines with this prefix. Signed-off-by: Jint-lzxy <[email protected]> * feat: support virtual_line and adapt to the latest diagnostics interface. (#1447) * feat: add setting entry for virtual lines. * fix: hide or show virtual text and lines instead of diagnostics itself. * fix: correct comment. * fix: restore comment note. * fix: toggle inlay hints correctly. (#1449) * fix: toggle inlay hints correctly. Previous impl won't work when toggle for the first time. * fix: toggle for all buffers. * fix: replace project.nvim with newest apis. (#1450) * feat: add garbage-dev to save memory for inactive lsp. * fix: remove underline for diagnostics. * Revert "feat: add garbage-dev to save memory for inactive lsp." This reverts commit 0ccac94. * Revert "fix: remove underline for diagnostics." This reverts commit bb1d274. * feat: use tiny inline diagnostics to manage virtual text. (#1452) * feat: add tiny inline diagnostic. * refactor: disable virtual text by default. --------- Signed-off-by: Charles Chiu <[email protected]> Co-authored-by: Charles Chiu <[email protected]> --------- Signed-off-by: Jint-lzxy <[email protected]> Signed-off-by: Charles Chiu <[email protected]> Co-authored-by: jint_lzxy_ <[email protected]> Co-authored-by: Charles Chiu <[email protected]>
1 parent 5a8bb64 commit 6dad31f

File tree

13 files changed

+49
-38
lines changed

13 files changed

+49
-38
lines changed

lua/core/options.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ local function load_options()
1818
cmdheight = 1, -- 0, 1, 2
1919
cmdwinheight = 5,
2020
complete = ".,w,b,k,kspell",
21-
completeopt = "menuone,noselect,popup",
21+
completeopt = "fuzzy,menuone,noselect,popup",
2222
concealcursor = "niv",
2323
conceallevel = 0,
2424
cursorcolumn = true,

lua/core/settings.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ settings["server_formatting_block_list"] = {
5555
---@type boolean
5656
settings["lsp_inlayhints"] = true
5757

58-
-- Set it to false if diagnostics virtual text is annoying.
59-
-- If disabled, you may browse lsp diagnostics using trouble.nvim (press `gt` to toggle it).
58+
-- Set it to false if diagnostics virtual lines is annoying.
6059
---@type boolean
61-
settings["diagnostics_virtual_text"] = true
60+
settings["diagnostics_virtual_lines"] = false
6261

6362
-- Set it to one of the values below if you want to change the visible severity level of lsp diagnostics.
6463
-- Priority: `Error` > `Warning` > `Information` > `Hint`.

lua/keymap/completion.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ function M.lsp(buf)
4242
["n|gs"] = map_callback(function()
4343
vim.lsp.buf.signature_help()
4444
end):with_desc("lsp: Signature help"),
45-
["n|gr"] = map_cr("Lspsaga rename"):with_silent():with_buffer(buf):with_desc("lsp: Rename in file range"),
45+
["n|gr"] = map_cr("Lspsaga rename")
46+
:with_silent()
47+
:with_nowait()
48+
:with_buffer(buf)
49+
:with_desc("lsp: Rename in file range"),
4650
["n|gR"] = map_cr("Lspsaga rename ++project")
4751
:with_silent()
4852
:with_buffer(buf)
@@ -72,13 +76,13 @@ function M.lsp(buf)
7276
end)
7377
:with_noremap()
7478
:with_silent()
75-
:with_desc("lsp: Toggle virtual text display of current buffer"),
79+
:with_desc("lsp: Toggle virtual text display"),
7680
["n|<leader>lh"] = map_callback(function()
7781
_toggle_inlayhint()
7882
end)
7983
:with_noremap()
8084
:with_silent()
81-
:with_desc("lsp: Toggle inlay hints dispaly of current buffer"),
85+
:with_desc("lsp: Toggle inlay hints display"),
8286
}
8387
bind.nvim_load_mapping(map)
8488

lua/keymap/helpers.lua

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ _G._telescope_collections = function(picker_type)
4545
end
4646

4747
_G._toggle_inlayhint = function()
48-
local is_enabled = vim.lsp.inlay_hint.is_enabled()
49-
48+
local is_enabled = vim.lsp.inlay_hint.is_enabled({ bufnr = 0 })
5049
vim.lsp.inlay_hint.enable(not is_enabled)
5150
vim.notify(
5251
(is_enabled and "Inlay hint disabled successfully" or "Inlay hint enabled successfully"),
@@ -55,13 +54,13 @@ _G._toggle_inlayhint = function()
5554
)
5655
end
5756

58-
local _vt_enabled = require("core.settings").diagnostics_virtual_text
5957
_G._toggle_virtualtext = function()
60-
if vim.diagnostic.is_enabled() then
61-
_vt_enabled = not _vt_enabled
62-
vim.diagnostic[_vt_enabled and "show" or "hide"]()
58+
local _vl_enabled = require("core.settings").diagnostics_virtual_lines
59+
if _vl_enabled then
60+
local vl_config = not vim.diagnostic.config().virtual_lines
61+
vim.diagnostic.config({ virtual_lines = vl_config })
6362
vim.notify(
64-
(_vt_enabled and "Virtual text is now displayed" or "Virtual text is now hidden"),
63+
(vl_config and "Virtual lines is now displayed" or "Virtual lines is now hidden"),
6564
vim.log.levels.INFO,
6665
{ title = "LSP Diagnostic" }
6766
)

lua/modules/configs/completion/cmp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ return function()
188188
name = "buffer",
189189
option = {
190190
get_bufnrs = function()
191-
return vim.api.nvim_buf_line_count(0) < 7500 and vim.api.nvim_list_bufs() or {}
191+
return vim.api.nvim_buf_line_count(0) < 15000 and vim.api.nvim_list_bufs() or {}
192192
end,
193193
},
194194
},

lua/modules/configs/completion/mason-lspconfig.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
local M = {}
22

33
M.setup = function()
4-
local diagnostics_virtual_text = require("core.settings").diagnostics_virtual_text
4+
local diagnostics_virtual_lines = require("core.settings").diagnostics_virtual_lines
55
local diagnostics_level = require("core.settings").diagnostics_level
66

77
local nvim_lsp = require("lspconfig")
@@ -12,10 +12,11 @@ M.setup = function()
1212
ensure_installed = require("core.settings").lsp_deps,
1313
})
1414

15-
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
15+
vim.diagnostic.config({
1616
signs = true,
17-
underline = true,
18-
virtual_text = diagnostics_virtual_text and {
17+
underline = false,
18+
virtual_text = false,
19+
virtual_lines = diagnostics_virtual_lines and {
1920
severity = {
2021
min = vim.diagnostic.severity[diagnostics_level],
2122
},
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
return function()
2+
require("modules.utils").load_plugin("tiny-inline-diagnostic", {
3+
preset = "modern",
4+
options = {
5+
show_source = {
6+
enabled = true,
7+
if_many = true,
8+
},
9+
use_icons_from_diagnostic = true,
10+
break_line = {
11+
enabled = true,
12+
},
13+
},
14+
})
15+
end

lua/modules/configs/editor/rainbow_delims.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ return function()
44
return function()
55
-- Disable on very large files
66
local line_count = vim.api.nvim_buf_line_count(0)
7-
if line_count > 7500 then
7+
if line_count > 15000 then
88
return nil
99
end
1010

lua/modules/configs/editor/treesitter.lua

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,8 @@ return vim.schedule_wrap(function()
88
ensure_installed = require("core.settings").treesitter_deps,
99
highlight = {
1010
enable = true,
11-
disable = function(ft, bufnr)
12-
if
13-
vim.tbl_contains({ "gitcommit" }, ft)
14-
or (vim.api.nvim_buf_line_count(bufnr) > 7500 and ft ~= "vimdoc")
15-
then
16-
return true
17-
end
18-
19-
local ok, is_large_file = pcall(vim.api.nvim_buf_get_var, bufnr, "bigfile_disable_treesitter")
20-
return ok and is_large_file
11+
disable = function(ft)
12+
return vim.tbl_contains({ "gitcommit" }, ft)
2113
end,
2214
additional_vim_regex_highlighting = false,
2315
},

lua/modules/configs/ui/lualine.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,10 @@ return function()
9898
if has_catppuccin then
9999
return function()
100100
local guifg = colors[fg]
101-
local guibg = gen_bg and require("modules.utils").hl_to_rgb("StatusLine", true, colors.mantle)
102-
or colors[bg]
103101
local nobg = special_nobg and require("core.settings").transparent_background
104102
return {
105103
fg = guifg and guifg or colors.none,
106-
bg = (guibg and not nobg) and guibg or colors.none,
104+
bg = nobg and colors.none or ((not gen_bg and colors[bg]) or nil),
107105
gui = gui and gui or nil,
108106
}
109107
end

0 commit comments

Comments
 (0)