Add refactoring action to move members to extension - #2627
Conversation
There was a problem hiding this comment.
At a high level, code actions implemented in sourcekit-lsp should implement SyntaxCodeActionProvider directly.
SyntaxRefactoringCodeActionProvider is just glue code that adapts SwiftRefactor refactorings from swift-syntax to SyntaxCodeActionProvider, so new code action providers in sourcekit-lsp should generally implement SyntaxCodeActionProvider directly instead of using it.
|
|
||
| extension Outer { | ||
| struct Inner { | ||
| func moveThis() {} |
There was a problem hiding this comment.
The selection is moveThis() not the entire struct Inner { ... } Can you make the result like this in this case.
struct Outer<T> {
struct Inner {}
}
extension Outer.Inner {
func moveThis() {}
} There was a problem hiding this comment.
Hi! Apologies for disappearing for a while. I have pushed two commits addressing the requested changes.
Updated the branch to the latest code-action infrastructure and moved the tests into SwiftSyntaxCodeActionsTests.
Refactored the implementation and added coverage for moving members from nested types, including invalid-member cases.
Code owners discussed about this and we concluded that using |
… add-movememberstoextension-code-action # Conflicts: # Sources/SwiftSyntaxCodeActions/MoveMembersToExtension.swift
Reopened after addressing review feedback and build fixes #3265 and #2484