ledger / vim-ledger

Vim plugin for Ledger
GNU General Public License v2.0
370 stars 56 forks source link

fix: Improve errorformat for hledger #157

Closed lakshayg closed 4 months ago

lakshayg commented 4 months ago

The original errorformat was specified as a multiline format followed by an "ignore non-matching lines format". I encountered some cases where this was problematic:

  1. hledger errors have a lot of context spread across multiple lines. Matching everything with 1 multiline format causes vim to move all that information into a single error line which becomes very hard to read.
  2. Removing non-matching lines makes it so that if an error is not recognized by efm then it is completely discarded. This can hide errors from the user. For example, in case of an unbalanced transaction hledger prints something like:
    hledger: Error: <filename>:<line1>-<line2>: <line1> | <date>  <payee>
           |      <posting-line1>            <amount>
           |      <posting-line2>            <amount>
           |      <posting-line3>            <amount>
           |      ...
    This transaction is unbalanced.
    The real postings' sum should be 0 but is: <delta>
    Consider adjusting this entry's amounts, or adding missing postings.

    This error message does not match the old errorformat in the plugin.