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

Extraneous backslashes in code-action auto completes #1228

Closed
theKidOfArcrania opened this issue Feb 26, 2024 · 7 comments
Closed

Extraneous backslashes in code-action auto completes #1228

theKidOfArcrania opened this issue Feb 26, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@theKidOfArcrania
Copy link

What's the output of :CocInfo

versions

vim version: VIM - Vi IMproved 9.0 9001499
node version: v16.14.1
coc.nvim version: 0.0.82-32329648 2024-02-26 18:54:56 +0800
coc.nvim directory: /home/***/.vim/plugged/coc.nvim
term: dumb
platform: linux

Log of coc.nvim

2024-02-26T11:32:22.342 INFO (pid:15534) [plugin] - coc.nvim initialized with node: v16.14.1 after 142
2024-02-26T11:32:22.343 INFO (pid:15534) [services] - LanguageClient Rust Analyzer Language Server state change: stopped => starting
2024-02-26T11:32:22.349 INFO (pid:15534) [language-client-index] - Language server "rust-analyzer" started with 15551
2024-02-26T11:32:22.359 INFO (pid:15534) [services] - LanguageClient Rust Analyzer Language Server state change: starting => running
2024-02-26T11:32:22.377 INFO (pid:15534) [services] - service rust-analyzer started
2024-02-26T11:32:28.315 INFO (pid:15534) [attach] - receive notification: codeAction [ 'line' ]
2024-02-26T11:32:33.774 INFO (pid:15534) [attach] - receive notification: showInfo []
2024-02-26T11:32:37.165 INFO (pid:15534) [attach] - receive notification: showInfo []

What's the output of :CocCommand rust-analyzer.serverVersion
rust-analyzer 0.3.1860-standalone

What's your coc-rust-analyzer version? You can get it from :CocList extensions
coc-rust-analyzer 0.75.1

Given this simple rust snippet code:

struct Hi {
    field: String,
}
    
impl std::fmt::Debug for Hi {
}

If I were to activate code action "Implement missing members" for this impl Debug, I will get a number of backslashes specifically preceding the closing brace:

impl std::fmt::Debug for Hi {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct(name: "Hi").field(name: "field", value: &self.field).finish()
    \}
}
@fannheyward fannheyward added the bug Something isn't working label Feb 29, 2024
@fannheyward
Copy link
Owner

rust-analyzer https://github.com/rust-lang/rust-analyzer/releases/tag/2024-02-19 brings this bug, 2024-02-12 is working as expected.

@theKidOfArcrania
Copy link
Author

Tracking issue for bug: rust-lang/rust-analyzer#16607 seems to be fixed since very recently

@theKidOfArcrania
Copy link
Author

I don't think, however, it actually properly fixes the bug tho

@fannheyward
Copy link
Owner

Made a quickfix in v0.75.2, to trim \\ for this case.

@RustyYato
Copy link

I'm still running into this issue if I generate multiple trait methods. I think the issue is because replace was used instead of replaceAll

fannheyward added a commit that referenced this issue Apr 11, 2024
@fannheyward
Copy link
Owner

@RustyYato try v0.75.3

@RustyYato
Copy link

That worked, thanks for the fast response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants