microsoft / vscode

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

[json] include copies of the `package.json`, `jsconfig.json`, `eslint.json` schemas #206792

Open Martinspire opened 7 months ago

Martinspire commented 7 months ago

For various JSON files VSCode uses SchemaStore to get information on what is allowed or not in these files. For example: package.json, tsconfig.json and eslint.json. For these files VSCode grabs them from the schemastore website schemastore.org

However, in modern days websites could be offline which is what happened today as well (and I believe it happened more recently as well) as this issue shows: https://github.com/SchemaStore/schemastore/issues/3620

It would be nice if VSCode could cache these results (it would also save the website some bandwidth) and only update when things have changed, perhaps when nodejs packages have been updated or just weekly/montly instead of what it is now. The main issue right now is that it doesn't have a fallback and currently shows errors on every json file you open

image image


image
aeschli commented 7 months ago

We cache all schemas that we get from schemastore.org once we fetched them successfully the first time. The cache is updated every 2 days.

But yes, you suggest to keep copies of some of the 'important' ones. We also do that but only for the meta schemas.

VSCodeTriageBot commented 7 months ago

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Martinspire commented 7 months ago

We cache all schemas that we get from schemastore.org once we fetched them successfully the first time. The cache is updated every 2 days.

But yes, you suggest to keep copies of some of the 'important' ones. We also do that but only for the meta schemas.

Perhaps another fix would be to not lose them when the new one can't be fetched? That way we dont need to define a master-list of jsons that need to be copied? There's more JSONs that gave the issue. For instance, I have multiple tsconfigs, theres the package-lock.json, i have various mock json files, some might still use tslint, etc.

Nagacash commented 7 months ago

Hi, I'm having the same issues, https://www.schemastore.org/ is offline, any updates yet?

VSCodeTriageBot commented 7 months ago

:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

lisonge commented 5 months ago

image

I have encountered the collapse of https://json.schemastore.org/ many times

The following is a simple solution

// your vscode user settings.json

    "json.schemas": [
        {
            "fileMatch": ["**/package.json"],
            "url": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/package.json"
            // or https://cdn.jsdelivr.net/gh/SchemaStore/schemastore@master/src/schemas/json/package.json
        }
    ],

now hint is work but the warn is still visible

image