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

Crystal regex syntax highlighing breaks when #{var} is used #3527

Open
OpenSauce04 opened this issue Nov 1, 2024 · 1 comment
Open

Crystal regex syntax highlighing breaks when #{var} is used #3527

OpenSauce04 opened this issue Nov 1, 2024 · 1 comment

Comments

@OpenSauce04
Copy link

OpenSauce04 commented Nov 1, 2024

Description of the problem or steps to reproduce

While writing Crystal code, attempting to use #{var} to insert a value into a regex expression causes the syntax highlighting to treat the rest of the line as a comment.
This notably doesn't occur when the same thing is done in a string.
image

Specifications

Commit hash: Micro 2.0.13 from the official Gentoo repositories. (-version displays no hash)
OS: Gentoo Linux
Terminal: Wezterm

@Andriamanitra
Copy link
Contributor

This is a pretty tricky issue to solve (maybe even impossible given the limitations of micro's syntax highlighting system).

Here the #{hello}/ is a comment:

p!(1/#{hello}/
2)  # prints "1 / 2 # => 0.5"

but here the exact same string is interpolating a value inside a regex:

hello = 42
p!(/#{hello}/
)  # prints "/#{hello}/ # => /42/"

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

No branches or pull requests

2 participants