Skip to content

[Ruby]: overriding != method breaks syntax highlighting #7776

@ivansvlv

Description

@ivansvlv

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

I'm not sure this is a right place to report this bug since I guess it's a tree-sitter bug, but it's still concerns language support in Zed.

I believe this is a related issue: tree-sitter/tree-sitter-ruby#174

Code (It's funny but it breaks GitHub syntax highlighting as well):

class BugReport
  def ==(other)
    puts "overridden '=='"
    other == "test"
  end

  def !=(other)
    puts "overridden '!='"
    other != "test"
  end
end

t = BugReport.new
puts t == 'test'
puts t != 'test'

Code works and returns:

overridden '=='
true
overridden '!='
false

You can see here that end keyword that closes class is not highlighted. Which makes the previous end keyword to be matched by both class and method def when clicking on them.

CleanShot 2024-02-14 at 17 05 53

Environment

Zed: v0.121.7 (Zed)
OS: macOS 14.3.1
Memory: 64 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:languagesAn umbrella label for all programming languages syntax behaviorsarea:languages/rubyRuby programming language supportbugDEPRECATED label: use issue type 'Bug' instead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions