Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[json] file schema loaded on client instead of server #83515

Closed
TheBeardedLlama opened this issue Oct 29, 2019 · 6 comments
Closed

[json] file schema loaded on client instead of server #83515

TheBeardedLlama opened this issue Oct 29, 2019 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug json JSON support issues verified Verification succeeded
Milestone

Comments

@TheBeardedLlama
Copy link

TheBeardedLlama commented Oct 29, 2019

Issue Type: Bug

Due to issue #83469 I am trying to work around it until it gets fixed.
I found out that you can use file urls to point a particular schema to a local copy.
However, when I do, VSCode still insists on trying to download it over the wire.
The interesting thing is that if the path is not well formed and doesn't map to a real file, I get an error about the path. However, when the path is well formed and the file exists it just ignores it and goes over the wire instead...

This is my json.schemas section:

    "json.schemas": [
            {
                    "fileMatch": [
                            "/package.json"
                    ],
                    "url": "file:///C:/Users/user/Downloads/schemas/package.json"
            },
            {
                    "fileMatch": [
                            "/tsconfig.json"
                    ],
                    "url": "file:///C:/Users/user/Downloads/schemas/tsconfig.json"
            },
            {
                    "fileMatch": [
                            "/tslint.json"
                    ],
                    "url": "file:///C:/Users/user/Downloads/schemas/tslint.json"
            }
    ]

Update: the schema does get imported, however it still tries to download it and raises "problems" for those files that the schema applies to.

VS Code version: Code 1.37.1 (f06011a, 2019-08-15T16:17:55.855Z)
OS version: Windows_NT x64 10.0.16299

System Info
Item Value
CPUs Intel(R) Xeon(R) CPU E5-2695 v4 @ 2.10GHz (4 x 2100)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: unavailable_off
protected_video_decode: unavailable_off
rasterization: unavailable_off
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled_readback
webgl2: enabled_readback
Load (avg) undefined
Memory (System) 10.00GB (4.43GB free)
Process Argv
Screen Reader no
VM 100%
Extensions (39)
Extension Author (truncated) Version
Bookmarks ale 10.5.0
ng-template Ang 0.802.3
regex chr 0.2.0
bracket-pair-colorizer Coe 1.0.61
jshint dba 0.10.21
vscode-eslint dba 1.9.1
FreeMarker dco 0.0.9
githistory don 0.4.6
gitlens eam 10.1.1
EditorConfig Edi 0.13.0
auto-close-tag for 0.5.6
auto-rename-tag for 0.1.1
code-runner for 0.9.14
seito-openfile Fr4 1.8.5
beautify Hoo 1.5.0
rest-client hum 0.22.2
icon-fonts idl 2.2.2
l13-diff L13 0.21.0
csharp ms- 1.21.5
powershell ms- 2019.9.0
vs-keybindings ms- 0.2.0
vscode-typescript-tslint-plugin ms- 1.2.2
vsliveshare ms- 1.0.1056
debugger-for-chrome msj 4.12.1
vscode-css-peek pra 3.0.2
quicktype qui 12.0.46
java red 0.52.0
LiveServer rit 5.6.1
code-spell-checker str 1.7.18
vscodeintellicode Vis 1.2.0
vscode-java-debug vsc 0.23.0
vscode-java-dependency vsc 0.6.0
vscode-java-pack vsc 0.8.0
vscode-java-test vsc 0.20.0
vscode-maven vsc 0.19.1
vscode-icons vsc 9.5.0
vscode-todo-highlight way 1.0.4
JavaScriptSnippets xab 1.7.2
html-css-class-completion Zig 1.19.0
@Forlini91
Copy link

Forlini91 commented Oct 29, 2019

You don't need to type "file://" and the path must be relative to the project folder
Example, if folder "schema" is in the project root folder:

{
    "fileMatch": [
            "/tslint.json"
    ],
    "url": "./schemas/tslint.json"
}

It seems absolute paths are not supported yet. Maybe you can ask to add support for them

@TheBeardedLlama
Copy link
Author

Hey @Forlini91 what you're referring to is another way to reference schemas.
I'm specifically referring to file URLs, which is different to the relative path method that you're describing.

@aeschli aeschli changed the title File URLs for json.schemas settings are ignored [json] support file:// URL in json.schemas settings Oct 30, 2019
@aeschli
Copy link
Contributor

aeschli commented Oct 30, 2019

We currently only support relative paths as shown here:
https://code.visualstudio.com/docs/languages/json#_mapping-to-a-schema-in-the-workspace

@aeschli aeschli added json JSON support issues feature-request Request for new features or functionality labels Oct 30, 2019
@aeschli aeschli added this to the Backlog milestone Oct 30, 2019
@TheBeardedLlama
Copy link
Author

TheBeardedLlama commented Oct 30, 2019

I'm sorry @aeschli but you do support them and I'm surprised you don't know this already. It's even mentioned in other tickets (that's where I got the idea from).

Please read my report above again and carefully.

I'm not saying it's not working.

I'm saying that even though the schema is loaded from the file, it still tries to go over the wire and throws an error because it can't. If it has the schema loaded already it should not be trying to go over the wire IMHO.

This is just sloppy issue handling...

@aeschli
Copy link
Contributor

aeschli commented Oct 31, 2019

Thanks for your investigations.

@aeschli aeschli changed the title [json] support file:// URL in json.schemas settings [json] file schema loaded on client instead of server Oct 31, 2019
@aeschli aeschli added bug Issue identified by VS Code Team member as probable bug and removed feature-request Request for new features or functionality labels Oct 31, 2019
@aeschli aeschli modified the milestones: Backlog, October 2019 Oct 31, 2019
@aeschli
Copy link
Contributor

aeschli commented Oct 31, 2019

To verify:

  • make sure to test on a build that contains the fix;-)

  • in the settings add

    "json.trace.server": "messages",
    "json.schemas": [{ "fileMatch": ["foo.json"], "url": "file:///not/here" }]
  • create a file 'foo.json'
  • verify that the file has warning 'Unable to load schema...`
  • verify that Log (JSON Language Server) has no message vscode/content

@connor4312 connor4312 added the verified Verification succeeded label Oct 31, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug json JSON support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants