microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
160.97k stars 28.24k forks source link

Task.json "Matches multiple schemas when only one must validate." #68006

Closed roa-nyx closed 5 years ago

roa-nyx commented 5 years ago

Issue Type: Bug

I am creating tasks.json entries similar to https://github.com/...

My final tasks.json is:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "watch-app",
            "dependsOn": [
                "watch-app-cs",
                "watch-app-js"
            ],
            "problemMatcher": []
        },
        {
            "label": "watch-app-cs",
            "type": "shell",
            "options": {
                "cwd": "./App"
            },
            "command": "dotnet",
            "args": [
                "watch",
                "run"
            ],
            "presentation": {
                "group": "watch-app"
            }
        },
        {
            "label": "watch-app-js",
            "type": "shell",
            "options": {
                "cwd": "./App"
            },
            "command": "npm",
            "args": [
                "run",
                "watch"
            ],
            "presentation": {
                "group": "watch-app"
            }
        }
    ]
}

And it appears to work, however when I have the tasks.json file open the { above "label": "watch-app" has a green squiggly underline and hovering over it gives me "Matches multiple schemas when only one must validate."

Am I doing something wrong? Or should this actually be treated as valid?

VS Code version: Code 1.31.0 (7c66f58312b48ed8ca4e387ebd9ffe9605332caa, 2019-02-05T22:35:56.624Z) OS version: Windows_NT x64 10.0.17763

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz (4 x 2808)| |GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled| |Memory (System)|7.89GB (1.49GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (4) Extension|Author (truncated)|Version ---|---|--- calculate|aca|2.1.0 vscode-css-formatter|aes|1.0.1 csharp|ms-|1.17.1 unity-debug|Uni|2.6.6
mizx commented 5 years ago

Just updated to 1.31.0 and getting this too. Error occurs for the 3rd task for me:

{
    "label": "label-name",
    "dependsOn": "npm: start", "npm: "dev-server"],
}

If I add a "type" prop the error seems to go away. Is "type" is required now? If so what should it be set to for compound tasks? I tried both "shell" and "process" and neither worked.

I was referenced this doc when creating my tasks.json: https://code.visualstudio.com/docs/editor/tasks#_compound-tasks

zinge commented 5 years ago

First i add "presentation.group" in existing tasks.json, before work perfectly. I tried and understood that I didn't need it, deleted these lines and the launch attempt led to a similar error. I am nothing change in tasks.json and restart vscode. Fixed. Magic.

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "type": "shell",
    "group": "none",
    "tasks": [
        {
            "label": "App: Maven [Clean Install]",
            "linux": {
                "command": "mvn clean install ..."
            },
            "problemMatcher": []
        },
        {
            "label": "App: Npm [WebApp Install]",
            "linux": {
                "command": "npm install ..."
            },
            "problemMatcher": []
        },
        {
            "label": "App: Install",
            "dependsOn": [
                "App: Npm [WebApp Install]",
                "App: Maven [Clean Install]"
            ],
            "problemMatcher": []
        }
}
alexr00 commented 5 years ago

Thank you for filing this!

alexr00 commented 5 years ago

I tested out several configurations, but the task schema is complex and I may have missed something. Let me know if this solves your cases!

roa-nyx commented 5 years ago

Apologies @alexr00 I'm confused by your last comment. Has this fix been released so I can test it? Is this task currently in a state that you need feedback, or is it closed/will be fixed in next release? I haven't seen any update come through on VSCode (still on 1.31.0).

alexr00 commented 5 years ago

The fix is in the VS Code Insiders build. You can try it out there now, or you can wait for the February release. If you do try out the Insiders build it would be great if you could confirm that the validation error is gone since it will give me a chance to make further fixes before the February release if needed 😊

roa-nyx commented 5 years ago

Ok, sweet. I'll maybe try that later today if I can get the insiders build to install SxS with the stable release.

Admiralfeb commented 5 years ago

I have the same problem with the Production version. I've loaded up my project in VSCode Insiders and it appears to be working. I don't have the warning in my Tasks.json on the Insiders build.

Insiders version: Version: 1.32.0-insider (user setup) Commit: a509265116babc17648c9052eeeb8ae2909fed87 Date: 2019-02-13T06:17:10.681Z Electron: 3.1.3 Chrome: 66.0.3359.181 Node.js: 10.2.0 V8: 6.6.346.32 OS: Windows_NT x64 10.0.16299

noppej commented 5 years ago

I've just updated to 1.32.1 production build and still getting the warnings. Is that to be expected? I've included a copy of my tasks.json file in case it helps you.

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build project",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "type": "shell",
            "command": "/Applications/Xcode.app/Contents/Developer/usr/bin/make",
            "args": [
                "GCC_PATH=/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.2.1/.content/bin",
                "-j12"
            ],
            "problemMatcher": {
                "pattern": {
                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                }
            },
            "presentation": {
                "focus": true
            }
        },
        {
            "label": "Compile current file",
            "type": "shell",
            "command": "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.2.1/.content/bin/arm-none-eabi-gcc",
            "args": [
                "-c",
                "-DAVOID_EMPTY_DEFINE_FIELD_C",
                "-D__weak=__attribute__((weak))",
                "-D__packed=__attribute__((__packed__))",
                "-DUSE_STM32F746G_DISCO",
                "-DUSE_HAL_DRIVER",
                "-DSTM32F746xx",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/BSP/STM32746G-Discovery",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/BSP/Components/ft5336",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/BSP/Components/Common",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/ST/STemWin/inc",
                "-IInc",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Inc",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Inc/Legacy",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/include",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/CMSIS/Device/ST/STM32F7xx/Include",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/CMSIS/Include",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/CMSIS/Include",
                "-mcpu=cortex-m7",
                "-mthumb",
                "-mfpu=fpv5-sp-d16",
                "-mfloat-abi=hard",
                "-DAVOID_EMPTY_DEFINE_FIELD_C",
                "-D__weak=__attribute__((weak))",
                "-D__packed=__attribute__((__packed__))",
                "-DUSE_STM32F746G_DISCO",
                "-DUSE_HAL_DRIVER",
                "-DSTM32F746xx",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/BSP/STM32746G-Discovery",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/BSP/Components/ft5336",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/BSP/Components/Common",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/ST/STemWin/inc",
                "-IInc",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Inc",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Inc/Legacy",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/include",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/CMSIS/Device/ST/STM32F7xx/Include",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/CMSIS/Include",
                "-I/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/CMSIS/Include",
                "-Og",
                "-Wall",
                "-fdata-sections",
                "-ffunction-sections",
                "-fmessage-length=0",
                "-Wall",
                "-Werror-implicit-function-declaration",
                "-Werror=int-to-pointer-cast",
                "-Werror=pointer-to-int-cast",
                "-g",
                "-gdwarf-2",
                "-MMD",
                "-MP",
                "-MF'build/${fileBasenameNoExtension}.d'",
                "'${relativeFile}'",
                "-o",
                "'build/${fileBasenameNoExtension}.o'"
            ],
            "problemMatcher": {
                "pattern": {
                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                }
            },
            "presentation": {
                "focus": true
            }
        },
        {
            "label": "Delete build folder",
            "type": "shell",
            "command": "/Applications/Xcode.app/Contents/Developer/usr/bin/make",
            "args": [
                "clean"
            ],
            "problemMatcher": [],
            "presentation": {
                "focus": false
            }
        },
        {
            "label": "CPU: Build, Download and run",
            "type": "shell",
            "command": "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/openocd/0.10.0-11.1/.content/bin/openocd",
            "args": [
                "-f",
                "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/openocd/0.10.0-11.1/.content/scripts/interface/stlink.cfg",
                "-f",
                "/Users/Jack/SSTP/Console/ConsoleBoardOpenOCD.cfg",
                "-c",
                "program build/Console.elf verify reset exit"
            ],
            "problemMatcher": [],
            "dependsOn": "Build project"
        },
        {
            "label": "CPU: Download and run",
            "type": "shell",
            "command": "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/openocd/0.10.0-11.1/.content/bin/openocd",
            "args": [
                "-f",
                "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/openocd/0.10.0-11.1/.content/scripts/interface/stlink.cfg",
                "-f",
                "/Users/Jack/SSTP/Console/ConsoleBoardOpenOCD.cfg",
                "-c",
                "program build/Console.elf verify reset exit"
            ],
            "problemMatcher": []
        },
        {
            "label": "CPU: Reset and run",
            "type": "shell",
            "command": "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/openocd/0.10.0-11.1/.content/bin/openocd",
            "args": [
                "-f",
                "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/openocd/0.10.0-11.1/.content/scripts/interface/stlink.cfg",
                "-f",
                "/Users/Jack/SSTP/Console/ConsoleBoardOpenOCD.cfg",
                "-c init",
                "-c reset",
                "-c exit"
            ],
            "problemMatcher": []
        },
        {
            "label": "CPU: Halt",
            "type": "shell",
            "command": "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/openocd/0.10.0-11.1/.content/bin/openocd",
            "args": [
                "-f",
                "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/openocd/0.10.0-11.1/.content/scripts/interface/stlink.cfg",
                "-f",
                "/Users/Jack/SSTP/Console/ConsoleBoardOpenOCD.cfg",
                "-c init",
                "-c halt",
                "-c exit"
            ],
            "problemMatcher": []
        },
        {
            "label": "CPU: Run",
            "type": "shell",
            "command": "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/openocd/0.10.0-11.1/.content/bin/openocd",
            "args": [
                "-f",
                "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/openocd/0.10.0-11.1/.content/scripts/interface/stlink.cfg",
                "-f",
                "/Users/Jack/SSTP/Console/ConsoleBoardOpenOCD.cfg",
                "-c init",
                "-c resume",
                "-c exit"
            ],
            "problemMatcher": []
        },
        {
            "label": "Run Python file",
            "type": "shell",
            "command": "python3",
            "args": [
                "${file}"
            ],
            "presentation": {
                "focus": true
            },
            "problemMatcher": []
        },
        {
            "label": "Open CubeMX project",
            "type": "shell",
            "command": "xdg-open",
            "args": [
                "",
                "/Users/Jack/SSTP/Console/Console.ioc"
            ],
            "presentation": {
                "focus": false
            },
            "problemMatcher": []
        },
        {
            "label": "Update workspace",
            "type": "shell",
            "command": "python3",
            "args": [
                "${workspaceFolder}/ideScripts/update.py"
            ],
            "presentation": {
                "focus": true
            },
            "problemMatcher": []
        }
    ]
}
david-waterworth commented 5 years ago

