Skip to content

Commit

Permalink
minor: Simplify Document.language_id()
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Jun 6, 2022
1 parent b14c258 commit 3d99239
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions helix-view/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -854,9 +854,11 @@ 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()
.and_then(|config| config.language_server.as_ref())
.and_then(|lsp_config| lsp_config.language_id.as_deref())
self.language_config()?
.language_server
.as_ref()?
.language_id
.as_deref()
.or_else(|| Some(self.language()?.rsplit_once('.')?.1))
}

Expand Down

0 comments on commit 3d99239

Please sign in to comment.