b0o / SchemaStore.nvim

🛍 JSON schemas for Neovim
https://schemastore.org
Apache License 2.0
726 stars 18 forks source link

Using local schema repo #7

Closed pedro757 closed 11 months ago

pedro757 commented 2 years ago

I'm contributing to the schemastore repo but I would like to see if my changes work before creating a PR. Is it possible to use a local schema?

b0o commented 1 year ago

This is a good idea, I'm open to a PR adding this feature.

Ajibaji commented 1 year ago

im using this to point to a local ado pipelines yaml schema: schemas = vim.list_extend( { ['/path/to/custom-schemas/ado-pipelines.json'] = { 'ado/**/*.y*ml', '**/*azure*.y*ml', '**/*ado*.y*ml', '**/*ipeline*/**/*.y*ml', } }, require('schemastore').yaml.schemas() ),

pixelprogrammer commented 1 year ago

This is a good idea, I'm open to a PR adding this feature.

Just confirming that this feature still doesn't exist correct?

b0o commented 1 year ago

@pixelprogrammer That's correct.

Zachiah commented 11 months ago

Hi. I'm looking to implement this. Is there a proposed API? I was thinking allowing file:// urls in the extra[].url option. Would this work?

b0o commented 11 months ago

@Zachiah I actually just tested this with jsonls and it already works!

require('schemastore').json.schemas {
  replace = {
    ['package.json'] = {
      description = 'package.json overridden',
      fileMatch = { 'package.json' },
      name = 'package.json',
      url = 'file:///tmp/packagejson-schema.json',
    },
  },
}

I haven't tested yamlls.

Zachiah commented 11 months ago

Interesting haha. So to be clear, assuming yamlls works, there is no longer anything to do here? I suppose we could write some kind of documentation for it at the very least?

b0o commented 11 months ago

I just tested yamlls and it works as well. Also, both jsonls and yamlls support raw paths like /tmp/foo/bar.json as well as file URIs like file:///tmp/foo/bar.json. I agree, we should update the docs to reflect this.

Zachiah commented 11 months ago

OK. Cool. Are you good with me making a PR to update the docs?

b0o commented 11 months ago

That would be great!