I'm getting this issue also, and in addition changes I make to tasks.json aren't reflected in the list of tasks presented on the debug window - I have to restart vscode in order to be able to run new tasks.

alexr00 commented 5 years ago

@david-waterworth, can you open a new issue with your repro steps? @noppej, you shouldn't still be getting the Matches multiple schemas warning. Thanks for providing the tasks.json. I will take a look.

noppej commented 5 years ago

@alexr00 ... Thank you. I am traveling today, but if you need more info, let me know and I will forward asap.

alexr00 commented 5 years ago

@noppej, I tested with your tasks.json, and I don't see any warnings. I'm wondering if you have an extension installed that is also providing a schema for tasks.json? Can you try disabling all your extensions then reloading?

noppej commented 5 years ago

Hi @alexr00 ... you called it :) I disabled (with reload) my extensions one by one, and the culprit appears to be the C/C++ extension from Microsoft. When I disabled it, the warning goes away. Then re-enabling it, brings the warning back. Any suggestions on how I can pursue this further?

alexr00 commented 5 years ago

I can see why it's happening with that extension. It contributes a task definition that conflicts with the default task definition: https://github.com/Microsoft/vscode-cpptools/blob/master/Extension/package.json#L46 I will follow up with them to understand why that exists.

vynilas commented 5 years ago

