Upgrade tree sitter and all grammars (#17734)

Fixes https://github.com/zed-industries/zed/issues/5291

Release Notes:

- Fixed a bug where the 'toggle comments' command didn't use the right
comment syntax in JSX and TSX elements.

---------

Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
This commit is contained in:
Max Brunsfeld 2024-09-16 17:10:57 -07:00 committed by GitHub
parent b54b3d6246
commit bc5ed1334f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 366 additions and 387 deletions

View file

@ -15,7 +15,6 @@ use std::{
sync::{Arc, LazyLock},
};
use tree_sitter::Query;
use tree_sitter_json::language;
use util::{merge_non_null_json_value_into, RangeExt, ResultExt as _};
use crate::{SettingsJsonSchemaParams, WorktreeId};
@ -955,12 +954,17 @@ fn replace_value_in_json_text(
new_value: &serde_json::Value,
) -> (Range<usize>, String) {
static PAIR_QUERY: LazyLock<Query> = LazyLock::new(|| {
Query::new(&language(), "(pair key: (string) @key value: (_) @value)")
.expect("Failed to create PAIR_QUERY")
Query::new(
&tree_sitter_json::LANGUAGE.into(),
"(pair key: (string) @key value: (_) @value)",
)
.expect("Failed to create PAIR_QUERY")
});
let mut parser = tree_sitter::Parser::new();
parser.set_language(&tree_sitter_json::language()).unwrap();
parser
.set_language(&tree_sitter_json::LANGUAGE.into())
.unwrap();
let syntax_tree = parser.parse(text, None).unwrap();
let mut cursor = tree_sitter::QueryCursor::new();