biomejs / biome-zed

Biome extension for Zed
https://biomejs.dev
MIT License
127 stars 4 forks source link

json language conflict with jsonc #11

Closed luckydye closed 2 months ago

luckydye commented 4 months ago

So zed has no specific language for .jsonc files, all json files are interpreted as jsonc under "JSON". Now that the biome extensions uses "json" to interpret json files, we get this stuff:

image

We should probably use jsonc for all json files. Though not sure who is right here.

ematipico commented 4 months ago

I noticed that too. However, that's the settings zed file, so I suppose zed does the same thing as VSCode.

If you opened another JSON file, you wouldn't have these errors. I suppose we'll have to add a new expectation

Sec-ant commented 4 months ago

To address potential future language-detection problems, we may want to support using filepath glob patterns and the first line of the file to detect languages just like what VSCode does. We can also learn it from other editors or tools like Prettier.

luckydye commented 4 months ago

I noticed that too. However, that's the settings zed file, so I suppose zed does the same thing as VSCode.

If you opened another JSON file, you wouldn't have these errors. I suppose we'll have to add a new expectation

Yes, but zed actually implies all json files are jsonc, not just the settings files. I think it would be best to actually have a separate JSONC langauge in the editor to control this.

silvenon commented 3 months ago

FWIW i'm getting similar errors in biome.jsonc file, I guess because Zed doesn't recognize those. In my file_types I configured "JSON": ["json", "jsonc"], which took care of the syntax highlighting, but the didn't resolve the error. I'm not sure if it's related to this.

The error is really confusing because unlike the settings file it doesn't make sense at first, but I suppose the comments later screw it up so that's why the whole thing is highlighted red.

Screenshot 2024-05-13 at 22 24 06

xcrap commented 3 months ago

Any forecast on this matter? I wanted to switch to Biome in Zed and VSCode :)

ematipico commented 3 months ago

There's nothing much to do. You'll have to use a configuration file, and enable JSONC features in the parser options

xcrap commented 3 months ago

Or... Zed could add the support for JSONC and we could enable the default formatter for those instead of Biome... without having to create a config file for every project :)

ematipico commented 3 months ago

Feel free to file an issue in their repository

xcrap commented 2 months ago

So apparently it's gonna happen :)

luckydye commented 2 months ago

Is fixed in Zed 0.143.0