-
Notifications
You must be signed in to change notification settings - Fork 314
Support rename across Swift files #993
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
Conversation
acf3c74
to
b8379d9
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
b8379d9
to
3d7c405
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
105adb9
to
7e3ffe5
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
if edits.changes == nil { | ||
// Make sure `edits.changes` is non-nil so we can force-unwrap it below. | ||
edits.changes = [:] | ||
} |
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.
Out of curiosity, is there a meaningful difference between changes
being nil
and empty? Wondering why it needs to be optional in the first place
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.
Effectively, there’s no difference AFAICT. It’s LSP that specifies that changes
can be nil
. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspaceEdit
7e3ffe5
to
215200d
Compare
@swift-ci Please test |
rdar://118995700
- Invoke the rename request from multiple marker locations within a test file - Add more test cases to test compound decl name references
215200d
to
e08f0a9
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
1 similar comment
@swift-ci Please test Windows |
2️⃣foo(x: 1) | ||
_ = 3️⃣foo(x:) |
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.
Could check the argument locations here too
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.
Renaming the argument labels currently isn’t supported. I filed rdar://119875277 to implement it in a follow-up PR because it might require some non-trivial refactoring.
let response = try await ws.testClient.send( | ||
RenameRequest(textDocument: TextDocumentIdentifier(aUri), position: aPositions["1️⃣"], newName: "bar") | ||
) | ||
let changes = try XCTUnwrap(response?.changes) |
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.
Could we just apply the edits as in the single file rename? Or if not that, at least have a helper for creating a TextEdit
from a file + name + two markers?
Address review comments from #993
Best reviewed commit by commit.
)
or if it has text after)
rdar://118995700