RRethy / vim-illuminate

illuminate.vim - (Neo)Vim plugin for automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
2.12k stars 44 forks source link

It doesn't work on .svelte files without regex provider #158

Closed mauroporras closed 1 year ago

mauroporras commented 1 year ago

Describe the bug I disabled the regex provider and it keeps working on plain JS and TS files but it doesn't work on .svelte files.

To Reproduce

  1. Put this code in a .svelte file:

    <script lang="ts">
    const sayHi = (name: string) => {
    return `What's up ${name}`
    }
    
    console.log(sayHi('dog'))
    </script>
  2. Put your cursor over the first sayHi.
  3. The other sayHi doesn't get highlighted.

My lua file:

return require('packer').startup(function(use)
  use {
    'RRethy/vim-illuminate',
    config = function()
      require('illuminate').configure({
        providers = {
          'lsp',
          'treesitter',
        },
        delay = 200,
      })
    end
  }
end)

Output from :IlluminateDebug

buf_should_illuminate 24 true
config {
  delay = 200,
  filetype_overrides = {},
  filetypes_allowlist = {},
  filetypes_denylist = { "dirbuf", "dirvish", "fugitive" },
  min_count_to_highlight = 1,
  modes_allowlist = {},
  modes_denylist = {},
  providers = { "lsp", "treesitter" },
  providers_regex_syntax_allowlist = {},
  providers_regex_syntax_denylist = {},
  under_cursor = true
}
started true
provider nil
`termguicolors` true

Screenshots

Screenshot 2023-01-31 at 11 34 47

Thank you.

RRethy commented 1 year ago

Svelte doesn't support the locals query for tree-sitter, https://github.com/Himujjal/tree-sitter-svelte/blob/master/queries/locals.scm, and I'm assuming the lsp doesn't support it either (or maybe there isn't even a svelte lsp). The only option would be to turn the regex provider back on for svelte.