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

pub(crate) completion leaves closing ) behind #12390

Closed
jonas-schievink opened this issue May 25, 2022 · 8 comments · Fixed by #12412
Closed

pub(crate) completion leaves closing ) behind #12390

jonas-schievink opened this issue May 25, 2022 · 8 comments · Fixed by #12412
Labels
A-completion autocompletion C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now

Comments

@jonas-schievink
Copy link
Contributor

impl () {
    pub(crate) fn f() {}

    pu$0
}

Triggering completion here suggests pub(crate). Then, after typing b(c, accepting the pub(crate) completion produces this:

impl () {
    pub(crate) fn f() {}

    pub(crate)$0)
}
  1. That's wrong :)
  2. The pub(crate) completion does not appear in pub($0), which kinda makes sense (since crate by itself appears there), but I also feel like we should be consistent there, since you can "carry over" a completion when you request it after pu$0.
@jonas-schievink jonas-schievink added A-completion autocompletion S-actionable Someone could pick this issue up and work on it right now C-bug Category: bug labels May 25, 2022
@Veykril
Copy link
Member

Veykril commented May 25, 2022

To me it feels like we shouldn't carry this completion over at all tbh, though I don't think we are in charge of that as the server.

@yue4u
Copy link
Contributor

yue4u commented May 29, 2022

I did some debugging but didn't understand why it renders correctly with pub() but not pub(c), was thinking the cause of this issue is a extra ) been produced by auto closing after typing (,

I think It's possible to prevent carrying by removing parentheses from lookup and set it to something like pubcrate. As a drawback, this approach won't show any completions after typing ( after pub$0 until typing out next c or s.

@Veykril
Copy link
Member

Veykril commented May 29, 2022

As a drawback, this approach won't show any completions after typing ( after pub$0 until typing out next c or s.

This is most likely because ( isn't set as a trigger character by the server capabilities, so the client doesn't request completions for it.

@Veykril
Copy link
Member

Veykril commented May 29, 2022

This list here

trigger_characters: Some(vec![":".to_string(), ".".to_string(), "'".to_string()]),
, though adding ( to the list might create a lot of completion noise

@yue4u
Copy link
Contributor

yue4u commented May 29, 2022

Adding ( seems good to me in this situation but it will sure change the overall completion behavior a lot. (It doesn't make any test fail though 😆 ).

if-2022-05-29_18.53.32.mp4

@yue4u
Copy link
Contributor

yue4u commented May 29, 2022

We don't need to change the lookup at all if add ( to trigger_characters since it prevents carrying at the first place.

@yue4u
Copy link
Contributor

yue4u commented May 29, 2022

Adding ( is really annoying when you only want to return () or use any tuple types.

@Veykril
Copy link
Member

Veykril commented May 29, 2022

Ye that's what I worry about, in most cases you don't want that behaviour, but in the pub$0 case this makes a lot of sense, since you can't have pub(). I think adding this is fine if we make it only work in this occurence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion autocompletion C-bug Category: bug 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.

3 participants