Start on autoclosing pairs

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-10-06 16:34:57 +02:00
parent 3cb7ba0f57
commit 05d7e9c4e7
6 changed files with 174 additions and 3 deletions

View file

@ -11,6 +11,13 @@ pub use tree_sitter::{Parser, Tree};
pub struct LanguageConfig {
pub name: String,
pub path_suffixes: Vec<String>,
pub autoclose_pairs: Vec<AutoclosePair>,
}
#[derive(Clone, Deserialize)]
pub struct AutoclosePair {
pub start: String,
pub end: String,
}
pub struct Language {
@ -81,6 +88,10 @@ impl Language {
self.config.name.as_str()
}
pub fn autoclose_pairs(&self) -> &[AutoclosePair] {
&self.config.autoclose_pairs
}
pub fn highlight_map(&self) -> HighlightMap {
self.highlight_map.lock().clone()
}