Skip to content

Fix ConsoleLexer ignoring comments=false option#2201

Open
0xdf223 wants to merge 1 commit intorouge-ruby:masterfrom
0xdf223:fix/console-lexer-comments-guard
Open

Fix ConsoleLexer ignoring comments=false option#2201
0xdf223 wants to merge 1 commit intorouge-ruby:masterfrom
0xdf223:fix/console-lexer-comments-guard

Conversation

@0xdf223
Copy link

@0xdf223 0xdf223 commented Feb 1, 2026

Summary

  • Guard the comment_regex check in process_line with allow_comments? so that comments=false actually prevents lines starting with # from being lexed as comments
  • Add a test verifying that comments=false with a custom prompt treats #-prefixed lines as output

Fixes #2200

Test plan

  • Existing console_spec.rb tests pass
  • New test confirms ##MS_PolicyEventProcessingLogin## is lexed as Generic.Output (not Comment) when comments=false

Guard the comment_regex check in process_line with allow_comments? so
that setting comments=false actually prevents lines starting with #
from being lexed as comments.
@jneen
Copy link
Member

jneen commented Feb 3, 2026

Good catch, thank you!

@jneen jneen self-requested a review February 4, 2026 01:10
@jneen
Copy link
Member

jneen commented Feb 4, 2026

image

Looking at the console lexer again and we may have some regressions too ><

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ConsoleLexer: comment_regex check not guarded by allow_comments?

2 participants