update
This commit is contained in:
1 parent
b56cd1b897
commit
54bafa94a7
8 files changed
+179
-14
No files matched your search
@@ -0,0 +1,32 @@
|
||||
vim.pack.add({
|
||||
{ src = "https://github.com/RRethy/vim-illuminate" },
|
||||
})
|
||||
|
||||
require("illuminate").configure({
|
||||
-- Providers in order of preference; treesitter provider needs the old
|
||||
-- nvim-treesitter API (nvim-treesitter.locals), so leave it out
|
||||
providers = { "lsp", "regex" },
|
||||
under_cursor = false,
|
||||
delay = 100,
|
||||
})
|
||||
|
||||
-- The engine picks the first *ready* provider and never falls back per query,
|
||||
-- so with an LSP attached the regex provider never runs. LSP documentHighlight
|
||||
-- is semantic-only: words inside strings and non-symbol identifiers (e.g. the
|
||||
-- `world` in "Hello, world!" or a package name) get an empty result. Patch the
|
||||
-- LSP provider to fall back to regex matching when the server returns nothing.
|
||||
local lsp = require("illuminate.providers.lsp")
|
||||
local regex = require("illuminate.providers.regex")
|
||||
local lsp_get_references = lsp.get_references
|
||||
lsp.get_references = function(bufnr, cursor)
|
||||
local refs = lsp_get_references(bufnr)
|
||||
if refs and #refs == 0 then
|
||||
return regex.get_references(bufnr, cursor)
|
||||
end
|
||||
return refs
|
||||
end
|
||||
|
||||
-- Default plugin keymaps (set unless already taken):
|
||||
-- <A-n> next reference
|
||||
-- <A-p> previous reference
|
||||
-- <A-i> select reference (text object, operator/visual pending)
|
||||
Reference in new issue
Block a user