Syntax Highlighting regex+format strings (rf)

Offen
#256 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python, vscode
Bereich
tooling

Rechercherichtung

Beginne mit den rf-string-Beispielen in diesem Issue und vergleiche das Hervorhebungsverhalten von myDict['foo'] mit dem regulären f-string-Beispiel. Überprüfe die Implementierung im Zusammenhang mit dem Follow-up in Issue #186, reproduziere die fehlerhafte Farbgebung in VSCode und betrachte das Issue als erledigt, wenn Dictionary- oder Klassenausdrücke innerhalb von rf-string-Formatfeldern konsistent hervorgehoben werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

  • 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.

Vorherrschende Sprache
JavaScript
Sterne
1.4k
Forks
98
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus MagicStack/MagicPython

Alle Issues in MagicStack/MagicPython

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.