cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

update inside / outside

Open pokey opened this issue 4 years ago • 4 comments

  • [ ] "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 #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 #210

This will be implemented in phases:

  1. Initial work during #225
  2. Do more in #210

See also #713

pokey avatar Aug 31 '21 12:08 pokey

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

AndreasArvidsson avatar Jul 09 '22 19:07 AndreasArvidsson

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.

pokey avatar Jul 09 '22 20:07 pokey

Exactly the plan

AndreasArvidsson avatar Jul 09 '22 21:07 AndreasArvidsson

Started work in #851

AndreasArvidsson avatar Jul 10 '22 08:07 AndreasArvidsson