Hi Alex, I've just installed a fresh vcode 1.32.3 on ubuntu LT16. I have no vcode extension at all. I use a single compilation task in my tasks.json and I've got this issue too. Thanks for helping me in working around with this issue. Cheers ! Sylvain

VcodeBug

Below my tasks.json :

{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "build gdk1", // Make this the default build command. "group": { "kind": "build", "isDefault": true }, // Show the output window only if unrecognized errors occur. "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared" }, "command":[
"make"
] , // No args "args": [ "clean", "all" ], // Use the standard less compilation problem matcher. "problemMatcher": { "owner": "cpp", "fileLocation": [ "relative", "${workspaceRoot}" ], "pattern": { "regexp": "^(.):(\d+):(\d+):\s+(warning|error):\s+(.)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 } } } ] }

alexr00 commented 5 years ago

@vynilas I can reproduce. Thanks for sharing your tasks.json.

vynilas commented 5 years ago

Thanks for your feedback. BTW, FYI, there's only a warning, but the task is not performed at all. Cheers !

vynilas commented 5 years ago

Moreover, this tasks.json works flawlessly on vcode v1.32.1 , Electron 3.1.3

alexr00 commented 5 years ago

I checked on v 1.32.1 and it has the same warning with your tasks.json.

vynilas commented 5 years ago

Weird !! (See below) This vcode instance embeds C/C++ MS intellisense 0.21.0 and austin C++ intelissense v0.22

VcodeBug2