@@ -19,7 +19,7 @@ use helix_core::{
1919};
2020use helix_lsp::util::LspFormatting;
2121
22−use crate::{DocumentId, Theme, ViewId};
22+use crate::{DocumentId, ViewId};
2323
2424/// 8kB of buffer space for encoding and decoding `Rope`s.
2525const BUF_SIZE: usize = 8192;
@@ -358,7 +358,6 @@ impl Document {
358358 pub fn open(
359359 path: &Path,
360360 encoding: Option<&'static encoding::Encoding>,
361− theme: Option<&Theme>,
362361 config_loader: Option<Arc<syntax::Loader>>,
363362 ) -> Result<Self, Error> {
364363 // Open the file if it exists, otherwise assume it is a new file (and thus empty).
@@ -376,7 +375,7 @@ impl Document {
376375 // set the path and try detecting the language
377376 doc.set_path(Some(path))?;
378377 if let Some(loader) = config_loader {
379− doc.detect_language(theme, loader);
378+ doc.detect_language(loader);
380379 }
381380
382381 doc.detect_indent_and_line_ending();
@@ -498,12 +497,12 @@ impl Document {
498497 }
499498
500499 /// Detect the programming language based on the file type.
501− pub fn detect_language(&mut self, theme: Option<&Theme>, config_loader: Arc<syntax::Loader>) {
500+ pub fn detect_language(&mut self, config_loader: Arc<syntax::Loader>) {
502501 if let Some(path) = &self.path {
503502 let language_config = config_loader
504503 .language_config_for_file_name(path)
505504 .or_else(|| config_loader.language_config_for_shebang(self.text()));
506− self.set_language(theme, language_config, Some(config_loader));
505+ self.set_language(language_config, Some(config_loader));
507506 }
508507 }
509508
@@ -577,16 +576,13 @@ impl Document {
577576 /// if it exists.
578577 pub fn set_language(
579578 &mut self,
580− theme: Option<&Theme>,
581579 language_config: Option<Arc<helix_core::syntax::LanguageConfiguration>>,
582580 loader: Option<Arc<helix_core::syntax::Loader>>,
583581 ) {
584582 if let (Some(language_config), Some(loader)) = (language_config, loader) {
585− let scopes = theme.map(|theme| theme.scopes()).unwrap_or(&[]);
586− if let Some(highlight_config) = language_config.highlight_config(scopes) {
583+ if let Some(highlight_config) = language_config.highlight_config(&loader.scopes()) {
587584 let syntax = Syntax::new(&self.text, highlight_config, loader);
588585 self.syntax = Some(syntax);
589− // TODO: config.configure(scopes) is now delayed, is that ok?
590586 }
591587
592588 self.language = Some(language_config);
@@ -601,12 +597,11 @@ impl Document {
601597 pub fn set_language2(
602598 &mut self,
603599 scope: &str,
604− theme: Option<&Theme>,
605600 config_loader: Arc<syntax::Loader>,
606601 ) {
607602 let language_config = config_loader.language_config_for_scope(scope);
608603
609− self.set_language(theme, language_config, Some(config_loader));
604+ self.set_language(language_config, Some(config_loader));
610605 }
611606
612607 /// Set the LSP.