1

VSCode で、私が実行するカスタム スクリプトでエラーを解析する ProblemMatcher を作成しようとしています (興味がある場合は、マークダウン ファイル -> pandoc -> PDF)。

非常に優れたVSCode ProblemMatcher ドキュメントには、コマンド ( "command": "gcc")を実行し、問題マッチャー ( )"problemMatcher": {...}定義する (私には) ように見えるタスクの例があります。

両方の tasks.json ファイルに対してこれを試すと、「説明を問題マッチャーに変換できません」というエラーが表示されますが、これはあまり役に立ちません。tasks.json スキーマを確認したところ、次のように明確に示されています。

グローバル コマンドが実行された場合 (たとえば、タスクが定義されていない場合) に使用される問題マッチャー。tasks.json ファイルには、グローバルな problemMatcher プロパティまたは tasks プロパティのいずれかを含めることができますが、両方を含めることはできません。

スキーマが間違っていますか?その場合、私は問題を提起します。

それとも私のコードが間違っていますか?その場合は、正しい方向に向けてください。コード全体 (コメントを除く):

{
  "version": "2.0.0",
  "tasks": [
    {
        "label": "md2pdf",
        "type": "shell",
        "command": "md2pdf",
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "presentation": {
            "reveal": "always",
            "panel": "shared",
            "showReuseMessage": false
        },
        "problemMatcher": {
            "owner": "Markdown",
            "fileLocation": ["absolute", "/tmp/md2pdf.log"],
            "pattern": [
                {
                    // Regular expression to match filename (on earlier line than actual warnings)
                    "regexp": "^Converting:\\s+(.*)$",
                    "kind": "location", 
                    "file": 1
                },
                {
                    // Regular expression to match: "l.45 \msg_fatal:nn {fontspec} {cannot-use-pdftex}" with a preceding line giving "Converting <filename>:"
                    "regexp": "l.(\\d+)\\s(.*):(.*)$",
                    "line": 1,
                    "severity": 2,
                    "message": 3
                }
            ]
        }
    }]
}
4

2 に答える 2