Consider the colon to be a word character when inside a string in JSON (#26574)

KyleBarton created

Partially addresses #25698

Part of why autocomplete suggestions for `keymap.json` aren't great is
because `:` is (correctly) considered a punctuation character, rather
than a word character, in JSON. But since `::` is part of the name of
zed commands, it means that the autocomplete context window loses
context after the user types colon:

Suggestion here is to use overrides for JSON and JSONC such that colon
is considered a word character when it's inside a string. This improves
the experience:

I believe this is more broadly correct anyway, since `:` loses it's
punctuation meaning when inside a string.

Hope this is helpful!

Release Notes:

- Improved autocomplete for keymap.json by treating `::` like word characters when inside a string.

Change summary

crates/languages/src/json/config.toml  | 5 +++++
crates/languages/src/jsonc/config.toml | 5 +++++
2 files changed, 10 insertions(+)

Detailed changes

crates/languages/src/json/config.toml 🔗

@@ -10,3 +10,8 @@ brackets = [
 ]
 tab_size = 2
 prettier_parser_name = "json"
+scope_opt_in_language_servers = ["json-language-server"]
+
+[overrides.string]
+word_characters = [":"]
+opt_into_language_servers = ["json-language-server"]

crates/languages/src/jsonc/config.toml 🔗

@@ -10,3 +10,8 @@ brackets = [
 ]
 tab_size = 2
 prettier_parser_name = "jsonc"
+
+scope_opt_in_language_servers = ["json-language-server"]
+[overrides.string]
+word_characters = [":"]
+opt_into_language_servers = ["json-language-server"]