Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
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

@Ajedi32

Description

@Ajedi32

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

  1. Create a file, test.rb with the following contents:
Rspec.describe "text" do
  # Comment
  # "a /b/
end
  1. Run Atom: atom --clear-window-state --safe .
  2. Open test.rb in Atom
  3. Move the text cursor to the end of line 2, after "# Comment"
  4. 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.

Edit by @rsese to add GIF

ruby-tree-sitter

Reproduces how often: Always.

Versions

OS: Windows 10
Atom: 1.32.2
Electron: 2.0.9
Chrome: 61.0.3163.100
Node: 8.9.3 x64
apm: 2.1.2
npm: 6.2.0
git: 2.9.0.windows.1
visual studio
language-ruby: 0.72.14

Additional Information

  • 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions