-
Notifications
You must be signed in to change notification settings - Fork 1.7k
internal: Migrate assists to the structured snippet API, part 4 #15874
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
internal: Migrate assists to the structured snippet API, part 4 #15874
Conversation
Mirrors `PathSegment's` version, except that it always generates a turbofish
`add_type_ascription` is still left as-is since it's a different assist
Way for setting and removing the type ascription of a let stmt
Due to the way the current tree mutation api works, we need to collect changes before we can apply them to the real syntax tree, and also can only switch to a file once. `destructure_tuple_binding_in_sub_pattern` also gets migrated even though can't be used.
Needed so that the `tuple_pat` node gets added to the syntax tree, which is required as we're using structured snippets.
d477979
to
c32ed45
Compare
Assist wasn't applicable when the let statement was missing a pattern before, so we should do the same now.
c32ed45
to
3f99a56
Compare
☀️ Test successful - checks-actions |
Haven't seen that issue until now (slowly getting back into contributing in general after a break), but hard agree on on the problems with the mutable syntax tree api. It is a step up from the text-based apis, but still not ideal 😔 Once I'm done with the structured snippet port + a few structured snippet related odds & ends (according to my personal todo list, maybe mid-December?), I do have an interest in tackling things like the syntax quasi-quote api and at the very least an auto-indenter (though we'll see how I feel by then).
The neat thing about how structured snippets are implemented is that In fact, I think it'd be even better with a different node tracking api, as I've run into the issue of "losing" syntax nodes quite a few times (e.g. for |
A related issue regarding node tracking #9649 |
…ykril internal: Migrate assists to the structured snippet API, part 5 Continuing from #15874 Migrates the following assists: - `extract_variable` - `generate_function` - `replace_is_some_with_if_let_some` - `replace_is_ok_with_if_let_ok`
Continuing from #15260
Migrates the following assists:
add_turbo_fish
add_type_ascription
destructure_tuple_binding
destructure_tuple_binding_in_subpattern
I did this a while ago, but forgot to make a PR for the changes until now. 😅