Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect formatting of hover action #12728

Closed
BenjaminBrienen opened this issue Jul 9, 2022 · 3 comments · Fixed by #17353
Closed

Incorrect formatting of hover action #12728

BenjaminBrienen opened this issue Jul 9, 2022 · 3 comments · Fixed by #17353
Labels
A-hover hover feature A-vscode vscode plugin issues C-bug Category: bug

Comments

@BenjaminBrienen
Copy link

BenjaminBrienen commented Jul 9, 2022

rust-analyzer version: rust-analyzer version: 0.0.0 (75b2232 2022-07-03)
rustc version: rustc 1.64.0-nightly (1517f5de0 2022-07-07)

relevant settings: rust-analyzer.hover.actions.references.enable

image

You can see there is a triple underscore ___ between references and ▶︎. This is caused by the .join() here:
https://github.com/rust-lang/rust-analyzer/blame/995a17fbd9f7cdedfdafec946b1d9e44eff448b4/editors/code/src/client.ts#L61
Is the ___ there for a particular reason, @vsrs ?

@BenjaminBrienen
Copy link
Author

BenjaminBrienen commented Jul 9, 2022

I don't have write access but I would propose the following change to that function:

function renderHoverActions(actions: ra.CommandLinkGroup[]): vscode.MarkdownString {
    const text = actions
        .map(
            (group) =>
                (group.title ? group.title + " " : "") +
                group.commands.map(renderCommand).join(" | ")
        )
        .join("  /  ");

    const result = new vscode.MarkdownString(text);
    result.isTrusted = true;
    return result;
}

@BenjaminBrienen
Copy link
Author

We might want to make the hover popup have the same format as the CodeLens: Run | Debug | N references
image

@flodiebold flodiebold added the A-vscode vscode plugin issues label Jul 11, 2022
@Veykril Veykril added the A-hover hover feature label Jan 19, 2023
@Veykril
Copy link
Member

Veykril commented Jan 30, 2023

Requires

    "rust-analyzer.lens.references.method.enable": true,
    "rust-analyzer.hover.actions.references.enable": true,

to be able to see this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-hover hover feature A-vscode vscode plugin issues C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants