aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide/src/completion/presentation.rs2
-rw-r--r--crates/ra_ide_db/src/feature_flags.rs3
-rw-r--r--crates/rust-analyzer/src/conv.rs29
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs8
4 files changed, 25 insertions, 17 deletions
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs
index d6196a5ce..aada4d025 100644
--- a/crates/ra_ide/src/completion/presentation.rs
+++ b/crates/ra_ide/src/completion/presentation.rs
@@ -225,7 +225,7 @@ impl Completions {
225 let snippet = if ctx 225 let snippet = if ctx
226 .db 226 .db
227 .feature_flags 227 .feature_flags
228 .get("completion.insertion.add-argument-sippets") 228 .get("completion.insertion.add-argument-snippets")
229 { 229 {
230 let to_skip = if has_self_param { 1 } else { 0 }; 230 let to_skip = if has_self_param { 1 } else { 0 };
231 let function_params_snippet = join( 231 let function_params_snippet = join(
diff --git a/crates/ra_ide_db/src/feature_flags.rs b/crates/ra_ide_db/src/feature_flags.rs
index d9c9d6cd2..968415072 100644
--- a/crates/ra_ide_db/src/feature_flags.rs
+++ b/crates/ra_ide_db/src/feature_flags.rs
@@ -54,8 +54,9 @@ impl Default for FeatureFlags {
54 FeatureFlags::new(&[ 54 FeatureFlags::new(&[
55 ("lsp.diagnostics", true), 55 ("lsp.diagnostics", true),
56 ("completion.insertion.add-call-parenthesis", true), 56 ("completion.insertion.add-call-parenthesis", true),
57 ("completion.insertion.add-argument-sippets", true), 57 ("completion.insertion.add-argument-snippets", true),
58 ("completion.enable-postfix", true), 58 ("completion.enable-postfix", true),
59 ("call-info.full", true),
59 ("notifications.workspace-loaded", true), 60 ("notifications.workspace-loaded", true),
60 ("notifications.cargo-toml-not-found", true), 61 ("notifications.cargo-toml-not-found", true),
61 ]) 62 ])
diff --git a/crates/rust-analyzer/src/conv.rs b/crates/rust-analyzer/src/conv.rs
index fe3b588e4..a2d68c344 100644
--- a/crates/rust-analyzer/src/conv.rs
+++ b/crates/rust-analyzer/src/conv.rs
@@ -3,10 +3,10 @@
3 3
4use lsp_types::{ 4use lsp_types::{
5 self, CreateFile, DiagnosticSeverity, DocumentChangeOperation, DocumentChanges, Documentation, 5 self, CreateFile, DiagnosticSeverity, DocumentChangeOperation, DocumentChanges, Documentation,
6 Location, LocationLink, MarkupContent, MarkupKind, Position, Range, RenameFile, ResourceOp, 6 Location, LocationLink, MarkupContent, MarkupKind, ParameterInformation, ParameterLabel,
7 SemanticTokenModifier, SemanticTokenType, SymbolKind, TextDocumentEdit, TextDocumentIdentifier, 7 Position, Range, RenameFile, ResourceOp, SemanticTokenModifier, SemanticTokenType,
8 TextDocumentItem, TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier, 8 SignatureInformation, SymbolKind, TextDocumentEdit, TextDocumentIdentifier, TextDocumentItem,
9 WorkspaceEdit, 9 TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier, WorkspaceEdit,
10}; 10};
11use ra_ide::{ 11use ra_ide::{
12 translate_offset_with_edit, CompletionItem, CompletionItemKind, FileId, FilePosition, 12 translate_offset_with_edit, CompletionItem, CompletionItemKind, FileId, FilePosition,
@@ -220,17 +220,20 @@ impl Conv for ra_ide::Documentation {
220 } 220 }
221} 221}
222 222
223impl Conv for ra_ide::FunctionSignature { 223impl ConvWith<bool> for ra_ide::FunctionSignature {
224 type Output = lsp_types::SignatureInformation; 224 type Output = lsp_types::SignatureInformation;
225 fn conv(self) -> Self::Output { 225 fn conv_with(self, concise: bool) -> Self::Output {
226 use lsp_types::{ParameterInformation, ParameterLabel, SignatureInformation}; 226 let (label, documentation, params) = if concise {
227 227 let mut params = self.parameters;
228 let label = self.to_string(); 228 if self.has_self_param {
229 229 params.remove(0);
230 let documentation = self.doc.map(|it| it.conv()); 230 }
231 (params.join(", "), None, params)
232 } else {
233 (self.to_string(), self.doc.map(|it| it.conv()), self.parameters)
234 };
231 235
232 let parameters: Vec<ParameterInformation> = self 236 let parameters: Vec<ParameterInformation> = params
233 .parameters
234 .into_iter() 237 .into_iter()
235 .map(|param| ParameterInformation { 238 .map(|param| ParameterInformation {
236 label: ParameterLabel::Simple(param), 239 label: ParameterLabel::Simple(param),
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs
index b5db1fd38..b498c90c9 100644
--- a/crates/rust-analyzer/src/main_loop/handlers.rs
+++ b/crates/rust-analyzer/src/main_loop/handlers.rs
@@ -459,8 +459,12 @@ pub fn handle_signature_help(
459 let _p = profile("handle_signature_help"); 459 let _p = profile("handle_signature_help");
460 let position = params.try_conv_with(&world)?; 460 let position = params.try_conv_with(&world)?;
461 if let Some(call_info) = world.analysis().call_info(position)? { 461 if let Some(call_info) = world.analysis().call_info(position)? {
462 let active_parameter = call_info.active_parameter.map(|it| it as i64); 462 let concise = !world.analysis().feature_flags().get("call-info.full");
463 let sig_info = call_info.signature.conv(); 463 let mut active_parameter = call_info.active_parameter.map(|it| it as i64);
464 if concise && call_info.signature.has_self_param {
465 active_parameter = active_parameter.map(|it| it.saturating_sub(1));
466 }
467 let sig_info = call_info.signature.conv_with(concise);
464 468
465 Ok(Some(req::SignatureHelp { 469 Ok(Some(req::SignatureHelp {
466 signatures: vec![sig_info], 470 signatures: vec![sig_info],