b0o / SchemaStore.nvim

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

Support for tsconfig.*.json #5

Closed Zangetsu101 closed 2 years ago

Zangetsu101 commented 2 years ago

The tsconfig.json doesn't seem to match tsconfig.*.json files. I tried adding this:

schemas = require('schemastore').json.schemas {
  select = {
    '.eslintrc',
    'lerna.json',
    'package.json',
    'prettierrc.json',
    'tsconfig.json',
    'tslint.json'
  },
  replace = {
    ['tsconfig.json'] = {
      description = 'Custom JSON schema for typescript configuration files',
      fileMatch = {'tsconfig*.json'},
      name = '.tsconfig.json',
      url = 'https://json.schemastore.org/tsconfig.json'
    }
  }
}

Any ideas?

b0o commented 2 years ago

Hey, thank you for the report! It led me to discover that I recently introduced a bug causing select and replace not to work together as expected. Can you try the latest version?

b0o commented 2 years ago

There is also is an issue with your example. You should keep the name tsconfig.json the same and not change it to .tsconfig.json in the replace, otherwise the select won't find it. This should work:

schemas = require('schemastore').json.schemas {
  select = {
    '.eslintrc',
    'lerna.json',
    'package.json',
    'prettierrc.json',
    'tsconfig.json',
    'tslint.json'
  },
  replace = {
    ['tsconfig.json'] = {
      description = 'Custom JSON schema for typescript configuration files',
      fileMatch = {'tsconfig*.json'},
      name = 'tsconfig.json',
      url = 'https://json.schemastore.org/tsconfig.json'
    }
  }
}
Zangetsu101 commented 2 years ago

.tsconfig.json was my bad. Thanks for pointing that out. And it is working as expected after updating to the latest version. Anyway just wondering shouldn't the fileMatch be tsconfig*.json out of the box?

b0o commented 2 years ago

And it is working as expected after updating to the latest version.

Awesome, glad it's working.

Anyway just wondering shouldn't the fileMatch be tsconfig*.json out of the box?

You'll want to raise that issue upstream, this repo is just consuming the catalog.