WIP: Add interactions query language feature

Sketch in interaction provider API
Wire interaction data through buffer chunk APIs
This commit is contained in:
Mikayla 2023-08-31 16:31:02 -07:00
parent 166585a2a8
commit ecf8533d28
No known key found for this signature in database
9 changed files with 313 additions and 72 deletions

View file

@ -2,12 +2,25 @@ use gpui::fonts::HighlightStyle;
use std::sync::Arc;
use theme::SyntaxTheme;
use crate::QueryFeatureMap;
#[derive(Clone, Debug)]
pub struct HighlightMap(Arc<[HighlightId]>);
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct HighlightId(pub u32);
impl QueryFeatureMap for HighlightMap {
type Id = HighlightId;
fn get(&self, capture_id: u32) -> HighlightId {
self.0
.get(capture_id as usize)
.copied()
.unwrap_or(DEFAULT_SYNTAX_HIGHLIGHT_ID)
}
}
const DEFAULT_SYNTAX_HIGHLIGHT_ID: HighlightId = HighlightId(u32::MAX);
impl HighlightMap {
@ -41,13 +54,6 @@ impl HighlightMap {
.collect(),
)
}
pub fn get(&self, capture_id: u32) -> HighlightId {
self.0
.get(capture_id as usize)
.copied()
.unwrap_or(DEFAULT_SYNTAX_HIGHLIGHT_ID)
}
}
impl HighlightId {