我正在尝试设置 errorformat
ghcide ,它会产生以下输出。
ghcide version: 0.0.4 (GHC: 8.6.5)
Ghcide setup tester in /opt/devel/haskell/haskell-vim-now.
Report bugs at https://github.com/digital-asset/ghcide/issues
Step 1/6: Finding files to test in /opt/devel/haskell/haskell-vim-now
Found 1 files
Step 2/6: Looking for hie.yaml files that control setup
Found 1 cradle
Step 3/6, Cradle 1/1: Implicit cradle for /opt/devel/haskell/haskell-vim-now
Cradle {cradleRootDir = "/opt/devel/haskell/haskell-vim-now", cradleOptsProg = CradleAction: default}
Step 4/6, Cradle 1/1: Loading GHC Session
Step 5/6: Initializing the IDE
Step 6/6: Type checking the files
File: foo.hs
Range: 1:4-1:5
Source: typecheck
Severity: DsError
Message:
ESC[0;91mfoo.hs:1:5: error:
• No instance for (Num String) arising from the literal ‘5’
• In the expression: 5
In an equation for ‘x’: x = 5ESC[0m
Completed (1 file worked, 0 files failed)
有以下内容~/.vim/compiler/ghcide.vim
:
CompilerSet errorformat=%-Gghcide\ %s
CompilerSet errorformat+=%-GReport\ bugs\ at\ %s
CompilerSet errorformat+=%-GStep\ %s
CompilerSet errorformat+=%-GFound\ %s
CompilerSet errorformat+=%-GCradle\ %s
CompilerSet errorformat+=%-GRange:\ %s
CompilerSet errorformat+=%-GFile:\ %s
CompilerSet errorformat+=%-GSource:\ %s
CompilerSet errorformat+=%-GSeverity:\ %s
CompilerSet errorformat+=%-GCompleted\ %s
" exclude empty or whitespace-only lines
CompilerSet errorformat+=%-G\\s%#
CompilerSet errorformat+=%E!\ Message:%>%trror%m
setlocal makeprg=ghcide\ %
Quickfix 缓冲区仅显示剩余的四行:
:clist
1: Message:-
2: ^[[0;91mfoo.hs:1:5: error:
3: • No instance for (Num String) arising from the literal ‘5’
4: • In the expression: 5
由于我自己无法弄清楚如何将上述多行消息映射到单个clist
条目中,因此我正在寻求帮助。