You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Unstable/Incorrect syntax highlighting with tree sitter when editing blocks passed to methods called with unparenthesized string parameters #256
When using syntax highlighting with Tree Sitter enabled, I am experiencing incorrect and unstable syntax highlighting when adding text to certain Rspec files.
It's hard for me to nail down the exact cause of the issue because even slight, seemingly irrelevant changes can cause it to disappear, but it seems to be related to having quotes inside of blocks passed to methods called with unparenthesized string parameters.
Steps to Reproduce
Create a file, test.rb with the following contents:
Rspec.describe"text"do# Comment# "a /b/end
Run Atom: atom --clear-window-state --safe .
Open test.rb in Atom
Move the text cursor to the end of line 2, after "# Comment"
Start typing additional characters
Expected behavior: Syntax highlighting should not change
Actual behavior: Syntax highlighting alters between the correct behavior, and treating the entire file after the first line as a string with each additional character you type.
Removing the quote in comment on the third line causes the problem to no longer occur, even if you later replace the quote
Removing either of the forward slashes in the comment on the third line causes the problem to only occur once (when you type the first character on the second line), then disappear until you close and reopen the file
Removing a in the comment on the third line causes the problem to only occur once (when you type the first character on the second line), then disappear until you close and reopen the file
Removing Rspec. on the first line causes the problem to no longer occur until you put it back
Adding parenthesis around the "text" parameter on the first line causes the problem to no longer occur until you put it back
Adding parameters to the block does not affect the behavior
Adding additional parameters to the Rspec.describe call does not affect the behavior
Replacing do ... end with bracket-style syntax does not affect the behavior
Replacing the block with a lambda expression does not affect the behavior
Moving the block to a different method call on the second line causes the problem to no longer occur until you put it back
changed the title [-]Unstable/Incorrect syntax highlighting with tree sitter when blocks with unparenthesized string parameters[/-][+]Unstable/Incorrect syntax highlighting with tree sitter when editing blocks passed to methods called with unparenthesized string parameters[/+]on Nov 27, 2018
I have been experiencing the same behavior with Ruby and JavaScript with the new tree parser and it was resolved by disabling the new parser. I was told to wait until the newest update, but I'm still experiencing the same issues with 1.32.2. After the update happened, I re-enabled it and am still experiencing the issue, albeit less frequently. The block will typically self-correct if you modify something small in the mishighlighted syntax. It seems to happen most frequently when working with strings and comments, and it is maddening.
I'm seeing something similar, but have been able to pinpoint it outside of a block declaration, so I thought I'd provide extra data. Just create a ruby file with:
then open and go at the bottom of the file, type multiple spaces.
One space will give incorrect highlighting, then another will give correct highlighting, then another will remain correct, then it will cycle (sorry I cannot generate a GIF right now).
I can't reproduce either of these problems on the latest nightly. Is anyone still seeing this? It may have been fixed by some upgrade of either tree-sitter or tree-sitter-ruby.
Activity
[-]Unstable/Incorrect syntax highlighting with tree sitter when blocks with unparenthesized string parameters[/-][+]Unstable/Incorrect syntax highlighting with tree sitter when editing blocks passed to methods called with unparenthesized string parameters[/+]allisonphillips commentedon Nov 29, 2018
I have been experiencing the same behavior with Ruby and JavaScript with the new tree parser and it was resolved by disabling the new parser. I was told to wait until the newest update, but I'm still experiencing the same issues with 1.32.2. After the update happened, I re-enabled it and am still experiencing the issue, albeit less frequently. The block will typically self-correct if you modify something small in the mishighlighted syntax. It seems to happen most frequently when working with strings and comments, and it is maddening.
rsese commentedon Nov 30, 2018
Thanks for the report - I can reproduce on macOS 10.12.6 with 1.35.0-nightly1:
thbar commentedon Dec 7, 2018
I'm seeing something similar, but have been able to pinpoint it outside of a block declaration, so I thought I'd provide extra data. Just create a ruby file with:
then open and go at the bottom of the file, type multiple spaces.
One space will give incorrect highlighting, then another will give correct highlighting, then another will remain correct, then it will cycle (sorry I cannot generate a GIF right now).
niborg commentedon Jan 16, 2019
Is there a fix in the works for this? Or a cause identified so others might make the fix? Although seemingly minor, it is disruptive.
Ajedi32 commentedon Jan 16, 2019
@niborg If it bothers you, a good temporary work-around is to just disable tree sitter in settings.
maxbrunsfeld commentedon Nov 4, 2019
I can't reproduce either of these problems on the latest nightly. Is anyone still seeing this? It may have been fixed by some upgrade of either
tree-sitterortree-sitter-ruby.