sanity-io / vscode-sanity

Visual Studio Code extension for developing applications powered by Sanity.io
MIT License
51 stars 8 forks source link

Extension can't find `sanity.json` in sibling dir #9

Closed hacknug closed 2 weeks ago

hacknug commented 2 years ago

I'm trying to execute some queries from a different directory of my project than the one that holds my sanity.json file.

Any way to make that available to the extension without moving it to the root directory?

project-name/
├── frontend/
├──── nuxt.config.js
├── studio/
├──── sanity.json

Ideally the extension would look for the nearest file, including sibling directories. Best would be to look in all project dirs except those on .gitignore and determine which file is the nearest in case of finding multiple. Not sure how feasable this is though.

Adding a way to specify an array of string/regex paths in settings might also work in cases where users have similar structures across projects (would work for me but it's a far for perfect solution imho).

frontshift commented 2 years ago

Having the same issue. Would be nice to default to the root directory with an optional path pointing to sanity.json in the extension settings

jeslenbucci commented 2 years ago

You can create a symlink. My set up is something like this:

backend/
--sanity.json
frontend/
--sanity.json (symlink)

if you're using ubuntu, mac, or anything like that where you can use the command line, the command is this $ ln -s source target. So, if I was in the frontend/ directory, which is where I want to create the link to the actual sanity.json file located in the backedn/ directory, I would execute this command $ ln -s ../backend/sanity.json sanity.json

runeb commented 2 weeks ago

We have now updated the plugin to support the newer sanity.cli.js|ts config file.