这是一个示例输出:
/usr/local/bin/node /usr/local/bin/elm-make src/elm/Main.elm --output=builds/main.js
-- TYPE MISMATCH ---------------------------------------------- src/elm/Main.elm
The type annotation for `init` does not match its definition.
35| init : Maybe Route.Location -> ( Model, Cmd Msg )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The type annotation is saying:
Maybe Route.Location -> ( { route : Maybe Route.Location }, Cmd Msg )
But I am inferring that the definition has this type:
Maybe Route.Location
-> ( { route : Maybe Route.Location -> Route.Model }, Cmd a )
Detected errors in 1 module.
Process finished with exit code 1这就是我想出来的准则:
http://regexr.com/3egqu
但是,在其中创建输出筛选器的方式如下:

不起作用。
到目前为止,我只知道以下工作:------ ($FILE_PATH$)
它将文件路径转换为一个链接:

帮助我找到一种方法,包括在链接中的行号。
发布于 2018-04-11 20:24:42
这是我想出的;
第一,
elm-make --report json输出结构化JSON中的构建错误;
$ elm-make --report json src/main.elm
[{"tag":"unused import","overview":"Module `Bootstrap.CDN` is unused.","details":"Best to remove it. Don't save code quality for later!","region":{"start":{"line":3,"column":1},"end":{"line":3,"column":28}},"type":"warning","file":"src/main.elm"}]现在,您可以通过jq (见这里)。将输出转换为
elm make src/main.elm --report json --output ./public/app.js | \
jq '.[] | { type: .type, file: .file, line: .region.start.line|tostring, tag: .tag, column: .region.start.column|tostring, tag: .tag, details: .details }' | \
jq --raw-output '. | "[" + (.type|ascii_upcase) + "] " + .file + ":" + .line + ":" + .column + " " + .tag + " -- " + .details + "\n"'这将为您提供重新格式化的输出;
[WARNING] src/main.elm:9:1 unused import -- Best to remove it. Don't save code quality for later!
[WARNING] src/main.elm:17:1 missing type annotation -- I inferred the type annotation so you can copy it into your code:
main : Program Never Model Main.Msg在intellij中使用以下格式获取
$FILE_PATH$:$LINE$:$COLUMN$ $MESSAGE$然后,您可以单击一条错误消息以跳转到该文件,并在工具提示中显示错误文本。
https://stackoverflow.com/questions/40240254
复制相似问题