uyha / tree-sitter-cmake

A Tree-sitter parser for CMake
MIT License
41 stars 9 forks source link

Inconsistent behaviour in highlights #2

Closed ravisumit33 closed 2 years ago

ravisumit33 commented 2 years ago

I am facing inconsistent behaviour in cmake highlights when using tree-sitter. Colors of options seem turning on/off when I scroll and sometimes I endup like below:

Screenshot 2021-09-19 at 9 34 07 PM

You can see clearly one option is highlighted while other one is not. Is it a known issue ?

uyha commented 2 years ago

I think this is a bug of my highlights query in nvim-treesitter, I'll try to fix it today

uyha commented 2 years ago

I also see the color turning on/off and I think that's a bug with nvim-treesitter, but i didn't spend time to investigate it

ravisumit33 commented 2 years ago

I use nvim-treesitter for different languages like C/C++, python, javascript etc. but didn't find color turning on/off in them. Its only coming in cmake files.

uyha commented 2 years ago

do you have some small example i can you to test?

ravisumit33 commented 2 years ago
project (sample)
cmake_minimum_required(VERSION 3.20)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
add_executable(sample sample.cpp)
target_compile_options(sample
PUBLIC
  -v)
ravisumit33 commented 2 years ago

Color of PUBLIC changes everytime when I click on it or scroll.

uyha commented 2 years ago

that's weird because my parser doesn't do anything special about the command target_compile_options and neither does my highlights query. Anyway, i'll check it out.

ravisumit33 commented 2 years ago

@uyha Any update on this?

uyha commented 2 years ago

I'm holidays now so I won't have a look at this until the weekends. I will start diving in after my holidays

uyha commented 2 years ago

This may not be the problem with the parser, but a problem with nvim-treesitter, it has been reported here nvim-treesitter/nvim-treesitter#1923

uyha commented 2 years ago

should be fixed when using nightly nvim