-
Notifications
You must be signed in to change notification settings - Fork 154
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 switch block refactor #2372
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vinistock
added
enhancement
New feature or request
server
This pull request should be included in the server gem's release notes
labels
Jul 26, 2024
Nice. I used to use https://github.com/jgdavey/vim-blockle for this. |
vinistock
force-pushed
the
vs-add-switch-block-refactor
branch
from
July 26, 2024 15:54
8f4ed00
to
1ca9bc0
Compare
andyw8
reviewed
Jul 26, 2024
vinistock
force-pushed
the
vs-add-switch-block-refactor
branch
from
August 7, 2024 17:50
1ca9bc0
to
5e15210
Compare
st0012
reviewed
Aug 7, 2024
test/expectations/code_action_resolve/nested_block_calls.exp.json
Outdated
Show resolved
Hide resolved
amomchilov
approved these changes
Aug 7, 2024
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.
Great feature!
vinistock
force-pushed
the
vs-add-switch-block-refactor
branch
2 times, most recently
from
August 8, 2024 14:27
31215f1
to
435639b
Compare
st0012
approved these changes
Aug 8, 2024
vinistock
force-pushed
the
vs-add-switch-block-refactor
branch
from
August 8, 2024 17:15
435639b
to
c273e3c
Compare
This was referenced Aug 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
server
This pull request should be included in the server gem's release notes
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This PR adds a new refactor code action to switch the style of a block. If the block uses
do..end
, it becomes a one liner brace block and vice-versa.Implementation
The first commit adds a new method to locate the first node matching a given list of types within the selected range. This is important for refactors, because users will select the code they want to apply some refactor on and we need to ignore the surrounding extra selection if it doesn't match the expected node.
The second commit adds the code action.
Automated Tests
Added tests.
Manual Tests
Select a block, click the light bulb (CMD + .) and select switch block style.
block_style_demo.mov