Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight definitions taking ~6seconds (JavaScript and TypeScript) #435

Closed
bfulop opened this issue Sep 11, 2020 · 4 comments
Closed

Highlight definitions taking ~6seconds (JavaScript and TypeScript) #435

bfulop opened this issue Sep 11, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@bfulop
Copy link

bfulop commented Sep 11, 2020

Describe the bug
Hello,

When I move my cursor over a variable, it takes about 6 seconds for the highlighting to show (highlight) the other references of that variable.
On the other hand, highlight_current_scope is instantaneous.

To Reproduce
Steps to reproduce the behavior:
I have a pretty minimal init.vim right now, I removed coc.vim, no lsp plugin and even did :syntax off.
I only have the JavaScript and TypeScript languages installed for treesitter.

Expected behavior
I would expect the highlighting of other references under the cursor to be instantaneous.

Output of :checkhealth nvim_treesitter

health#nvim_treesitter#check

Installation

  • OK: git executable found.
  • OK: cc executable found.

typescript parser healthcheck

  • OK: typescript parser found.
  • OK: highlights.scm found.
  • OK: locals.scm found.
  • OK: textobjects.scm found.
  • OK: fold.scm found.

javascript parser healthcheck

  • OK: javascript parser found.
  • OK: highlights.scm found.
  • OK: locals.scm found.
  • OK: textobjects.scm found.
  • OK: fold.scm found.

Output of nvim --version

NVIM v0.5.0-59712f6db
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20200909-77299-1roygjj/build/config -I/tmp/neovim-20200909-77299-1roygjj/src -I/usr/local/include -I/tmp/neovim-20200909-77299-1roygjj/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20200909-77299-1roygjj/build/src/nvim/auto -I/tmp/neovim-20200909-77299-1roygjj/build/include
Compiled by balintfulop@Balints-MacBook-Pro.local

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-59712f6/share/nvim"

Additional context
Everything else seems to work correctly! ❤️ 👍

Maybe related to #151 ? (It does not block cursor movement for me though)

Update

My init.vim config for treesitter:

lua <<EOF
require'nvim-treesitter.configs'.setup {
  ensure_insalled = "all",
  highlight = {
    enable = true
  },
  incremental_selection = {
    enable = true,
    keymaps = {
      init_selection = "gnn",
      node_incremental = "grn",
      scope_incremental = "grc",
      node_decremental = "grm",
    },
  },
  refactor = {
    highlight_definitions = { enable = true },
    highlight_current_scope = { enable = false },
    smart_rename = {
      enable = true,
      keymaps = {
        smart_rename = "grr",
      },
    },
    navigation = {
      enable = true,
      keymaps = {
        goto_definition = "gnd",
        list_definitions = "gnD",
        goto_next_usage = "<a-*>",
        goto_previous_usage = "<a-#>",
      },
    },
  },
  textobjects = {
    select = {
      enable = true,
      keymaps = {
        -- You can use the capture groups defined in textobjects.scm
        ["af"] = "@function.outer",
        ["if"] = "@function.inner",
        ["ac"] = "@class.outer",
        ["ic"] = "@class.inner",
      },
    },
    swap = {
      enable = true,
      swap_next = {
        ["<leader>a"] = "@parameter.inner",
      },
      swap_previous = {
        ["<leader>A"] = "@parameter.inner",
      },
    },
    move = {
      enable = true,
      goto_next_start = {
        ["]m"] = "@function.outer",
        ["]]"] = "@class.outer",
      },
      goto_next_end = {
        ["]M"] = "@function.outer",
        ["]["] = "@class.outer",
      },
      goto_previous_start = {
        ["[m"] = "@function.outer",
        ["[["] = "@class.outer",
      },
      goto_previous_end = {
        ["[M"] = "@function.outer",
        ["[]"] = "@class.outer",
      },
    },
  },
}
EOF

@bfulop bfulop added the bug Something isn't working label Sep 11, 2020
@vigoux
Copy link
Member

vigoux commented Sep 11, 2020

Hi !

Can you paste the output of set updatetime? here too ? because this feature is relying on the updatetime.

@bfulop
Copy link
Author

bfulop commented Sep 11, 2020

Ah, that could be it?

it's: updatetime=4000

@bfulop
Copy link
Author

bfulop commented Sep 11, 2020

indeed it looks like it is! 🎉
I've set it to updatetime=300 and now it's working as expected!

Thanks Thomas for the quick help!! 👏

@bfulop bfulop closed this as completed Sep 11, 2020
@vigoux
Copy link
Member

vigoux commented Sep 11, 2020

Thanks for reaching out !
And thank you to use this plugin !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants