-
Notifications
You must be signed in to change notification settings - Fork 307
Address my own review comments to #1179 #1237
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
@swift-ci Please test |
func testAddDocumentationRefactorSingleParameter() throws { | ||
try assertRefactor( | ||
""" | ||
1️⃣func 2️⃣refactor(syntax: DeclSyntax) { } |
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.
Is on the label valid? Parameter?
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.
It doesn't work in the assertRefactor
tests because those invoke the refactoring directly from the syntax node. I did add a new code action test case that tests invoking documentation adding from the parameters (because that does the new logic of walking up parents to find the node on which to invoke the refactoring action).
Fixed a few more bugs:
|
@swift-ci Please test |
@swift-ci Please test Windows |
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.
Thank you!
Sources/SourceKitLSP/Swift/CodeActions/SyntaxRefactoringCodeActionProvider.swift
Show resolved
Hide resolved
Sources/SourceKitLSP/Swift/CodeActions/SyntaxRefactoringCodeActionProvider.swift
Show resolved
Hide resolved
Addresses a few minor comments and the following major ones: - Add test cases for the syntax refactorings - Don’t report code actions for refactorings that don’t actually modify the source - Instead of just looking at the parent of the token of the selected range, walk up the syntax tree to find the syntax node to refactor. This makes the refactorings available in a lot more locations.
…eclaration’s trivia This meant that if there were two newlines before the declaration, the documentation would be separated to the declaration by one newline and if the declaration was at the start of a line, the declaration would be on the same line as the doc comment, effectively making the documentation part of a comment.
…not on a new line
a45a3cf
to
f1d6a08
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
Addresses a few minor comments and the following major ones: