Skip to content

Add a new change that can replace a note #2298

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

Closed
kimdv opened this issue Oct 17, 2023 · 2 comments
Closed

Add a new change that can replace a note #2298

kimdv opened this issue Oct 17, 2023 · 2 comments
Labels
enhancement New feature or request SwiftParser Bugs in the (new) Parser written in Swift

Comments

@kimdv
Copy link
Contributor

kimdv commented Oct 17, 2023

Description

From #2286 (comment)

Hmm, it’s not easily possible in the current design where we assume all nodes for the Fix-It to already be present in the syntax tree so that we just need to flip the token presence.

I would say that it’s good enough for now but adding support for these kinds of Fix-Its might be useful in general. What we need for that is, IMO, a new Fixit.Change that takes a syntax node, a key path within that node and a replacement node, i.e. something like case replace<NodeType, ChildType>(node: NodeType, path: KeyPath<NodeType, ChildType>, child: ChildType) – and yes I see the irony of declaring a generic enum case here, you would need to come up with some design that actually compiles, I haven’t thought about it too much yet.

I think this kind of Fix-It change might also be useful for macro authors. IIRC it came up once or twice but was never super important.

@kimdv kimdv added enhancement New feature or request SwiftParser Bugs in the (new) Parser written in Swift labels Oct 17, 2023
@ahoppen
Copy link
Member

ahoppen commented Oct 17, 2023

Tracked in Apple’s issue tracker as rdar://117082263

@kimdv
Copy link
Contributor Author

kimdv commented Oct 17, 2023

Close in favour of #2205

@kimdv kimdv closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request SwiftParser Bugs in the (new) Parser written in Swift
Projects
None yet
Development

No branches or pull requests

2 participants