Show formatting errors in Haskell mode
- Vorherrschende Sprache
- Haskell
- Sterne
- 1.3k
- Forks
- 201
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Ctrl-I triggers a reformat in Haskell mode. But if it fails, you just get "Could not format your code. It may contains errors." Actually, Ormolu gives us a detailed exception. At the very least, we could link people to the location of the error, instead of opaquely claiming there was a problem somewhere in the file.
One might initially think that if there's a parse error, it will be highlighted anyway. But Ormolu actually finds more parse errors than we highlight. That's because it parses in Haddock mode, so e.g. a haddock comment that doesn't match a declaration will cause formatting to fail. Also, there are Ormolu errors that aren't parse errors, such as if CPP is enabled. So it's even more important that reformatting provides an explanation for why it failed.
Beitragsleitfaden
Rechercherichtung
Beginne damit, die Ctrl-I-Neuformatierungsaktion im Haskell-Modus und den Umgang mit Ormolu-Fehlern nachzuverfolgen. Untersuche den Pfad für Formatierungsfehler, einschließlich des Haddock-Parsings und CPP-bezogener Fehler, und ermittle dann, wie die detaillierte Exception oder ihr Ort die Benutzer erreichen kann. Als erledigt gilt die Aufgabe, wenn Formatierungsfehler erklären, wo und warum Ormolu den Code abgelehnt hat.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- haskell
- 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