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

Incorrect tokenization of compact Ruby class names #1469

Closed
ashmaroli opened this issue Mar 27, 2020 · 1 comment · Fixed by #1470
Closed

Incorrect tokenization of compact Ruby class names #1469

ashmaroli opened this issue Mar 27, 2020 · 1 comment · Fixed by #1470
Labels
bugfix-request A request for a bugfix to be developed.

Comments

@ashmaroli
Copy link
Contributor

Name of the lexer

Rouge::Lexers::Ruby

Code sample

A sample of the code that produces the bug.

# Compact class name
class Rouge::Lexers::Ruby < RegexLexer
  def self.detect?(text)
    return true if text.shebang? 'ruby'
  end
end

# Nested class name
module Rouge
  module Lexers
    class Ruby < RegexLexer
      def self.detect?(text)
        return true if text.shebang? 'ruby'
      end
    end
  end
end

Sample screenshot

Screenshot_2020-03-27 ruby Visual Test

The class name Ruby has a different color in the two scenarios

@ashmaroli ashmaroli added the bugfix-request A request for a bugfix to be developed. label Mar 27, 2020
@jneen
Copy link
Member

jneen commented Mar 27, 2020

Would you be willing to make a branch with this added to the sample file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix-request A request for a bugfix to be developed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants