neoclide / coc-json

Json language extension for coc.nvim
234 stars 21 forks source link

chrome extention manifest 3 not supported #58

Closed burnthoney closed 2 years ago

burnthoney commented 2 years ago

image It seems to say manifest version 2 is the latest but right now it is 3.

dougeller commented 2 years ago

Without some explanation, I don't see this as fixed. @chemzqm closed this and marked it completed a few days ago; but the "fix" seems to have been to add a config option to enable/disable the default schemas in the catalogue. How does this fix anything? More specifically, how does it address the issue at all?

  1. There is a schema that will validate both v2 and v3 of Chrome extension manifest files stored at schemastore.org
  2. That schema is included/referenced in the catalogue of coc-json default schemas
  3. That being true, coc-json should validate and allow manifest_version: 3 as default behaviour
  4. It does not

How does giving us a config option to enable/disable the default schemas solve this?

Yes, I can put the schema in the manifest file directly with $schema. The question is, why should I have to do that if the schema is already a default schema? Coc-json should be allowing v3 of the Chrome extension manifest as things stand right now, and it should be validating based on that version. It has the schema available to do so.

It seems this should be reopened.

dougeller commented 2 years ago

@chemzqm, thank you for addressing this. Unfortunately the original problem is not fixed. In fact, now we have an additional problem.

Originally, manifest.json files were not validating properly against the Chrome Extension Manifest schema included in catalog.json. Now they are not being validated against that schema at all.

For example. the schema version was recently updated from v2 to v3. In the schema the accepted values of the manifest_version property are defined by...

"manifest_version": { "type": "number", "description": "One integer specifying the version of the manifest file format your package requires.", "enum": [2, 3] },

As you can see, the schema allows for either the current version (3) or previous version (2). The original problem was that only v2 was being accepted when coc-json validated. Since the schema is included in catalog.json, either version should be accepted without the need to override the schema, right?

Both attempts to fix this problem have addressed the ability to override. Why? We don't need to override anything. We need for coc-json to validate correctly using the schema that's already in catalog.json.

But now, since this most recent "fix", not only is the original problem not fixed, we have a new problem: Coc.json is not validating at all against the schema in catalog.json.

For example: Now I can use any value at all in the manifest_version property and it will validate. That is now a new issue.

chemzqm commented 2 years ago

You need use:

  "json.schemas": [
    {
      "fileMatch": ["manifest.json"],
      "url": "https://json.schemastore.org/chrome-manifest.json"
    }
  ],

in your coc-settings.json

dougeller commented 2 years ago

Since that schema is already in catalog.json, why do I need to put it in my coc-settings.json? That seems redundant.

What is the point of it being in catalog.json if it has to be added to coc-settings.json?

On Sat, 6 Aug 2022, 06:01 Qiming zhao, @.***> wrote:

You need use:

"json.schemas": [ { "fileMatch": ["manifest.json"], "url": "https://json.schemastore.org/chrome-manifest.json" } ],

in your coc-settings.json

— Reply to this email directly, view it on GitHub https://github.com/neoclide/coc-json/issues/58#issuecomment-1207186490, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMYPTGGOYSQ5TYNU63JCHBTVXYZV7ANCNFSM5ZHY65XA . You are receiving this because you commented.Message ID: @.***>

chemzqm commented 2 years ago

It's a fallback for json schema, you have to overwrite it when it's not work for you. The catalog.json matches manifest.json with url https://json.schemastore.org/webextension.json

dougeller commented 2 years ago

Ok. So, the reason the Chrome Extension manifest entry in catalog.json doesn't include a match for manifest.json is because manifest.json is already matched to another schema? So why even have the Chrome extension schema in catalog.json at all if it has to be overridden in order to work?

Should it just be removed from catalog.json?

Thank you for helping with this! I appreciate your patience very much!

On Sat, 6 Aug 2022, 06:23 Qiming zhao, @.***> wrote:

It's a fallback for json schema, you have to overwrite it when it's not work for you. The catalog.json matches manifest.json with url https://json.schemastore.org/webextension.json

— Reply to this email directly, view it on GitHub https://github.com/neoclide/coc-json/issues/58#issuecomment-1207189841, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMYPTGANTDWKWOZBTPU26ALVXY4LDANCNFSM5ZHY65XA . You are receiving this because you commented.Message ID: @.***>

chemzqm commented 2 years ago

See https://github.com/neoclide/coc-json#configuration-options

npearson72 commented 2 years ago

@chemzqm I added the field to my settings but it's still not working:

Screen Shot 2022-09-07 at 4 08 26 PM Screen Shot 2022-09-07 at 4 08 40 PM

Adding the schema url to the $schema field in the manifest works, but then is not recognized in chrome:

Screen Shot 2022-09-07 at 4 09 31 PM

Any ideas?