VSCode file association for "package.hugo.json"?

Hugo 0.75.0 introduced the command hugo mod npm pack, which searches for package.hugo.json files in all the used Hugo modules.

When working in VSCode, a package.json file opens as a JSON file, but adds additional support. For example, when using code completion on a package name in the dependencies, devDependencies or peerDependencies sections, VSCode performs a search on npmjs.com for any matches of the partial name.

When I open package.hugo.json file, it is a regular JSON file, without the additional support. I tried any possible file association setting in VSCode, but failed so far.

Are there any other VSCode users which were able to let VSCode treat a package.hugo.json file as a package.json file, hereby having the additional coding support?

Ringo

Find your settings.json and add this:

{
  "files.associations": {
    "*.hugo.json": "FILETYPE"
  }
}

You need to find out, what the FILETYPE notation for your package.json is. I don’t know how to do that, but probably CTRL+SHIFT+P and then typing something like “file association” might bring up help with that.

My VSCode treats package.json as simple JSON, so you might have an npm-related plugin installed. Check its documentation and it will tell you the file type. Then refer to the snippet above.

I have no answer to your question, but there is an open issue about supporting NPM workspaces, which should solve this particular issue: