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

Generate getter unconditionally inserts $0 (snippet position marker) #14161

Closed
azriel91 opened this issue Feb 15, 2023 · 1 comment · Fixed by #14162
Closed

Generate getter unconditionally inserts $0 (snippet position marker) #14161

azriel91 opened this issue Feb 15, 2023 · 1 comment · Fixed by #14162
Labels
A-assists C-bug Category: bug

Comments

@azriel91
Copy link
Contributor

azriel91 commented Feb 15, 2023

URLO thread

Heya, when I use "generate getter" on the value field using Rust analyzer:

#[derive(Clone, Debug)]
pub struct MyStruct {
    value: u32,
}

The following code gets generated (notice the $0 before the function name):

impl MyStruct {
    pub fn $0value(&self) -> u32 {
        self.value
    }
}

Possibly this line should only insert the $0 if ctx.config.snippet_cap.is_some() -- based on this other part further down.

I haven't found a way to see what capabilities sublime text is reporting to LSP, in case we need to see that.


rust-analyzer version: rust-analyzer 0.0.0 (89b994049 2023-02-14)
rustc version: rustc 1.69.0-nightly (0416b1a6f 2023-02-14)
relevant settings:

@azriel91 azriel91 added the C-bug Category: bug label Feb 15, 2023
@Veykril
Copy link
Member

Veykril commented Feb 15, 2023

Ye that is missing the snippet_cap check

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

Successfully merging a pull request may close this issue.

2 participants