chore: remove pointless language

pull/12706/head
Nikita Revenco 2025-01-28 13:05:37 +00:00
parent d7bb5e9233
commit 83271b98d8
3 changed files with 32 additions and 44 deletions

View File

@ -40,37 +40,6 @@ pub fn highlighted_code_block<'a>(
let mut lines = Vec::new(); let mut lines = Vec::new();
let get_theme = |key: &str| -> Style { theme.map(|t| t.get(key)).unwrap_or_default() }; let get_theme = |key: &str| -> Style { theme.map(|t| t.get(key)).unwrap_or_default() };
let text_style = get_theme(Markdown::TEXT_STYLE);
let code_style = get_theme(Markdown::BLOCK_STYLE);
let theme = match theme {
Some(t) => t,
None => return styled_multiline_text(text, code_style),
};
let ropeslice = RopeSlice::from(text);
let syntax = config_loader
.load()
.language_configuration_for_injection_string(&InjectionLanguageMarker::Name(
language.into(),
))
.and_then(|config| config.highlight_config(theme.scopes()))
.and_then(|config| Syntax::new(ropeslice, config, Arc::clone(&config_loader)));
let syntax = match syntax {
Some(s) => s,
None => return styled_multiline_text(text, code_style),
};
let highlight_iter = syntax
.highlight_iter(ropeslice, None, None)
.map(|e| e.unwrap());
let highlight_iter: Box<dyn Iterator<Item = HighlightEvent>> =
if let Some(spans) = additional_highlight_spans {
Box::new(helix_core::syntax::merge(highlight_iter, spans))
} else {
Box::new(highlight_iter)
};
// Apply custom rendering rules to Helix code blocks. // Apply custom rendering rules to Helix code blocks.
// These render selections as if in the real editor. // These render selections as if in the real editor.
@ -133,6 +102,38 @@ pub fn highlighted_code_block<'a>(
} }
} }
} else { } else {
let text_style = get_theme(Markdown::TEXT_STYLE);
let code_style = get_theme(Markdown::BLOCK_STYLE);
let theme = match theme {
Some(t) => t,
None => return styled_multiline_text(text, code_style),
};
let ropeslice = RopeSlice::from(text);
let syntax = config_loader
.load()
.language_configuration_for_injection_string(&InjectionLanguageMarker::Name(
language.into(),
))
.and_then(|config| config.highlight_config(theme.scopes()))
.and_then(|config| Syntax::new(ropeslice, config, Arc::clone(&config_loader)));
let syntax = match syntax {
Some(s) => s,
None => return styled_multiline_text(text, code_style),
};
let highlight_iter = syntax
.highlight_iter(ropeslice, None, None)
.map(|e| e.unwrap());
let highlight_iter: Box<dyn Iterator<Item = HighlightEvent>> =
if let Some(spans) = additional_highlight_spans {
Box::new(helix_core::syntax::merge(highlight_iter, spans))
} else {
Box::new(highlight_iter)
};
let mut highlights = Vec::new(); let mut highlights = Vec::new();
for event in highlight_iter { for event in highlight_iter {
match event { match event {

View File

@ -4077,15 +4077,3 @@ indent = { tab-width = 4, unit = " " }
[[grammar]] [[grammar]]
name = "gren" name = "gren"
source = { git = "https://github.com/MaeBrooks/tree-sitter-gren", rev = "76554f4f2339f5a24eed19c58f2079b51c694152" } source = { git = "https://github.com/MaeBrooks/tree-sitter-gren", rev = "76554f4f2339f5a24eed19c58f2079b51c694152" }
# this is just a dummy language, it's entry simply needs to exist
# but it doesn't matter what these values are as we are using a custom renderer
[[language]]
name = "helix"
scope = "source.helix"
injection-regex = "helix"
file-types = ["helix"]
[[grammar]]
name = "helix"
source = { git = "https://github.com/MaeBrooks/tree-sitter-gren", rev = "76554f4f2339f5a24eed19c58f2079b51c694152" }

View File

@ -1 +0,0 @@
; this file simply needs to exist