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 type name as local name in pattern position #17780

Closed
Veykril opened this issue Aug 4, 2024 · 5 comments · Fixed by #18031
Closed

Complete type name as local name in pattern position #17780

Veykril opened this issue Aug 4, 2024 · 5 comments · Fixed by #18031
Assignees
Labels
A-completion autocompletion C-feature Category: feature request

Comments

@Veykril
Copy link
Member

Veykril commented Aug 4, 2024

struct Directory {}
let $0 = Directory {};

I feel like proposing directory would be quite helpful at times.

That is, when completing a (top level) pattern binding and the corresponding type is an ADT (after stripping references), we should propose a lower snake cased version ADTs name.

@Veykril Veykril added A-completion autocompletion C-feature Category: feature request labels Aug 4, 2024
@roife
Copy link
Member

roife commented Sep 1, 2024

@rustbot claim

@roife
Copy link
Member

roife commented Sep 1, 2024

Should we complete within the match arms? Although it seems a bit odd for me (i.e. suggesting enum1 here):

enum Enum1 { A, B }
let e: Enum1;
match e {
  $0
}

@Veykril
Copy link
Member Author

Veykril commented Sep 1, 2024

I'd say let statements and params make the most sense for this

@roife
Copy link
Member

roife commented Sep 2, 2024

We can reuse ide_assist::utils::suggest_name. Would it be ok if I move it to the hir crate so that all ide-xxx crates can use it?

@Veykril
Copy link
Member Author

Veykril commented Sep 2, 2024

you can move it into ide-db which all of them access

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

Successfully merging a pull request may close this issue.

2 participants