-
Notifications
You must be signed in to change notification settings - Fork 285
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
Add Local Refactoring support #70
Conversation
/// The document in which the command was invoked. | ||
public var textDocument: TextDocumentIdentifier | ||
|
||
public init(range: PositionRange, context: CodeActionContext, textDocument: TextDocumentIdentifier) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to minimize use of PositionRange
, so I suggest making the initializer take Range<Position>
and convert it. The only reason we have PositionRange is to make the serialization work. Ideally it would just be an implementation detail, but for now it's part of the API so that we can keep getting Codable
synthesis.
I'd be happy to take the changes for adding the CodeAction API as its own PR. |
I like that idea Ben, quite a few features rely on it. |
I'm separating this into three CodeAction/ExecuteCommand/Refactoring PRs because I feel that the second one is going to need some special attention. I should have the skeleton of CodeActions ready soon. |
736bd60
to
4684de2
Compare
This is fully working now, I just need to clean it up and write some tests. There are three "bad" news though:
But that's fixable from our side so it's not that bad. I wonder if Xcode doesn't suffer from this because it formats the range after editing.
|
7011c0a
to
27d93a1
Compare
f0b632c
to
e2d4e4f
Compare
c6e1a7c
to
bd1eb85
Compare
bd1eb85
to
2580cb3
Compare
Tests READMË
2580cb3
to
5f912cf
Compare
|
||
import Foundation | ||
|
||
/// Request sent from the client to to trigger command execution on the server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a duplicate "to" here
Lots of things happened since this one, so I'll open a new PR with only the info that ended up mattering. |
This gives the LSP the ability to recognize and process sourcekitd's code refactoring procedures through code action commands.
Things to take in mind:
.refactor
kind. I was thinking a better approach would be to make sourcekitd return alsp_refactor_id
string and use that internally.