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

Syntax Highlighting regex+format strings (rf) #256

Open
brownjoel opened this issue Feb 27, 2023 · 0 comments
Open

Syntax Highlighting regex+format strings (rf) #256

brownjoel opened this issue Feb 27, 2023 · 0 comments

Comments

@brownjoel
Copy link

  • Editor name and version: VSCode 1.75.1
  • Platform: macOS
  • Color scheme: Dark+ (default)
  • MagicPython version: 1.1.0
  • A sreenshot:
    image
  • 5-10 lines of surrounding code:
myString = "baz"
MYCONST = "qux"
myDict = {
    "foo": "bar"
}

correctColoring = rf"(?=[\w]+){myString}{MYCONST}[\d]+"

incorrectDictionary = rf"(?=[\w]+){myDict['foo']}[\d]+"
regularFString = f"word{myDict['foo']}number"

This is a followup to #186. After upgrading to 1.1.0, I'm very excited that rf strings support both regex style and format string. In the attached screenshot, behold how correctly varied correctColoring is. However, any dictionary or class inside of the {} in an rf string is not colored correctly. See how myDict['foo'] varies between incorrectDictionary and regularFString. The square brackets should be purple, and 'foo' orange, but instead it is all absorbed into red.

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

1 participant