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

Complete method self param declarations #9522

Closed
Veykril opened this issue Jul 7, 2021 · 4 comments · Fixed by #12773
Closed

Complete method self param declarations #9522

Veykril opened this issue Jul 7, 2021 · 4 comments · Fixed by #12773
Labels
A-completion autocompletion S-actionable Someone could pick this issue up and work on it right now

Comments

@Veykril
Copy link
Member

Veykril commented Jul 7, 2021

Does this issue consider completing self like here:

impl Foo {
    fn bar(<|>) {
    }
}

It'd be cool if this completed self, &self, &mut self, mut self and self: Arc<Self>

Originally posted by @jhgg in #9311 (comment)

A simple implementation has been done in #9548 but this only works for empty parameterlists which is not too useful as typing & already doesn't offer any completions.

@jonas-schievink jonas-schievink added A-completion autocompletion S-actionable Someone could pick this issue up and work on it right now E-easy labels Jul 7, 2021
@flodiebold
Copy link
Member

I'd propose we complete self, &self, mut self and &mut self. I don't know about special-casing Arc<Self>.

@jhgg
Copy link
Contributor

jhgg commented Jul 7, 2021

I'd propose we complete self, &self, mut self and &mut self. I don't know about special-casing Arc<Self>.

Fine with me. It would be interesting if we could offer Arc<Self> as a completion in this position though, as it's a fairly common pattern to do... 🤔

impl Foo {
   fn bar(self: <|>) {
   }
}

bors bot added a commit that referenced this issue Jul 10, 2021
9548: add: Adding self keyword completion in complete_fn_param r=lnicola a=feniljain

Solves #9522

I haven't added Arc<self> for now as there were some conflicting opinions on it

Co-authored-by: vi_mi <[email protected]>
@lhvy
Copy link
Contributor

lhvy commented Oct 1, 2021

Is this issue resolved with #9548 merged?

@Veykril
Copy link
Member Author

Veykril commented Oct 1, 2021

It isn't, that PR only added a very basic form of this. Basically it only works for functions with no parameters in them, see the comments after the merge in #9548 (comment) as well as #9575

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion autocompletion S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants