Skip to content

Commit

Permalink
Fix Document::language_id returning None if there is no lang server
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathspy committed Jul 7, 2022
1 parent e9283b2 commit 24a0941
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions helix-view/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -854,12 +854,12 @@ impl Document {
/// `language-server` configuration, or the document language if no
/// `language-id` has been specified.
pub fn language_id(&self) -> Option<&str> {
self.language_config()?
let config = self.language_config()?;
config
.language_server
.as_ref()?
.language_id
.as_deref()
.or_else(|| Some(self.language()?.rsplit_once('.')?.1))
.as_ref()
.and_then(|server| server.language_id.as_deref())
.or(Some(&config.language_id))
}

/// Corresponding [`LanguageConfiguration`].
Expand Down

0 comments on commit 24a0941

Please sign in to comment.