diff options
| author | Christian Chiarulli <[email protected]> | 2022-09-19 13:12:52 -0400 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2022-09-19 13:12:52 -0400 | 
| commit | 352147158bb696e4b8fcb236d2cb477955b26dcf (patch) | |
| tree | cf787c1d9ada73fe047368addccc493d9cf2cde5 /lua/lvim | |
| parent | d44da34e92f92bbe59d2fca5965aa9c35c64374c (diff) | |
feat(document highlight): use illuminate rather than autocommand to avoid flashing (#3029)
Diffstat (limited to 'lua/lvim')
| -rw-r--r-- | lua/lvim/core/builtins/init.lua | 1 | ||||
| -rw-r--r-- | lua/lvim/core/illuminate.lua | 53 | ||||
| -rw-r--r-- | lua/lvim/lsp/handlers.lua | 1 | ||||
| -rw-r--r-- | lua/lvim/plugins.lua | 4 | 
4 files changed, 58 insertions, 1 deletions
| diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 03ee8aec..afb19b63 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -10,6 +10,7 @@ local builtins = {    "lvim.core.treesitter",    "lvim.core.nvimtree",    "lvim.core.lir", +  "lvim.core.illuminate",    "lvim.core.project",    "lvim.core.bufferline",    "lvim.core.autopairs", diff --git a/lua/lvim/core/illuminate.lua b/lua/lvim/core/illuminate.lua new file mode 100644 index 00000000..e29b091a --- /dev/null +++ b/lua/lvim/core/illuminate.lua @@ -0,0 +1,53 @@ +local M = {} + +M.config = function() +  local status_ok, illuminate = pcall(require, "illuminate") +  if not status_ok then +    return +  end +  -- default configuration +  illuminate.configure { +    -- providers: provider used to get references in the buffer, ordered by priority +    providers = { +      "lsp", +      "treesitter", +      "regex", +    }, +    -- delay: delay in milliseconds +    delay = 120, +    -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist +    filetypes_denylist = { +      "dirvish", +      "fugitive", +      "alpha", +      "NvimTree", +      "packer", +      "neogitstatus", +      "Trouble", +      "lir", +      "Outline", +      "spectre_panel", +      "toggleterm", +      "DressingSelect", +      "TelescopePrompt", +    }, +    -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist +    filetypes_allowlist = {}, +    -- modes_denylist: modes to not illuminate, this overrides modes_allowlist +    modes_denylist = {}, +    -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist +    modes_allowlist = {}, +    -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist +    -- Only applies to the 'regex' provider +    -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') +    providers_regex_syntax_denylist = {}, +    -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist +    -- Only applies to the 'regex' provider +    -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') +    providers_regex_syntax_allowlist = {}, +    -- under_cursor: whether or not to illuminate under the cursor +    under_cursor = true, +  } +end + +return M diff --git a/lua/lvim/lsp/handlers.lua b/lua/lvim/lsp/handlers.lua index 84f2ba5f..45b1989d 100644 --- a/lua/lvim/lsp/handlers.lua +++ b/lua/lvim/lsp/handlers.lua @@ -12,7 +12,6 @@ function M.setup()      float = lvim.lsp.diagnostics.float,    }    vim.diagnostic.config(config) -  vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lvim.lsp.float)    vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lvim.lsp.float)  end diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index a483dbc0..bd8f787d 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -256,6 +256,10 @@ local core_plugins = {    {      "b0o/schemastore.nvim",    }, + +  { +    "RRethy/vim-illuminate", +  },  }  local default_snapshot_path = join_paths(get_lvim_base_dir(), "snapshots", "default.json") | 
