Skip to content

fix: remove extra spaces in full function signatures - #23070

Open
lingyaochu wants to merge 1 commit into
rust-lang:masterfrom
lingyaochu:completion_fix
Open

fix: remove extra spaces in full function signatures#23070
lingyaochu wants to merge 1 commit into
rust-lang:masterfrom
lingyaochu:completion_fix

Conversation

@lingyaochu

@lingyaochu lingyaochu commented Aug 7, 2026

Copy link
Copy Markdown

Closes #23069

When rust-analyzer.completion.fullFunctionSignatures.enable is set to true, completion descriptions are generated by detail_full, which internally calls write_function() to produce the signature. For functions with more than four parameters, the generated signature is multi-line:

let too_long_param = data.params.len() > 4;
f.write_char('(')?;
if too_long_param {
f.write_str("\n ")?;
}
let mut first = true;
let mut skip_self = 0;
if let Some(self_param) = func.self_param(db) {
self_param.hir_fmt(f)?;
first = false;
skip_self = 1;
}
let comma = if too_long_param { ",\n " } else { ", " };

Take the compare_exchange() function as an example, the final generated signature for this function is like:

pub fn compare_exchange(
    &self,
    current: bool,
    new: bool,
    success: Ordering,
    failure: Ordering,
) -> Result<bool, bool>

Flattening this output in detail_full previously inserted a space right after ( and right before ), e.g. pub fn compare_exchange( &self, ... ).

This PR makes a small change to detail_full to skip the whitespace insertion around the parentheses.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Completion descriptions contain unexpected spaces inside parentheses when fullFunctionSignatures is enabled

2 participants