minor: Simplify Document.language_id()

imgbot
Blaž Hrastnik 2 years ago
parent b14c258a2c
commit 3d9923969a
No known key found for this signature in database
GPG Key ID: 1238B9C4AD889640

@ -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))
}

Loading…
Cancel
Save