pull/9109/head
Daniel 11 months ago
parent 27aed73abb
commit 31ce84fef2

@ -1654,11 +1654,17 @@ fn compute_inlay_hints_for_view(
}); });
}; };
vimmise_inlays(&mut type_inlay_hints, " => "); {
vimmise_inlays(&mut parameter_inlay_hints, " <= "); let cfg = doc.config.load();
vimmise_inlays(&mut other_inlay_hints, " == "); let vim_cfg = &cfg.lsp.vim_inlay_hints;
padding_after_inlay_hints = vec![]; if vim_cfg.enable {
padding_before_inlay_hints = vec![]; 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( doc.set_inlay_hints(
view_id, view_id,
@ -1671,6 +1677,7 @@ fn compute_inlay_hints_for_view(
padding_after_inlay_hints: padding_after_inlay_hints.into(), padding_after_inlay_hints: padding_after_inlay_hints.into(),
}, },
); );
doc.inlay_hints_oudated = false; doc.inlay_hints_oudated = false;
}, },
); );

@ -365,6 +365,25 @@ pub fn get_terminal_provider() -> Option<TerminalConfig> {
None 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)] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(default, rename_all = "kebab-case", deny_unknown_fields)] #[serde(default, rename_all = "kebab-case", deny_unknown_fields)]
pub struct LspConfig { pub struct LspConfig {
@ -378,6 +397,8 @@ pub struct LspConfig {
pub display_signature_help_docs: bool, pub display_signature_help_docs: bool,
/// Display inlay hints /// Display inlay hints
pub display_inlay_hints: bool, pub display_inlay_hints: bool,
/// Vim-style inlay hints
pub vim_inlay_hints: VimInlayConfig,
/// Whether to enable snippet support /// Whether to enable snippet support
pub snippets: bool, pub snippets: bool,
/// Whether to include declaration in the goto reference query /// Whether to include declaration in the goto reference query
@ -392,6 +413,7 @@ impl Default for LspConfig {
auto_signature_help: true, auto_signature_help: true,
display_signature_help_docs: true, display_signature_help_docs: true,
display_inlay_hints: false, display_inlay_hints: false,
vim_inlay_hints: VimInlayConfig::default(),
snippets: true, snippets: true,
goto_reference_include_declaration: true, goto_reference_include_declaration: true,
} }

Loading…
Cancel
Save