-
Notifications
You must be signed in to change notification settings - Fork 441
Code actions to convert between computed properties and zero-parameter functions #2721
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
Code actions to convert between computed properties and zero-parameter functions #2721
Conversation
This is awesome! Can you also add some tests to make sure this doesn't suggest the refactor: var x: Int {
get { 5 }
set { /*anything */ }
} And that the refactor succeeds with: var x: Int {
get { 5 }
} |
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.
Very nice. The test suggestion from @harlanhaskins would be good to address as well but I’m pretty sure those test will pass.
Sources/SwiftRefactor/ConvertComputedPropertyToZeroParameterFunction.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftRefactor/ConvertComputedPropertyToZeroParameterFunction.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftRefactor/ConvertComputedPropertyToZeroParameterFunction.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftRefactor/ConvertZeroParameterFunctionToComputedProperty.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftRefactor/ConvertZeroParameterFunctionToComputedProperty.swift
Outdated
Show resolved
Hide resolved
fada317
to
7b61dfa
Compare
@harlanhaskins Thank you, for your test suggestion! |
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.
Thanks for also adding support for a variable with an explicit get
getter.
Sources/SwiftRefactor/ConvertComputedPropertyToZeroParameterFunction.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftRefactor/ConvertComputedPropertyToZeroParameterFunction.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftRefactor/ConvertComputedPropertyToZeroParameterFunction.swift
Show resolved
Hide resolved
7b61dfa
to
dccabd4
Compare
Sources/SwiftRefactor/ConvertComputedPropertyToZeroParameterFunction.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftRefactor/ConvertComputedPropertyToZeroParameterFunction.swift
Show resolved
Hide resolved
Sources/SwiftRefactor/ConvertComputedPropertyToZeroParameterFunction.swift
Outdated
Show resolved
Hide resolved
dccabd4
to
095ab04
Compare
Sources/SwiftRefactor/ConvertComputedPropertyToZeroParameterFunction.swift
Outdated
Show resolved
Hide resolved
095ab04
to
92e22a3
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
92e22a3
to
3a81bb8
Compare
3a81bb8
to
92e22a3
Compare
Instead of merging |
59a93cc
to
4d6a1fa
Compare
@ahoppen, thank you for your hint, done rebasing |
Accidentally removed the wrong branch |
@swift-ci Please test |
@swift-ci Please test Windows |
A part of swiftlang/sourcekit-lsp#1246