Compare commits

...

4 Commits

Author SHA1 Message Date
Erasin Wang
77bd97ea5c
Merge 2ffb5eaf85 into f305c7299d 2024-11-21 23:32:29 +03:00
Lens0021 / Leslie
f305c7299d
Add support for Amber-lang (#12021)
Co-authored-by: Phoenix Himself <pkaras.it@gmail.com>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2024-11-21 10:09:42 -06:00
Valentin B.
9e0d2d0a19
chore(solidity): add highlight queries (#12102)
Add highlights for `hex` and `unicode` string prefixes and YUL booleans
2024-11-21 07:58:14 -06:00
Erasin
2ffb5eaf85 Add commandline = false
Hide commandline
2024-07-18 20:08:16 +08:00
8 changed files with 102 additions and 16 deletions

View File

@ -44,6 +44,7 @@ ### `[editor]` Section
| `undercurl` | Set to `true` to override automatic detection of terminal undercurl support in the event of a false negative | `false` |
| `rulers` | List of column positions at which to display the rulers. Can be overridden by language specific `rulers` in `languages.toml` file | `[]` |
| `bufferline` | Renders a line at the top of the editor displaying open buffers. Can be `always`, `never` or `multiple` (only shown if more than one buffer is in use) | `never` |
| `commandline` | CommandLine Display. | `true` |
| `color-modes` | Whether to color the mode indicator with different colors depending on the mode itself | `false` |
| `text-width` | Maximum line length. Used for the `:reflow` command and soft-wrapping if `soft-wrap.wrap-at-text-width` is set | `80` |
| `workspace-lsp-roots` | Directories relative to the workspace root that are treated as LSP roots. Should only be set in `.helix/config.toml` | `[]` |

View File

@ -3,6 +3,7 @@
| ada | ✓ | ✓ | | `ada_language_server` |
| adl | ✓ | ✓ | ✓ | |
| agda | ✓ | | | |
| amber | ✓ | | | |
| astro | ✓ | | | |
| awk | ✓ | ✓ | | `awk-language-server` |
| bash | ✓ | ✓ | ✓ | `bash-language-server` |

View File

@ -235,7 +235,7 @@ pub fn render_view(
let statusline_area = view
.area
.clip_top(view.area.height.saturating_sub(1))
.clip_bottom(1); // -1 from bottom to remove commandline
.clip_bottom(config.commandline as u16); // -1 from bottom to remove commandline
let mut context =
statusline::RenderContext::new(editor, doc, view, is_focused, &self.spinners);
@ -1486,11 +1486,13 @@ fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
_ => false,
};
// -1 for commandline and -1 for bufferline
let mut editor_area = area.clip_bottom(1);
if use_bufferline {
editor_area = editor_area.clip_top(1);
let editor_area = if use_bufferline {
// -1 for bufferline
area.clip_top(1)
} else {
area
}
.clip_bottom(config.commandline as u16); // -1 for commandline
// if the terminal size suddenly changed, we need to trigger a resize
cx.editor.resize(editor_area);
@ -1514,6 +1516,9 @@ fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
let key_width = 15u16; // for showing pending keys
let mut status_msg_width = 0;
// commandline
let commandline_msg_pos = if config.commandline { 1 } else { 2 };
// render status msg
if let Some((status_msg, severity)) = &cx.editor.status_msg {
status_msg_width = status_msg.width();
@ -1526,7 +1531,7 @@ fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
surface.set_string(
area.x,
area.y + area.height.saturating_sub(1),
area.y + area.height.saturating_sub(commandline_msg_pos),
status_msg,
style,
);
@ -1551,7 +1556,7 @@ fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
};
surface.set_string(
area.x + area.width.saturating_sub(key_width + macro_width),
area.y + area.height.saturating_sub(1),
area.y + area.height.saturating_sub(commandline_msg_pos),
disp.get(disp.len().saturating_sub(key_width as usize)..)
.unwrap_or(&disp),
style,
@ -1563,7 +1568,7 @@ fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
.add_modifier(Modifier::BOLD);
surface.set_string(
area.x + area.width.saturating_sub(3),
area.y + area.height.saturating_sub(1),
area.y + area.height.saturating_sub(commandline_msg_pos),
&disp,
style,
);

View File

@ -138,6 +138,8 @@ pub fn raw_regex_prompt(
doc.set_selection(view.id, snapshot.clone());
doc.set_view_offset(view.id, offset_snapshot);
let commandline = config.commandline as usize;
if event == PromptEvent::Validate {
let callback = async move {
let call: job::Callback = Callback::EditorCompositor(Box::new(
@ -146,7 +148,7 @@ pub fn raw_regex_prompt(
let size = compositor.size();
let popup = Popup::new("invalid-regex", contents)
.position(Some(helix_core::Position::new(
size.height as usize - 2, // 2 = statusline + commandline
size.height as usize - 1 - commandline, // = statusline + commandline
0,
)))
.auto_close(true);

View File

@ -321,6 +321,8 @@ pub struct Config {
pub whitespace: WhitespaceConfig,
/// Persistently display open buffers along the top
pub bufferline: BufferLine,
/// Commandline display, Default true.
pub commandline: bool,
/// Vertical indent width guides.
pub indent_guides: IndentGuidesConfig,
/// Whether to color modes with different colors. Defaults to `false`.
@ -971,6 +973,7 @@ fn default() -> Self {
rulers: Vec::new(),
whitespace: WhitespaceConfig::default(),
bufferline: BufferLine::default(),
commandline: true,
indent_guides: IndentGuidesConfig::default(),
color_modes: false,
soft_wrap: SoftWrap {
@ -1165,7 +1168,7 @@ pub fn new(
let auto_pairs = (&conf.auto_pairs).into();
// HAXX: offset the render area height by 1 to account for prompt/commandline
area.height -= 1;
area.height -= conf.commandline as u16;
Self {
mode: Mode::Normal,

View File

@ -3931,3 +3931,14 @@ indent = { tab-width = 4, unit = " " }
[[grammar]]
name = "spade"
source = { git = "https://gitlab.com/spade-lang/tree-sitter-spade/", rev = "4d5b141017c61fe7e168e0a5c5721ee62b0d9572" }
[[language]]
name = "amber"
scope = "source.ab"
file-types = ["ab"]
comment-token = "//"
indent = { tab-width = 4, unit = " " }
[[grammar]]
name = "amber"
source = { git = "https://github.com/amber-lang/tree-sitter-amber", rev = "c6df3ec2ec243ed76550c525e7ac3d9a10c6c814" }

View File

@ -0,0 +1,60 @@
(comment) @comment
[
"if"
"loop"
"for"
"return"
"fun"
"else"
"then"
"break"
"continue"
"and"
"or"
"not"
"let"
"pub"
"main"
"echo"
"exit"
"fun"
"import"
"from"
"as"
"in"
"fail"
"failed"
"silent"
"nameof"
"is"
"unsafe"
"trust"
] @keyword
; Literals
(boolean) @constant.builtin.boolean
(number) @constant.numeric
(null) @constant.numeric
(string) @string
(status) @keyword
(command) @string
(handler) @keyword
(block) @punctuation.delimiter
(variable_init) @keyword
(variable_assignment) @punctuation.delimiter
(variable) @variable
(escape_sequence) @constant.character.escape
(type_name_symbol) @type
(interpolation) @punctuation.delimiter
(reference) @keyword
(preprocessor_directive) @comment
(shebang) @comment
(function_definition
name: (variable) @function.method)
(function_call
name: (variable) @function.method)
(import_statement
"pub" @keyword
"import" @keyword
"from" @keyword)

View File

@ -12,6 +12,8 @@
(unicode_string_literal)
(yul_string_literal)
] @string
(hex_string_literal "hex" @string.special.symbol)
(unicode_string_literal "unicode" @string.special.symbol)
[
(number_literal)
(yul_decimal_number)
@ -20,6 +22,7 @@
[
(true)
(false)
(yul_boolean)
] @constant.builtin.boolean
(comment) @comment
@ -44,18 +47,18 @@
(type_name "(" @punctuation.bracket "=>" @punctuation.delimiter ")" @punctuation.bracket)
; Definitions
(struct_declaration
(struct_declaration
name: (identifier) @type)
(enum_declaration
(enum_declaration
name: (identifier) @type)
(contract_declaration
name: (identifier) @type)
name: (identifier) @type)
(library_declaration
name: (identifier) @type)
name: (identifier) @type)
(interface_declaration
name: (identifier) @type)
(event_definition
name: (identifier) @type)
(event_definition
name: (identifier) @type)
(function_definition
name: (identifier) @function)