Closed Aerijo closed 6 years ago
Requiring the string length be > 1 fixes this. Is it ever possible to have a 1-length string?
Also, there's a similar bug where you can toggle from the outer right, but not the outer left. It's related to how we convert from a point to an index, which requires "shifting" to the left; on the left, we shift to the (
, on the right we shift to the "
.
Which version of Atom are you using? Nightly? Beta?
@lee-dohm Beta, but it happens when building from master too. I don't know how to use nightly. The issue itself is entirely related to this package though.
I see the same behavior with toggle-quotes 1.1.1 and 1.31.0-nightly8 with the text console.log('hi');
in a javascript file.
It's annoying bug. Will you make a new release with this fix?
@AlexWayfer Oops, sorry that we missed to release a new version. I just published 1.1.2.
Thank you.
Description
The following applies to Tree-sitter grammars
When the cursor is at the beginning (adjacent right of the start quote mark), toggling quotes will introduce new quote characters
Steps to Reproduce
print("foo")
in Python)"
andf
Expected behavior: [What you expect to happen]
Actual behavior: [What actually happens]
EDIT: To be clear, this happens to anything scoped as a string, in any language. The cause is that we are not accounting for Points being between characters, while we get the syntax node of a character. The default behaviour is to get the character to the left of the Point; on the edges this leads to unwanted behaviour.
Reproduces how often: [What percentage of the time does it reproduce?] 100%
Versions
toggle-quotes 1.1.1
Notes
It seems to be grabbing the node of the
"
rather than the entire string.