Skip to content

Commit 1787c0b

Browse files
committed
fix(lsp): verbose response for less well supported editors
1 parent c986426 commit 1787c0b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

crates/nu-lsp/src/signature.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,16 @@ impl LanguageServer {
162162
parameters.push(arg_to_param_info(rest_arg));
163163
}
164164
let max_idx = parameters.len().saturating_sub(1) as u32;
165+
let active_parameter = Some(param_num_before_pos.min(max_idx));
165166
Some(SignatureHelp {
166167
signatures: vec![SignatureInformation {
167168
label: Self::get_signature_label(&active_signature),
168169
documentation: str_to_doc(active_signature.description),
169170
parameters: Some(parameters),
170-
active_parameter: Some(std::cmp::min(param_num_before_pos, max_idx)),
171+
active_parameter,
171172
}],
172173
active_signature: Some(0),
173-
active_parameter: None,
174+
active_parameter,
174175
})
175176
}
176177
}
@@ -315,7 +316,8 @@ mod tests {
315316
],
316317
"activeParameter": 1
317318
}],
318-
"activeSignature": 0
319+
"activeSignature": 0,
320+
"activeParameter": 1
319321
})
320322
);
321323

@@ -332,7 +334,8 @@ mod tests {
332334
],
333335
"activeParameter": 2
334336
}],
335-
"activeSignature": 0
337+
"activeSignature": 0,
338+
"activeParameter": 2
336339
})
337340
);
338341
}

0 commit comments

Comments
 (0)