1
0
Fork 0
mirror of https://github.com/helix-editor/helix synced 2024-05-09 00:06:05 +02:00

Compare commits

...

9 Commits

Author SHA1 Message Date
Daniel 7973206efa
Merge 9857b516dc into 5ee7411450 2024-04-26 21:01:20 -04:00
Diogenesoftoronto 5ee7411450
Change cursor color per mode for default (#10608) 2024-04-26 16:50:29 -05:00
Keir Lawson 31248d4e2f
Enable metals inlay hints (#10597) 2024-04-26 16:48:23 -05:00
David Else 109f53fb60
Add debug highlights to the dark plus theme (#10593) 2024-04-25 07:48:14 -05:00
Daniel 9857b516dc Update editor.rs 2023-12-18 22:54:29 +11:00
Daniel 31ce84fef2 Works 2023-12-18 22:38:31 +11:00
Daniel 27aed73abb Update lsp.rs 2023-12-18 21:54:16 +11:00
Daniel 73a8622332 Update lsp.rs 2023-12-18 20:06:33 +11:00
Daniel 8d231bafd0 Update lsp.rs 2023-12-18 19:41:27 +11:00
5 changed files with 60 additions and 2 deletions

View File

@ -35,7 +35,7 @@
use std::{
cmp::Ordering,
collections::{BTreeMap, HashSet},
collections::{BTreeMap, HashMap, HashSet},
fmt::Write,
future::Future,
path::{Path, PathBuf},
@ -1315,6 +1315,36 @@ fn compute_inlay_hints_for_view(
}
}
let vimmise_inlays = |hints: &mut Vec<InlineAnnotation>, prefix| {
hints.iter_mut().map(|it| {
it.char_idx = helix_core::line_ending::line_end_char_index(&doc_text.slice(..), doc_text.char_to_line(it.char_idx));
(it.char_idx, it)
}).fold(HashMap::<usize, Vec<&mut InlineAnnotation>>::new(), |mut map, (id, annot)| {
match map.get_mut(&id) {
Some(v) => v.push(annot),
None => {map.insert(id, vec![annot]);}
};
map
}).into_iter().for_each(|(_, mut v)| {
v[0].text.insert_str(0, prefix);
v.iter_mut().for_each(|s| s.text.push_str(","));
let last = v.last_mut().unwrap();
last.text.truncate(last.text.len() - 1);
});
};
{
let cfg = doc.config.load();
let vim_cfg = &cfg.lsp.vim_inlay_hints;
if vim_cfg.enable {
vimmise_inlays(&mut type_inlay_hints, vim_cfg.type_inlay_prefix.as_str());
vimmise_inlays(&mut parameter_inlay_hints, vim_cfg.parameter_inlay_prefix.as_str());
vimmise_inlays(&mut other_inlay_hints, vim_cfg.other_inlay_prefix.as_str());
padding_after_inlay_hints = vec![];
padding_before_inlay_hints = vec![];
}
}
doc.set_inlay_hints(
view_id,
DocumentInlayHints {
@ -1326,6 +1356,7 @@ fn compute_inlay_hints_for_view(
padding_after_inlay_hints,
},
);
doc.inlay_hints_oudated = false;
},
);

View File

@ -407,6 +407,25 @@ pub fn get_terminal_provider() -> Option<TerminalConfig> {
None
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(default, rename_all = "kebab-case", deny_unknown_fields)]
pub struct VimInlayConfig {
pub enable: bool,
pub type_inlay_prefix: String,
pub parameter_inlay_prefix: String,
pub other_inlay_prefix: String,
}
impl Default for VimInlayConfig {
fn default() -> Self {
Self {
enable: false,
type_inlay_prefix: String::from(" -> "),
parameter_inlay_prefix: String::from(" <- "),
other_inlay_prefix: String::from(" - "),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(default, rename_all = "kebab-case", deny_unknown_fields)]
pub struct LspConfig {
@ -420,6 +439,8 @@ pub struct LspConfig {
pub display_signature_help_docs: bool,
/// Display inlay hints
pub display_inlay_hints: bool,
/// Vim-style inlay hints
pub vim_inlay_hints: VimInlayConfig,
/// Whether to enable snippet support
pub snippets: bool,
/// Whether to include declaration in the goto reference query
@ -434,6 +455,7 @@ fn default() -> Self {
auto_signature_help: true,
display_signature_help_docs: true,
display_inlay_hints: false,
vim_inlay_hints: VimInlayConfig::default(),
snippets: true,
goto_reference_include_declaration: true,
}

View File

@ -53,7 +53,7 @@ ltex-ls = { command = "ltex-ls" }
markdoc-ls = { command = "markdoc-ls", args = ["--stdio"] }
markdown-oxide = { command = "markdown-oxide" }
marksman = { command = "marksman", args = ["server"] }
metals = { command = "metals", config = { "isHttpEnabled" = true } }
metals = { command = "metals", config = { "isHttpEnabled" = true, metals = { inlayHints = { typeParameters = {enable = true} , hintsInPatternMatch = {enable = true} } } } }
mint = { command = "mint", args = ["ls"] }
nil = { command = "nil" }
nimlangserver = { command = "nimlangserver" }

View File

@ -77,6 +77,9 @@
"ui.virtual.indent-guide" = { fg = "dark_gray4" }
"ui.virtual.inlay-hint" = { fg = "dark_gray5"}
"ui.virtual.jump-label" = { fg = "dark_gray", modifiers = ["bold"] }
"ui.highlight.frameline" = { bg = "#4b4b18" }
"ui.debug.active" = { fg = "#ffcc00" }
"ui.debug.breakpoint" = { fg = "#e51400" }
"warning" = { fg = "gold2" }
"error" = { fg = "red" }
"info" = { fg = "light_blue" }

View File

@ -66,6 +66,8 @@ label = "honey"
# TODO: namespace ui.cursor as ui.selection.cursor?
"ui.cursor.select" = { bg = "delta" }
"ui.cursor.insert" = { bg = "white" }
"ui.cursor.primary.select" = { bg = "delta" }
"ui.cursor.primary.insert" = { bg = "white" }
"ui.cursor.match" = { fg = "#212121", bg = "#6C6999" }
"ui.cursor" = { modifiers = ["reversed"] }
"ui.cursorline.primary" = { bg = "bossanova" }