extendSelection only handles brackets outside quotes#314
extendSelection only handles brackets outside quotes#314renkun-ken merged 6 commits intoREditorSupport:masterfrom
Conversation
|
Nice work! Can you add unit tests for those examples? |
|
@andycraig I'm wondering how I could run the test with mocha? I tried but failed. I also tried adding "scripts": {
"test": "mocha"
},to |
|
At some point some of the test API was moved into I will have a look this evening. |
|
Once the test works, we could add tests to GitHub actions so that it could run regularly. |
|
The currently known limitation is
print("
# hello
[ is a function
`[[` is also a function
") |
R"("hello", 'world')"
r"("hello", 'world')"
r"--("hello", 'world')--"
r'--("hello", 'world')--'
r'--("hello", 'world')--")--'it works with print(r"("hello", 'world')"
)
print(r"([)"
)but not print(r"("[")"
)I don't think I'll fix these limitations at the moment as it'll add much complexity to the code and the edge cases seems to rarely occur in practice. |
|
@renkun-ken This PR and #316 modify some of the same files. If it's okay with you, I would like to have #316 merged first, and then we can confirm that the unit tests all pass for this PR before merging. |
|
@andycraig Thanks for the good work on testing. I'm totally okay with merging #316 first. Then I'll take a look and maybe rebase this PR onto the latest master. |
9a42472 to
38954bb
Compare
|
Rebased to #317, fixed some test cases, and everything looks good now. |
|
Great! I'll review tomorrow. |
|
@andycraig Thanks for your review! |
|
@renkun-ken Thank you very much for adding this feature! |
What problem did you solve?
Closes #173
This PR enhances
extendSelectionso that it could handle string and symbol enclosed between quotes (",',`). Raw string is not yet handled due to its complexity. This should be working for most cases at the moment.(If you do not have screenshot) How can I check this pull request?
Put cursor at the first and last line of each code chunk and send it to terminal via
extendSelection, and all should work and send code correctly.The following example should send the same code to terminal when cursor is at any line from 2 to 4.