Search code examples
vimneovimneomake

Getting the correct errorformat for neomake


I'm working on making a custom neomake maker for markdown using the tool alex but having a hard time figuring out the correct errorformat for it. Doing some debugging, it seem neomake returns the following information

Neomake [2.587]: [1.6] stderr: alex: ['test.md', '  1:5-1:14  warning  `boogeyman` may be insensitive, use `boogey` instead  boogeyman-boogeywoman  retext-equality', '', '⚠ 1 warning', '']
Neomake [4.431]: [1.6] exit: alex: 1
Neomake [4.431]: [1.6] alex: processing 4 lines of output.
Neomake [4.432]: [1.6] Removing invalid entry: test.md ({'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'maker_name': 'alex', 'pattern': ''})
Neomake [6.404]: [1.6] Removing invalid entry:   1:5-1:14  warning  `boogeyman` may be insensitive, use `boogey` instead  boogeyman-boogeywoman  retext-equality ({'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'maker_name': 'alex', 'pattern': ''})
Neomake [7.837]: [1.6] Removing invalid entry:  ({'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'maker_name': 'alex', 'pattern': ''})
Neomake [8.669]: [1.6] Removing invalid entry: ⚠ 1 warning ({'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'maker_name': 'alex', 'pattern': ''})
Neomake [9.469]: [1.6] alex: completed with exit code 1.
Neomake [9.469]: File-level errors cleaned in buffer 1

And the most successful format I've gotten so far is errorformat = %I%f, but that doesn't feel like the right direction.

Any ideas/tips?


Solution

  • If you don't mind getting inspiration from the competition, something like this might work:

    let errorformat =
        \ '%P%f,' .
        \ '%-Q,' .
        \ '%*[ ]%l:%c-%*\d:%n%*[ ]%tarning%*[ ]%m,' .
        \ '%-G%.%#'
    

    Alternatively, you could use the alex plugin for textlint. As it turns out textlint is a much juicier target, and it has a nicer output format.