diff options
Diffstat (limited to 'helix-view')
-rw-r--r-- | helix-view/src/document.rs | 11 | ||||
-rw-r--r-- | helix-view/src/editor.rs | 1 |
2 files changed, 11 insertions, 1 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; diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 9a2b4297..c4e9ec28 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -448,7 +448,6 @@ impl Editor { /// Refreshes the language server for a given document pub fn refresh_language_server(&mut self, doc_id: DocumentId) -> Option<()> { let doc = self.documents.get_mut(&doc_id)?; - doc.detect_language(self.syn_loader.clone()); Self::launch_language_server(&mut self.language_servers, doc) } |