72dbd7f648
In the (unreleased) Nix 2.4 the error-messages have been reformatted[1]. This patch aims to retain proper `.nix`-support in `ale`, for both stable Nix (2.3 and older) and unstable Nix (2.4 and newer). [1] https://github.com/NixOS/nix/pull/3590
51 lines
1.3 KiB
Text
51 lines
1.3 KiB
Text
Before:
|
|
runtime ale_linters/nix/nix.vim
|
|
|
|
After:
|
|
call ale#linter#Reset()
|
|
|
|
Execute(The nix handler should parse nix-instantiate error messages correctly):
|
|
AssertEqual
|
|
\ [
|
|
\ {
|
|
\ 'lnum': 6,
|
|
\ 'col': 3,
|
|
\ 'type': 'E',
|
|
\ 'text': "syntax error, unexpected ']', expecting ';'",
|
|
\ },
|
|
\ {
|
|
\ 'lnum': 3,
|
|
\ 'col': 5,
|
|
\ 'type': 'E',
|
|
\ 'text': "undefined variable 'foo'",
|
|
\ },
|
|
\
|
|
\ ],
|
|
\ ale_linters#nix#nix#Handle(bufnr(''), [
|
|
\ "@nix {\"line\":6,\"column\":3,\"raw_msg\":\"syntax error, unexpected ']', expecting ';'\"}",
|
|
\ "@nix {\"line\":3,\"column\":5,\"raw_msg\":\"undefined variable 'foo'\"}",
|
|
\ "@nix {\"unrelated\":\"message\"}"
|
|
\ ])
|
|
|
|
Execute(The nix handler should parse message from old nix-instantiate correctly):
|
|
AssertEqual
|
|
\ [
|
|
\ {
|
|
\ 'lnum': 23,
|
|
\ 'col': 14,
|
|
\ 'text': 'error: syntax error, unexpected IN',
|
|
\ 'type': 'E',
|
|
\ },
|
|
\ {
|
|
\ 'lnum': 3,
|
|
\ 'col': 12,
|
|
\ 'text': 'error: syntax error, unexpected ''='', expecting '';''',
|
|
\ 'type': 'E',
|
|
\ },
|
|
\
|
|
\ ],
|
|
\ ale_linters#nix#nix#Handle(47, [
|
|
\ 'This line should be ignored',
|
|
\ 'error: syntax error, unexpected IN, at /path/to/filename.nix:23:14',
|
|
\ 'error: syntax error, unexpected ''='', expecting '';'', at /path/to/filename.nix:3:12',
|
|
\ ])
|