MagicStack / MagicStack/MagicPython

Format specifiers in f-strings don't highlight the entire thing in a consistent manner

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

Dieses Issue hat noch niemand übernommen.

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

Beschreibung

Hello. Sometimes the :... aspect of a format string is highlighted in its entirety but often times it's not. I would like to know if it's possible to make it so it's all under the same consistent scope or if it's by design that it doesn't. My main use case has to do with types using a custom __format__.

For example:


I would have imagined both of these to fall under the same scope but they're not.

The first screenshot goes source.python > meta.fstring.python > storage.type.format.python
The second screenshot goes source.python > meta.function-call.python > meta.function-call.arguments.python > meta.fstring.python

A regular line of code without using custom __format__ (e.g. {test:.2f}) goes as source.python > meta.function-call.python > meta.function-call.arguments.python > meta.fstring.python > storage.type.format.python which is what I would expect the other two to return as well, unless it's meant to be treated differently.

  • Editor name and version: Sublime Text 3.2.1 Build 3207
  • Platform: Windows 8.1
  • Color scheme: Custom
  • MagicPython version: 1.1.1
  • A sreenshot: See above
  • 5-10 lines of surrounding code: In the screenshot hopefully

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, die beiden f-string-Beispiele in Sublime Text 3.2.1 mit MagicPython 1.1.1 zu reproduzieren und ihre Syntax-Scopes zu untersuchen, indem du sie mit dem regulären {test:.2f}-Beispiel vergleichst. Als erledigt gilt die Aufgabe, wenn die Format-Spezifizierer in den gemeldeten Fällen einen konsistenten Scope erhalten oder das Verhalten als beabsichtigt dokumentiert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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