mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 04:34:25 +08:00
Remove ANSI color codes from nix linter messages (#4944)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
* Remove ANSI color codes from nix linter messages * Add test for color-coded nix linter findings * Fix test: Escape backslashes --------- Co-authored-by: Sebastian Neuser <sebastian.neuser@fnordkollektiv.de> Co-authored-by: Sebastian Neuser <haggl@sineband.de>
This commit is contained in:
@@ -29,7 +29,7 @@ function! ale_linters#nix#nix#Handle(buffer, lines) abort
|
||||
\ 'type': 'E',
|
||||
\ 'lnum': l:result.line,
|
||||
\ 'col': l:result.column,
|
||||
\ 'text': l:result.raw_msg
|
||||
\ 'text': substitute(l:result.raw_msg, '\e\[[0-9;]*m', '', 'g'),
|
||||
\})
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -27,6 +27,22 @@ Execute(The nix handler should parse nix-instantiate error messages correctly):
|
||||
\ "@nix {\"unrelated\":\"message\"}"
|
||||
\ ])
|
||||
|
||||
Execute(The nix handler should parse nix-instantiate error messages with ANSI color codes correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 3,
|
||||
\ 'col': 5,
|
||||
\ 'type': 'E',
|
||||
\ 'text': "undefined variable 'foo'",
|
||||
\ },
|
||||
\
|
||||
\ ],
|
||||
\ ale_linters#nix#nix#Handle(bufnr(''), [
|
||||
\ "@nix {\"line\":3,\"column\":5,\"raw_msg\":\"undefined variable '\\u001b[35;1mfoo\\u001b[0m'\"}",
|
||||
\ "@nix {\"unrelated\":\"message\"}"
|
||||
\ ])
|
||||
|
||||
Execute(The nix handler should parse message from old nix-instantiate correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
|
||||
Reference in New Issue
Block a user