Skip to content
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

expand-region to match the built-in expander in WebStorm #80

Open
monfera opened this issue Nov 22, 2018 · 0 comments
Open

expand-region to match the built-in expander in WebStorm #80

monfera opened this issue Nov 22, 2018 · 0 comments

Comments

@monfera
Copy link

monfera commented Nov 22, 2018

It might work for others, or given more learning, but it's been hit and miss from the PoV of my personal experience:

Example 1

expand1

  1. 🤔 it selects set, though it's not a semantic unit, OK I can live with the extra granularity, can be useful sometimes to select a part of camelcased text
  2. ✅ it selects setPosition - perfect
  3. ❌ it then selects the entire row - the doc says, it also selects expressions, so it should select setPosition(shape.id, newProps) - and only on the subsequent selection should it select the if (!shallowEqual(oldProps, newProps)) setPosition(shape.id, newProps); - not because it's a line, but because it's a statement (a subsequent selection might select the entire line, or directly the encompassing semantic unit, fine to me either way)
Example 2

Maybe it'd work from the parens?
expand2

  1. 🤔standing before an opening paren will select the preceding symbol part (then symbol), let's try something else...
  2. 🤔standing after an opening paren will select the subsequent thing, OK can we select the entire (...) with one thing? - see Example 3
  3. shape.id selected
  4. 💯shape.id, newProps selected - very good, often, the internals of something wrapped around with (), {} or [] are needed, ie. excluding the bracketing
  5. ✅after a lot of keystrokes, we have (shape.id, newProps)
  6. ❌then it again selects the entire statement, skipping the expression (which it should not skip even if it were not an expression, because it represents the then branch of the if)
Example 3

As it worked neither with cursor before the paren, nor with after, out of curiosity, can we select (...) maybe by first selecting the (?
expand3

  1. 😄what happened? maybe it expands as if it were a set, ie. from both places, but then it's still not something I'd have predicted
Example 4

Fat arrows seem to go unrecognized:
expand4

Example 5

Apparently I can't select a normal old-fashioned statement:
expand5

Example 6

expand6

  1. ✅directly select what's to the right of the cursor
  2. ✅nicely expand to the entire key: propertyValue
  3. ✅expand to the internals of the {...} pair
  4. ✅expand to the full object literal
  5. ❌it still won't be able to wrap the statement, see Example 5

Here the good part is that it'll intuitively start selecting what's right of the cursor, rather than what's above. I'd similarly prefer if, standing before a (, { or [ it'd first select the entire bracketed expression, it'd be more intuitive than working from the outside in

Example: WebStorm

expand7

  1. ✅select the entire object as I'm standing just at it
  2. ✅expand to the key: propertyValue pair (or entire inner part, not sure)
  3. ✅expand to the entirety of (...)
  4. ✅expand to the entirety of withHandlers(...)
  5. ✅expand to the entirety of the assignment, then the assignment statement
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

No branches or pull requests

1 participant