|
|
@ -1,4 +1,10 @@
|
|
|
|
use crate::{chars::char_is_line_ending, regex::Regex, Change, Rope, RopeSlice, Transaction};
|
|
|
|
use crate::{
|
|
|
|
|
|
|
|
chars::char_is_line_ending,
|
|
|
|
|
|
|
|
regex::Regex,
|
|
|
|
|
|
|
|
transaction::{ChangeSet, Operation},
|
|
|
|
|
|
|
|
Rope, RopeSlice, Tendril,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
pub use helix_syntax::{get_language, get_language_name, Lang};
|
|
|
|
pub use helix_syntax::{get_language, get_language_name, Lang};
|
|
|
|
|
|
|
|
|
|
|
|
use arc_swap::ArcSwap;
|
|
|
|
use arc_swap::ArcSwap;
|
|
|
@ -8,7 +14,7 @@ use std::{
|
|
|
|
cell::RefCell,
|
|
|
|
cell::RefCell,
|
|
|
|
collections::{HashMap, HashSet},
|
|
|
|
collections::{HashMap, HashSet},
|
|
|
|
fmt,
|
|
|
|
fmt,
|
|
|
|
path::{Path, PathBuf},
|
|
|
|
path::Path,
|
|
|
|
sync::Arc,
|
|
|
|
sync::Arc,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -473,12 +479,6 @@ pub struct LanguageLayer {
|
|
|
|
pub(crate) tree: Option<Tree>,
|
|
|
|
pub(crate) tree: Option<Tree>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
use crate::{
|
|
|
|
|
|
|
|
coords_at_pos,
|
|
|
|
|
|
|
|
transaction::{ChangeSet, Operation},
|
|
|
|
|
|
|
|
Tendril,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl LanguageLayer {
|
|
|
|
impl LanguageLayer {
|
|
|
|
// pub fn new() -> Self {
|
|
|
|
// pub fn new() -> Self {
|
|
|
|
// Self { tree: None }
|
|
|
|
// Self { tree: None }
|
|
|
@ -1776,8 +1776,13 @@ impl<I: Iterator<Item = HighlightEvent>> Iterator for Merge<I> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[cfg(test)]
|
|
|
|
fn test_parser() {
|
|
|
|
mod test {
|
|
|
|
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
use crate::{Rope, Transaction};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
|
|
fn test_parser() {
|
|
|
|
let highlight_names: Vec<String> = [
|
|
|
|
let highlight_names: Vec<String> = [
|
|
|
|
"attribute",
|
|
|
|
"attribute",
|
|
|
|
"constant",
|
|
|
|
"constant",
|
|
|
@ -1841,10 +1846,10 @@ fn test_parser() {
|
|
|
|
|
|
|
|
|
|
|
|
let struct_node = root.child(0).unwrap();
|
|
|
|
let struct_node = root.child(0).unwrap();
|
|
|
|
assert_eq!(struct_node.kind(), "struct_item");
|
|
|
|
assert_eq!(struct_node.kind(), "struct_item");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_input_edits() {
|
|
|
|
fn test_input_edits() {
|
|
|
|
use crate::State;
|
|
|
|
use crate::State;
|
|
|
|
use tree_sitter::InputEdit;
|
|
|
|
use tree_sitter::InputEdit;
|
|
|
|
|
|
|
|
|
|
|
@ -1897,14 +1902,15 @@ fn test_input_edits() {
|
|
|
|
new_end_position: Point { row: 0, column: 14 }
|
|
|
|
new_end_position: Point { row: 0, column: 14 }
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_load_runtime_file() {
|
|
|
|
fn test_load_runtime_file() {
|
|
|
|
// Test to make sure we can load some data from the runtime directory.
|
|
|
|
// Test to make sure we can load some data from the runtime directory.
|
|
|
|
let contents = load_runtime_file("rust", "indents.toml").unwrap();
|
|
|
|
let contents = load_runtime_file("rust", "indents.toml").unwrap();
|
|
|
|
assert!(!contents.is_empty());
|
|
|
|
assert!(!contents.is_empty());
|
|
|
|
|
|
|
|
|
|
|
|
let results = load_runtime_file("rust", "does-not-exist");
|
|
|
|
let results = load_runtime_file("rust", "does-not-exist");
|
|
|
|
assert!(results.is_err());
|
|
|
|
assert!(results.is_err());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|