on master help sign in
Remove old test.
commit1303ffd94ab4fcedc2d1b63107e4ccf6c07d3465 authorBlaž Hrastnik <blaz@mxxn.io> dateSat 19 Sep 2020, 11:57 (6 years ago) parent91343a6
2 files changed−76
helix-term/src/editor.rs−75 helix-term/src/main.rs−1
helix-term/src/editor.rs−75
@@ -436,78 +436,3 @@ impl Editor {
436436// }
437437// end => scopes.pop()
438438// }
439−#[test]
440−fn test_parser() {
441− use helix_core::syntax::{HighlightConfiguration, HighlightEvent, Highlighter};
442−
443− let source_code = include_str!("../test.rs");
444−
445− let highlight_names: Vec<String> = [
446− "attribute",
447− "constant",
448− "function.builtin",
449− "function",
450− "keyword",
451− "operator",
452− "property",
453− "punctuation",
454− "punctuation.bracket",
455− "punctuation.delimiter",
456− "string",
457− "string.special",
458− "tag",
459− "type",
460− "type.builtin",
461− "variable",
462− "variable.builtin",
463− "variable.parameter",
464− ]
465− .iter()
466− .cloned()
467− .map(String::from)
468− .collect();
469−
470− let language = helix_syntax::get_language(&helix_syntax::LANG::Rust);
471− // let mut parser = tree_sitter::Parser::new();
472− // parser.set_language(language).unwrap();
473− // let tree = parser.parse(source_code, None).unwrap();
474−
475− let mut highlighter = Highlighter::new();
476−
477− let mut config = HighlightConfiguration::new(
478− language,
479− &std::fs::read_to_string(
480− "../helix-syntax/languages/tree-sitter-rust/queries/highlights.scm",
481− )
482− .unwrap(),
483− &std::fs::read_to_string(
484− "../helix-syntax/languages/tree-sitter-rust/queries/injections.scm",
485− )
486− .unwrap(),
487− "", // locals.scm
488− )
489− .unwrap();
490−
491− config.configure(&highlight_names);
492−
493− let highlights = highlighter
494− .highlight(&config, source_code.as_bytes(), None, |_| None)
495− .unwrap();
496−
497− for event in highlights {
498− match event.unwrap() {
499− HighlightEvent::Source { start, end } => {
500− eprintln!("source: {}-{}", start, end);
501− // iterate over range char by char
502− }
503− HighlightEvent::HighlightStart(s) => {
504− eprintln!("highlight style started: {:?}", highlight_names[s.0]);
505− // store/push highlight styles
506− }
507− HighlightEvent::HighlightEnd => {
508− eprintln!("highlight style ended");
509− // pop highlight styles
510− }
511− }
512− }
513−}
helix-term/src/main.rs−1
@@ -23,7 +23,6 @@ static EX: smol::Executor = smol::Executor::new();
2323
2424fn main() -> Result<(), Error> {
2525 let args: Args = argh::from_env();
26− println!("{:?}", args.files);
2726
2827 for _ in 0..num_cpus::get() {
2928 std::thread::spawn(move || smol::block_on(EX.run(smol::future::pending::<()>())));