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

Improve highlighting of bare and raw strings, and add missing unit & operators #199

Merged
merged 2 commits into from
Mar 24, 2025

Conversation

LemmusLemmus
Copy link
Contributor

@LemmusLemmus LemmusLemmus commented Mar 24, 2025

  • Added µs as a valid unit.
  • Added the new operators like and not-like.
  • Disallowed semicolon in bare strings (this should also fix Syntax highlighting breaks for defs with multiple commands separated by ; (semicolon) #190)
  • Allowed # in bare strings (except for the first character, since then it is a comment and not a bare string).
  • Prioritized raw string highlighting over commands and bare strings (in e.g. r'#str#', r should not be highlighted as a command).

Sidenotes

  • Technically, commas should also be allowed in bare strings. However, commas can only be in some bare strings, since if the bare string is inside a list, then commas should not be recognized as part of the bare string: [bare,strings]. Hence, I have left commas disallowed as they were before.
  • The new operators like and not-like are missing from the Nushelll operators documentation currently...
  • Regarding a better regex for comments, I realized that the rules for when a comment is allowed without white-space in behind it is quite convoluted, so I have left it untouched.

@fdncred fdncred merged commit 28ccc90 into nushell:main Mar 24, 2025
1 check passed
@fdncred
Copy link
Contributor

fdncred commented Mar 24, 2025

Thanks

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.

Syntax highlighting breaks for defs with multiple commands separated by ; (semicolon)
2 participants