Skip to content

Textual paired delimiters #324

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

Merged
merged 69 commits into from
Nov 27, 2021
Merged

Textual paired delimiters #324

merged 69 commits into from
Nov 27, 2021

Conversation

pokey
Copy link
Member

@pokey pokey commented Nov 16, 2021

Adds support for paired delimiters (, ), ", etc when we don't have access to a parse tree.

See also cursorless-dev/cursorless-talon#104

Closes #14
Closes #218

  • Fix issue with skipping; see unit tests
  • Fix bug with quotes. See unit tests
  • Fix old test cases from original impl
  • Switch "take" tests to "clear"
  • Narrow range for comments / strings to only text content, rather than including eg // or "
  • Add multiline tests
  • Add tests using strings / comments
  • Add a couple "chuck" tests to ensure it doesn't modify outside
  • Fix Java strings
  • Duplicate all possible non-parse-tree based tests to tests with parse tree
  • File issue for "take quad" in Java. Strings don't have children so our parse-tree-based algo gets messed up
  • Ensure that parse-tree based behaviour matches without parse tree
  • Move functions into own files, and move them all into a modifiers/surroundingPair directory
  • What to do about supporting "inside string"? Currently only properly support "inside quad" I believe
  • For parse tree, walk up until we find first node weakly containing entire selection. Then ask for all descendants matching the delimiter types. So we can switch impl back to using a list rather than attempt at generator. But with parse tree we know whether a quote is left or right, tho that will take some special casing in Java
  • Add test for ("hello" "world") with cursor in the middle, as well as just before/after first middle quote and just before/after second middle quote. Repeat for different languages
  • Add tests for string interpolation. Also, is skis supported? Check existing tests. Try having cursor inside interpolation variable as well as in string content. Try having string within interpolation var. Have multiple languages
  • Change "string" from being a syntactic scope type to a union between single and double and backtick
  • Fix string scope type issue by having string be in the scope type file but used as a surrounding pair
  • Fix / add new tests for "take string"
  • Check / file issue for python "take twin" and java cursor just after string (Fix python surrounding pairs in new tree-sitter-python version #328 and Fix java double quote surrounding pair scope type when cursor is after final quote #329)
  • Move old parse tree tests into dir
  • Move new text tests into dir
  • Add comment about caching document tokenisation for multiple cursors
  • Revert transform script commits
  • Make talon delimiter inclusion terminology configurable, using terms from Terminology for delimiter inclusion #327
  • Finish talon side (Improve surrounding pairs cursorless-talon#104)
  • File issue for "space" surrounding pair Add nonWhitespaceSequence scope type #330
  • File issue for duplicating typescript tests for other languages Apply parse-tree-based surrounding pair tests to other languages #331
  • File issue to potentially handle sequences of quotes or comments. Can do so by having text impl accept list of text ranges. Then parse tree impl walks up tree, each time first trying all descendant strings before trying parse tree (Handle delimiter pairs in adjacent quotes or comments #332)

@pokey pokey force-pushed the textual-paired-delimiters branch 2 times, most recently from 0c929d7 to 31cc93a Compare November 18, 2021 19:01
@pokey pokey force-pushed the textual-paired-delimiters branch from b7706c3 to a9a148c Compare November 23, 2021 16:33
@pokey pokey marked this pull request as ready for review November 24, 2021 18:23
@AndreasArvidsson AndreasArvidsson self-requested a review November 27, 2021 13:37
@AndreasArvidsson AndreasArvidsson merged commit 7639181 into main Nov 27, 2021
@AndreasArvidsson AndreasArvidsson deleted the textual-paired-delimiters branch November 27, 2021 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add text-based surrounding pair implementation Support "enclosing <symbol>" transformation
2 participants