mirror of https://github.com/helix-editor/helix
chore: remove pointless language
parent
d7bb5e9233
commit
83271b98d8
|
@ -40,37 +40,6 @@ pub fn highlighted_code_block<'a>(
|
|||
let mut lines = Vec::new();
|
||||
|
||||
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.
|
||||
// These render selections as if in the real editor.
|
||||
|
@ -133,6 +102,38 @@ pub fn highlighted_code_block<'a>(
|
|||
}
|
||||
}
|
||||
} 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();
|
||||
for event in highlight_iter {
|
||||
match event {
|
||||
|
|
|
@ -4077,15 +4077,3 @@ indent = { tab-width = 4, unit = " " }
|
|||
[[grammar]]
|
||||
name = "gren"
|
||||
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" }
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
; this file simply needs to exist
|
Loading…
Reference in New Issue