From fc2bc0c6b48893b819dc1681ab08a19655ce77b1 Mon Sep 17 00:00:00 2001 From: Tom Solberg Date: Thu, 21 Mar 2024 20:58:06 +0100 Subject: [PATCH] Some LSP fixes (#680) --- crates/rune/src/languageserver/completion.rs | 6 +++--- crates/rune/src/languageserver/state.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/rune/src/languageserver/completion.rs b/crates/rune/src/languageserver/completion.rs index f026331e1..9143ef943 100644 --- a/crates/rune/src/languageserver/completion.rs +++ b/crates/rune/src/languageserver/completion.rs @@ -122,7 +122,7 @@ pub(super) fn complete_native_instance_data( let docs = meta.docs.lines().join("\n"); let args = meta.docs.args().unwrap_or_default().join(", "); - let detail = return_type.map(|r| format!("({args} -> {r}")); + let detail = return_type.map(|r| format!("({args}) -> {r}")); results.try_push(CompletionItem { label: n.try_to_string()?.into_std(), @@ -146,7 +146,7 @@ pub(super) fn complete_native_instance_data( detail: None, description: Some(prefix.try_to_string()?.into_std()), }), - data: Some(serde_json::to_value(meta.hash).unwrap()), + data: Some(serde_json::to_value(meta.hash.into_inner() as i64).unwrap()), ..Default::default() })?; } @@ -201,7 +201,7 @@ pub(super) fn complete_native_loose_data( }, new_text: func_name.into_std(), })), - data: Some(serde_json::to_value(meta.hash).unwrap()), + data: Some(serde_json::to_value(meta.hash.into_inner() as i64).unwrap()), ..Default::default() })?; } diff --git a/crates/rune/src/languageserver/state.rs b/crates/rune/src/languageserver/state.rs index 57fe18fe0..9807fa02e 100644 --- a/crates/rune/src/languageserver/state.rs +++ b/crates/rune/src/languageserver/state.rs @@ -708,7 +708,7 @@ impl Source { // The set of tokens that delimit symbols. let x: &[_] = &[ - ',', ';', '(', '.', '=', '+', '-', '*', '/', '}', '{', ']', '[', ')', ':', + ',', ';', '(', '.', '=', '+', '-', '*', '/', '}', '{', ']', '[', ')', ]; let end_search = (offset - start_byte + 1).min(chunk.len());