@@ -19,7 +19,7 @@ use helix_core::{
20use helix_lsp::util::LspFormatting;
20use helix_lsp::util::LspFormatting;
22−use crate::{DocumentId, Theme, ViewId};
22+use crate::{DocumentId, ViewId};
24/// 8kB of buffer space for encoding and decoding `Rope`s.
24/// 8kB of buffer space for encoding and decoding `Rope`s.
25const BUF_SIZE: usize = 8192;
25const BUF_SIZE: usize = 8192;
@@ -358,7 +358,6 @@ impl Document {
358 pub fn open(
358 pub fn open(
359 path: &Path,
359 path: &Path,
360 encoding: Option<&'static encoding::Encoding>,
360 encoding: Option<&'static encoding::Encoding>,
361− theme: Option<&Theme>,
362 config_loader: Option<Arc<syntax::Loader>>,
361 config_loader: Option<Arc<syntax::Loader>>,
363 ) -> Result<Self, Error> {
362 ) -> Result<Self, Error> {
364 // Open the file if it exists, otherwise assume it is a new file (and thus empty).
363 // Open the file if it exists, otherwise assume it is a new file (and thus empty).
@@ -376,7 +375,7 @@ impl Document {
376 // set the path and try detecting the language
375 // set the path and try detecting the language
377 doc.set_path(Some(path))?;
376 doc.set_path(Some(path))?;
378 if let Some(loader) = config_loader {
377 if let Some(loader) = config_loader {
379− doc.detect_language(theme, loader);
378+ doc.detect_language(loader);
382 doc.detect_indent_and_line_ending();
381 doc.detect_indent_and_line_ending();
@@ -498,12 +497,12 @@ impl Document {
500 /// Detect the programming language based on the file type.
499 /// 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>) {
502 if let Some(path) = &self.path {
501 if let Some(path) = &self.path {
503 let language_config = config_loader
502 let language_config = config_loader
504 .language_config_for_file_name(path)
503 .language_config_for_file_name(path)
505 .or_else(|| config_loader.language_config_for_shebang(self.text()));
504 .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));
@@ -577,16 +576,13 @@ impl Document {
577 /// if it exists.
576 /// if it exists.
578 pub fn set_language(
577 pub fn set_language(
579 &mut self,
578 &mut self,
580− theme: Option<&Theme>,
581 language_config: Option<Arc<helix_core::syntax::LanguageConfiguration>>,
579 language_config: Option<Arc<helix_core::syntax::LanguageConfiguration>>,
582 loader: Option<Arc<helix_core::syntax::Loader>>,
580 loader: Option<Arc<helix_core::syntax::Loader>>,
584 if let (Some(language_config), Some(loader)) = (language_config, loader) {
582 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()) {
587 let syntax = Syntax::new(&self.text, highlight_config, loader);
584 let syntax = Syntax::new(&self.text, highlight_config, loader);
588 self.syntax = Some(syntax);
585 self.syntax = Some(syntax);
589− // TODO: config.configure(scopes) is now delayed, is that ok?
592 self.language = Some(language_config);
588 self.language = Some(language_config);
@@ -601,12 +597,11 @@ impl Document {
601 pub fn set_language2(
597 pub fn set_language2(
602 &mut self,
598 &mut self,
603 scope: &str,
599 scope: &str,
604− theme: Option<&Theme>,
605 config_loader: Arc<syntax::Loader>,
600 config_loader: Arc<syntax::Loader>,
607 let language_config = config_loader.language_config_for_scope(scope);
602 let language_config = config_loader.language_config_for_scope(scope);
609− self.set_language(theme, language_config, Some(config_loader));
604+ self.set_language(language_config, Some(config_loader));
612 /// Set the LSP.
607 /// Set the LSP.