aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/document.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/document.rs')
-rw-r--r--helix-view/src/document.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index c9c1e502..5d739af5 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -607,6 +607,17 @@ impl Document {
self.set_language(language_config, Some(config_loader));
}
+ /// Set the programming language for the file if you know the language but don't have the
+ /// [`syntax::LanguageConfiguration`] for it.
+ pub fn set_language_by_language_id(
+ &mut self,
+ language_id: &str,
+ config_loader: Arc<syntax::Loader>,
+ ) {
+ let language_config = config_loader.language_config_for_language_id(language_id);
+ self.set_language(language_config, Some(config_loader));
+ }
+
/// Set the LSP.
pub fn set_language_server(&mut self, language_server: Option<Arc<helix_lsp::Client>>) {
self.language_server = language_server;