Skip to content

update inside / outside #254

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

Open
18 tasks
pokey opened this issue Aug 31, 2021 · 4 comments
Open
18 tasks

update inside / outside #254

pokey opened this issue Aug 31, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@pokey
Copy link
Member

pokey commented Aug 31, 2021

  • "inside" / "outside" / "pair" can be applied to anything that has an interior and scope starters / enders, eg an if statement, surrounding pairs, functions, strings, etc. We should handle the syntactic ones as part of Change scopeType matchers to rely on tree-sitter style scheme queries #616
    • Clojure scopes, to be able to say eg "take core list" and "round repack list"
    • If statements: with an else it would yield two targets (or more for else-ifs)
    • Switch statements
    • Function / class / anything with a code block
    • HTML elements
    • HTML tags
    • Question: do we want the above to apply to items in delimited sequences, such as args, tokens, lines, etc? Eg "chuck inside line" could be useful for removing contents of a line but leaving an empty line there
  • separately, we have "leading" / "trailing" that refer to the delimiters before or after items in delimited sequences, eg the commas in an arg list, or whitespace for tokens
  • We want "inside" without any scope type to automatically refer to the nearest applicable scope, not including the "space" surrounding pari type
  • The above modifiers will just go into a modifiers.csv in cursorless-settings
  • If you say "chuck inside list" it will remove everything inside list including whitespace padding
  • If you say "clear inside list" it will not remove whitespace padding inside
  • If you say "chuck leading inside list" it will remove leading padding in the list
  • If you say "chuck trailing string" it will remove whitespace after the string
  • If you say "chuck list" it will remove list and trailing whitespace
  • "chuck trailing line" will remove trailing newline
  • Note that part of this change is that we remove target preferences for inside / outside and instead let them use removal ranges per Switch targets to object-oriented #210

This will be implemented in phases:

  1. Initial work during Change surrounding delimiter api #225
  2. Do more in Switch targets to object-oriented #210

See also #713

@AndreasArvidsson
Copy link
Member

I'm gonna take a crack at inside element because that one is so useful

@pokey
Copy link
Member Author

pokey commented Jul 9, 2022

Yeah that's fair. Was hoping to wait until #629, but this one is too useful to hold off I think

Prob easiest to just add an interiorRange attribute to the legacy SelectionContext?

Once we have #629 we can add weak expansion support that will stop if it hits a scope type that supports inside, so that we can just say "take inside air" for anything inside an element.

@AndreasArvidsson
Copy link
Member

Exactly the plan

@AndreasArvidsson
Copy link
Member

Started work in #851

@AndreasArvidsson AndreasArvidsson removed their assignment Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants