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

Inconsitent highlighting between instances #6264

Open
jakenvac opened this issue Mar 7, 2024 · 0 comments
Open

Inconsitent highlighting between instances #6264

jakenvac opened this issue Mar 7, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jakenvac
Copy link

jakenvac commented Mar 7, 2024

Describe the bug

Hi, I'm experiencing a strange issue where every now and then after launching nvim, tree sitter seems to highlight the file incorrectly.

It's really intermittent so I can't tell if it's specific to typescript as show in the screenshot below.

The top half of the image is an nvim instance with a 'broken' tree sitter, and the bottom half is working as expected. These are two independent nvim instances each in a pane in a terminal.

Please ignore the darkened background/colors in the bottom half, that's just because it's not focused in the terminal.

image

Here's both instances with TreeSitter disabled, for good measure:
image

I don't have any custom highlight groups configured and I have LSP Semantic highlighting disabled so I don't think either of those are the culprit.

I'm not using an nvim 'distro' of any kind. Just a vanilla install with some keymaps/plugins configured.

To Reproduce

Unfortunately it's intermittent, but what I did to get the screenshot:

Open a typescript file, on the first try, TS was working fine.

In the second instance I just kept opening and closing the file until TS wasn't working correctly.

Expected behavior

TS should consistently highlight the same file the same way.

Output of :checkhealth nvim-treesitter

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- OK `tree-sitter` found 0.21.0 (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v20.10.0 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: Apple clang version 15.0.0 (clang-1500.1.0.2.4)
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "arm64",
  release = "23.1.0",
  sysname = "Darwin",
  version = "Darwin Kernel Version 23.1.0: Mon Oct  9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - cpp                 ✓ ✓ ✓ ✓ ✓
  - dart                ✓ ✓ ✓ ✓ ✓
  - devicetree          ✓ ✓ ✓ ✓ ✓
  - gleam               ✓ ✓ ✓ ✓ ✓
  - go                  ✓ ✓ ✓ ✓ ✓
  - graphql             ✓ . . ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - json                ✓ ✓ ✓ ✓ .
  - lua                 ✓ ✓ ✓ ✓ ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - ruby                ✓ ✓ ✓ ✓ ✓
  - rust                ✓ ✓ ✓ ✓ ✓
  - swift               ✓ ✓ . x .
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - zig                 ✓ ✓ ✓ ✓ ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

The following errors have been detected: ~
- ERROR swift(indents): ...-3e569d4/share/nvim/runtime/lua/vim/treesitter/query.lua:279: Query error at 35:4. Invalid node type "willset_didset_block":
    (willset_didset_block)
     ^
  
  swift(indents) is concatenated from the following files:
  | [ERROR]:"/Users/jake/.local/share/nvim/lazy/nvim-treesitter/queries/swift/indents.scm", failed to load: ...-3e569d4/share/nvim/runtime/lua/vim/treesitter/query.lua:279: Query error at 35:4. Invalid node type "willset_didset_block":
    (willset_didset_block)
     ^

Output of nvim --version

NVIM v0.10.0-dev-2529+g3e569d440-Homebrew
Build type: Release
LuaJIT 2.1.1703358377
Run "nvim -V1 -v" for more info

(I have also tried on the latest stable release and the same happens)

Additional context

Sorry for the waffle. I'm not sure how I can debug further but I'm keen to learn if anyone has any ideas.

@jakenvac jakenvac added the bug Something isn't working label Mar 7, 2024
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

1 participant