Skip to content

Commit

Permalink
Simplify TextObject cell init
Browse files Browse the repository at this point in the history
  • Loading branch information
sudormrfbin committed Oct 6, 2021
1 parent 5ea3f6f commit 361841c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,11 @@ impl LanguageConfiguration {
pub fn textobject_query(&self) -> Option<&TextObjectQuery> {
self.textobject_query
.get_or_init(|| {
let language = self.language_id.to_ascii_lowercase();
let query = read_query(&language, "textobjects.scm");
self.highlight_config
.get()
.and_then(|config| config.as_ref().map(|c| c.language))
.and_then(move |lang| Query::new(lang, &query).ok())
.map(|query| TextObjectQuery { query })
let lang_name = self.language_id.to_ascii_lowercase();
let query_text = read_query(&lang_name, "textobjects.scm");
let lang = self.highlight_config.get()?.as_ref()?.language;
let query = Query::new(lang, &query_text).ok()?;
Some(TextObjectQuery { query })
})
.as_ref()
}
Expand Down

0 comments on commit 361841c

Please sign in to comment.