mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-10 10:35:16 +03:00
Fix broken test.
This commit is contained in:
parent
a65395d94b
commit
8b28bf2533
@ -293,9 +293,28 @@ where
|
|||||||
);
|
);
|
||||||
|
|
||||||
let doc = Rope::from(doc);
|
let doc = Rope::from(doc);
|
||||||
let language_config = crate::syntax::LOADER
|
use crate::syntax::{
|
||||||
.language_config_for_scope("source.rust")
|
Configuration, IndentationConfiguration, Lang, LanguageConfiguration, Loader,
|
||||||
.unwrap();
|
};
|
||||||
|
use once_cell::sync::OnceCell;
|
||||||
|
let loader = Loader::new(Configuration {
|
||||||
|
language: vec![LanguageConfiguration {
|
||||||
|
scope: "source.rust".to_string(),
|
||||||
|
file_types: vec!["rs".to_string()],
|
||||||
|
language_id: Lang::Rust,
|
||||||
|
highlight_config: OnceCell::new(),
|
||||||
|
//
|
||||||
|
path: "../helix-syntax/languages/tree-sitter-rust".into(),
|
||||||
|
roots: vec![],
|
||||||
|
language_server: None,
|
||||||
|
indent: Some(IndentationConfiguration {
|
||||||
|
tab_width: 4,
|
||||||
|
unit: String::from(" "),
|
||||||
|
}),
|
||||||
|
}],
|
||||||
|
});
|
||||||
|
|
||||||
|
let language_config = loader.language_config_for_scope("source.rust").unwrap();
|
||||||
let highlight_config = language_config.highlight_config(&[]).unwrap();
|
let highlight_config = language_config.highlight_config(&[]).unwrap();
|
||||||
let syntax = Syntax::new(&doc, highlight_config.clone());
|
let syntax = Syntax::new(&doc, highlight_config.clone());
|
||||||
let text = doc.slice(..);
|
let text = doc.slice(..);
|
||||||
|
@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct Configuration {
|
pub struct Configuration {
|
||||||
language: Vec<LanguageConfiguration>,
|
pub language: Vec<LanguageConfiguration>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// largely based on tree-sitter/cli/src/loader.rs
|
// largely based on tree-sitter/cli/src/loader.rs
|
||||||
|
Loading…
Reference in New Issue
Block a user