This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Fix bugs of inserting braces after hash#237
Open
hediyi wants to merge 2 commits intoatom:masterfrom
hediyi:fix-inserting-braces-after-hash
Open
Fix bugs of inserting braces after hash#237hediyi wants to merge 2 commits intoatom:masterfrom hediyi:fix-inserting-braces-after-hash
hediyi wants to merge 2 commits intoatom:masterfrom
hediyi:fix-inserting-braces-after-hash
Conversation
The problem lies in the fact that "scopes at cursor" is actually the
scopes of the character on the right, so to determine if the cursor is
on an interpolated string, the character on the other side of the cursor
should also be checked, with two exceptions: when the cursor is at the
beginning or end of a line.
This patch aims to be clean, but not perfect:
** In some rare situations, such as when typing `#` at the beginning or
end of a line within a multi-line interpolated string, it won't expand
to `#{}`. **
Author
|
🤘 @50Wliu Do you have time to review this? |
Contributor
|
I just checked and Ruby supports multiline strings, so I'm not sure this will work for those cases. Maybe add a check to make sure there's no |
Author
lastCursor = @editor.getLastCursor()
scopesArrayOfLastCursor = lastCursor.getScopeDescriptor().getScopesArray()
return false if lastCursor.isAtBeginningOfLine() and scopesArrayOfLastCursor[scopesArrayOfLastCursor.length - 1].match(/punctuation(?:\.\w+)+\.begin/)You mean something like this? |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
fixes atom/language-ruby#153
fixes atom/language-ruby#132
The function name
isCursorOnInterpolatedStringis not very accurate, can I change it toisInterpolationAllowedorisCursorOnInterpolated?