Skip to content

[json] schema path not resolved properly for multi-root workspaces #124491

Closed

Description

Issue Type: Bug

I have a multi-root VSC workspace with three folders:

  • A/
  • ./subfolderOfA
  • <external abs path>

In A/, there is a .code-workspace file and in there, there are the following settings:

"files.associations": {
    "*.rq*": "json"
},
"json.schemas": [
    {
        "fileMatch": [
            "*.rqw"
        ],
        "url": "./samples/schemas/rqwSchema.json"
    }
]

When I edit some .rqx file somewhere inside A/, it seems like this JSON schema file path is only properly resolved If I remove folders ./subfolderOfA and <external abs path> from my multi-root workspace. Shouldn't this work?

VS Code version: Code 1.56.2 (054a929, 2021-05-12T17:13:13.157Z)
OS version: Windows_NT x64 10.0.19042

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz (8 x 2712)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.92GB (8.65GB free)
Process Argv --crash-reporter-id 919e0ed9-46f3-4ad4-9e28-f35755bf8266
Screen Reader no
VM 0%
Extensions (10)
Extension Author (truncated) Version
bracket-pair-colorizer-2 Coe 0.2.0
xml Dot 2.5.1
tortoise-svn fan 0.1.1
python ms- 2020.9.114305
vscode-pylance ms- 2021.5.3
jupyter ms- 2021.6.832593372
cpptools ms- 1.3.1
code-spell-checker str 1.10.2
open-in-browser tec 2.0.0
vscodeintellicode Vis 1.2.14
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
pythonvspyt639:30300192
pythontb:30283811
pythonvspyt551:30291414
vspre833cf:30267465
pythonptprofiler:30281270
vshan820:30294714
vscorecescf:30290706
pythondataviewer:30285071
vscus158cf:30286554
vscgsv2:30301612
vscorehov:30302759
bridgeflight:30302069
vscod805:30301674

Activity

  1. added
    json
    bug
    on May 31, 2021
  2. changed the title [-]JSON schema path not resolved properly for multi-root workspaces[/-] [+][json] schema path not resolved properly for multi-root workspaces[/+] on Oct 29, 2021
  3. 41 remaining items

  4. aeschli commented on Feb 28, 2023

    @aeschli
    Contributor

    To verify:

    • clone https://github.com/aeschli/test-schema-in-workspace
    • open workspace test-schema-in-workspace/test-schema.code-workspace
    • look at the workspace settings: all files ws.json are associated with schema ./folder2/ws-schema.json. Note that this is a relative path to the workspace file
    • open both files ws.json and check that code completion gives back property ws-folder2. You can also click on the JSON language selector ({ } next to JSON in the status bar) to see the schema that is associated
    • look at the folder setings: foo.json is associated with schema ./folder1/foo-schema.json. Note that this is a relative path to the folder
    • open both files foo.json files and check that code completion gives back property foo-folder1, but only when in folder1. You can also click on the JSON language selector ({ } next to JSON in the status bar) to see the schema that is associated
  5. dbaeumer commented on Feb 28, 2023

    @dbaeumer
    Member

    I tried to verify this using build

    Version: 1.76.0-insider (user setup)
    Commit: 92da9481c0904c6adfe372c12da3b7748d74bdcb
    Date: 2023-02-28T11:50:30.886Z
    Electron: 19.1.11
    Chromium: 102.0.5005.196
    Node.js: 16.14.2
    V8: 10.2.154.26-electron.0
    OS: Windows_NT x64 10.0.22623
    Sandboxed: Yes
    

    but the schemas are not used. Here is what I see in the UI:

    image

    Martin Aeschlimann (@aeschli) please advise which build I should use for verification.

  6. aeschli commented on Feb 28, 2023

    @aeschli
    Contributor

    Looks like it is still not working on Windows due to to an URI encoding issue.

  7. alx9r commented on Mar 7, 2023

    @alx9r

    I tested as described in the "test-schema-in-workspace" repro with VS Code 1.76.0 on Windows.

    I observed the following for foo.json and bar.json in VS Code:

    • no schema-defined code completion is offered
    • there is no schema offered when clicking on the language selector

    I then tested folder-only settings by opening VS Code to folder1. I observed the same as above for foo.json.

    FWIW, this stackoverflow question describes another repro with only folder settings (not workspace settings).

    Is there a known workaround to get validation working using fileMatch on Windows for 1.76.0?

  8. aeschli commented on Mar 8, 2023

    @aeschli
    Contributor

    alx9r the fix for Windows is coming: #176296

  9. aeschli commented on Mar 20, 2023

    @aeschli
    Contributor

    #176296 is now also fixed (and verified)

  10. locked and limited conversation to collaborators on May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugjsonverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions