MagicStack / MagicStack/MagicPython

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

Aperta
#181 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
JavaScript
Stelle
1.4k
Fork
98
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo i due esempi di f-string in Sublime Text 3.2.1 con MagicPython 1.1.1 e ispeziona i relativi scope sintattici, confrontandoli con l’esempio regolare {test:.2f}. Il lavoro è completato quando gli specificatori di formato nei casi segnalati ricevono uno scope coerente, oppure quando il comportamento viene documentato come intenzionale.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.