-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Feature Requests about Code Actions/Snippets #10911
Comments
I think we can do this, the problem with this currently though is that we can't set multiple cursors yet, that is we can't set a multi-cursor on all ocurrences of
Do you mean this in the context of completions or an assist that generates the closure signature for you that is expected here? |
I think this would be most convenient as a completion. so for example the user types The destructuring idea also maybe could be done as a completion, like if you start typing in a place that expects a pattern, then you can suggest certain destructurings that are valid in that position.
What do you mean by all occurences of Oh, while typing this I think I figured it out, did you mean any uses of the original binding name would also be transformed. To some kind of restructuring? |
We already do that for namable things like structs, though not for tuples since we can't do a completion on
let x = (0, 1);
let _ = x.0;
let _ = x.1; becomes let (_0, _1) = (0, 1);
let _ = _0;
let _ = _1; in this case putting snippets on just the identifiers in the first let statement might be a bit annoying, as you can't just rename them without invoking an actual rename operation unless all occurences are selected at the same time. Note we already have an assist for tuple binding destructuring which does this(without snippets). |
This issue requests multiple distinct features. Why don't we split them into three separate tickets? |
Ye it would probably make more sense to split this, though the first two we actually already track elsewhere.
Is #8676
Is #8673
I don't think we have an issue tracking this one though, so it would probably make sense to close this and re-open a new issue just for that part |
Convert to destructured form
It would be nice if this could use snippets somehow so that the cursor jumps to fill in the variable names.
But most other assists don't do this for the identifiers so maybe not necessary.
Generate closure template based on the signature inferred at that point
This should probably be a snippet with nodes at the arguments and then function body.
The reason this should be from rust-analyzer is that it with type information we can generate the argument list better.
The function body could probably be just
unimplemented!("<return type name>")
Convert between function name and closure
The last transform would require us to check whether it is a inherent method. Maybe another assist that converts inherent method calls to UFCS style could also be useful
The text was updated successfully, but these errors were encountered: