Interested to collab to add refactoring actions to SourceKit-LSP

Hi, I am looking for feedback for my plan for my ideas for to add refactoring actions to SouceKit-LSP.

I plan to add the following actions:

Any feedback on my ideas would be welcomed. I am really interested in pursuing this project, and it is something that I greatly look forward to.

Hey @karthikvmala,

Great to hear that you are interested. I have a couple of thoughts to add to your list:

  • I’m not sure if you are aware but we already have refactorings in sourcekitd: swift/lib/Refactoring at main · swiftlang/swift · GitHub. Because these work on the compiler’s AST instead of the SwiftSyntax tree, they have some drawbacks, so re-implementing them based on swift-syntax would be beneficial in its own accord.
  • Also, some of the other refactorings you propose have corresponding issues in SourceKit-LSP, sometimes with draft PRs, that tend to go into more detail about what the challenges here are.
  • One key aspect to consider, is how much of the refactoring can be done purely syntactically based on the syntax tree, where we need semantic information (like an inferred type) and when we need global index information (eg. to find all the calls to a function in the project). Because all of these use different components, the design of the refactorings highlight depends on which information is needed.