edit prediction: Initial implementation of Tree-sitter index (not yet used) (#38301)

Release Notes:

- N/A

---------

Co-authored-by: Agus <agus@zed.dev>
Co-authored-by: oleksiy <oleksiy@zed.dev>
This commit is contained in:
Michael Sloan
2025-09-17 07:25:14 +00:00
committed by GitHub
co-authored by Agus oleksiy
parent 5d561aa494
commit 64d362cbce
13 changed files with 1186 additions and 18 deletions
+9 -3
View File
@@ -145,7 +145,7 @@ struct BufferBranchState {
/// state of a buffer.
pub struct BufferSnapshot {
pub text: text::BufferSnapshot,
pub(crate) syntax: SyntaxSnapshot,
pub syntax: SyntaxSnapshot,
file: Option<Arc<dyn File>>,
diagnostics: SmallVec<[(LanguageServerId, DiagnosticSet); 2]>,
remote_selections: TreeMap<ReplicaId, SelectionSet>,
@@ -660,7 +660,10 @@ impl HighlightedTextBuilder {
syntax_snapshot: &'a SyntaxSnapshot,
) -> BufferChunks<'a> {
let captures = syntax_snapshot.captures(range.clone(), snapshot, |grammar| {
grammar.highlights_query.as_ref()
grammar
.highlights_config
.as_ref()
.map(|config| &config.query)
});
let highlight_maps = captures
@@ -3246,7 +3249,10 @@ impl BufferSnapshot {
fn get_highlights(&self, range: Range<usize>) -> (SyntaxMapCaptures<'_>, Vec<HighlightMap>) {
let captures = self.syntax.captures(range, &self.text, |grammar| {
grammar.highlights_query.as_ref()
grammar
.highlights_config
.as_ref()
.map(|config| &config.query)
});
let highlight_maps = captures
.grammars()