MagicStack / MagicStack/MagicPython
Syntax Highlighting regex+format strings (rf)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 1.4k
- Forks
- 98
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
- Editor name and version: VSCode 1.75.1
- Platform: macOS
- Color scheme: Dark+ (default)
- MagicPython version: 1.1.0
- A sreenshot:

- 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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
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.
Bewertung
- Tech-Stack
- python, vscode
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100