WIP: Add interactions query language feature
Sketch in interaction provider API Wire interaction data through buffer chunk APIs
This commit is contained in:
parent
166585a2a8
commit
ecf8533d28
9 changed files with 313 additions and 72 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue