From 6bdd2cf7db5d7ba1ee13cbb5e6ae0145efd53e45 Mon Sep 17 00:00:00 2001 From: KyleBarton Date: Thu, 13 Mar 2025 13:21:34 -0700 Subject: [PATCH] Consider the colon to be a word character when inside a string in JSON (#26574) 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. --- crates/languages/src/json/config.toml | 5 +++++ crates/languages/src/jsonc/config.toml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/crates/languages/src/json/config.toml b/crates/languages/src/json/config.toml index dc49f4f36e..b38ae00d71 100644 --- a/crates/languages/src/json/config.toml +++ b/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"] diff --git a/crates/languages/src/jsonc/config.toml b/crates/languages/src/jsonc/config.toml index 226ae92912..c5c146a425 100644 --- a/crates/languages/src/jsonc/config.toml +++ b/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"]