zed icon indicating copy to clipboard operation
zed copied to clipboard

Comments in JSON files

Open luckydye opened this issue 2 years ago • 2 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

It seems all files in zed are interpreted to be jsonc (?) and does not have a "JSONC" language.

There are some files in the zed codebase (assets/keymaps/vim.json) for example, that use comments in .json files, but langauge-servers don't know about that. So the biome extension for example, shows diagnostics as if they are json files, which doesn't allow comments.

image

https://github.com/biomejs/biome-zed/issues/11

Environment

Zed: v0.132.2 (Zed Preview) OS: macOS 14.2.1 Memory: 16 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

luckydye avatar Apr 24 '24 05:04 luckydye

Would it work to map the JSON language to jsonc on the Biome extension side?

[language_servers.biome]
name = "Biome Language Server"
language = "JavaScript"
languages = ["JavaScript", "JSX", "TypeScript", "TSX", "Vue.js", "Astro", "Svelte", "JSON", "JSONC"]
# Map the "JSON" language in Zed to "jsonc" (or whatever ID Biome uses for JSONC files).
language_ids = { JSON = "jsonc" }
code_actions_kind = ["", "quickfix"]

maxdeviant avatar Apr 24 '24 21:04 maxdeviant

Would it work to map the JSON language to jsonc on the Biome extension side?

[language_servers.biome]
name = "Biome Language Server"
language = "JavaScript"
languages = ["JavaScript", "JSX", "TypeScript", "TSX", "Vue.js", "Astro", "Svelte", "JSON", "JSONC"]
# Map the "JSON" language in Zed to "jsonc" (or whatever ID Biome uses for JSONC files).
language_ids = { JSON = "jsonc" }
code_actions_kind = ["", "quickfix"]

That was my first thought too, but I think being able to differentiate between linting for json or jsonc is useful too. And the output in the editor would become out of sync with what the cli outputs.

luckydye avatar Apr 25 '24 01:04 luckydye