Skip to content

Add refactoring action to move members to extension#2627

Open
myaumura wants to merge 1 commit into
swiftlang:mainfrom
myaumura:add-movememberstoextension-code-action
Open

Add refactoring action to move members to extension#2627
myaumura wants to merge 1 commit into
swiftlang:mainfrom
myaumura:add-movememberstoextension-code-action

Conversation

@myaumura
Copy link
Copy Markdown

Reopened after addressing review feedback and build fixes #3265 and #2484

Copy link
Copy Markdown
Member

@rintaro rintaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {}
} 

@rintaro
Copy link
Copy Markdown
Member

rintaro commented May 11, 2026

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.

Code owners discussed about this and we concluded that using SyntaxRefactoringCodeActionProvider is fine and preferable. So please disregard this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants