1

In VSCode, items-ce|nter grows to items-[center] when executing the editor.action.smartSelect.grow command; where | represents the cursor and [] represents the selection.

Is it possible for this command to honour my word separators (as in editor.wordSeparators) and grow straight to [items-center]?

Also, is it possible for smart select to ignore camel case? eg. camelCa|se grows to camel[Case] instead of [camelCase].

starball
  • 20,030
  • 7
  • 43
  • 238
qlyde
  • 11
  • 2
  • "_Also, is it possible for smart select to ignore camel case? eg. camelCa|se grows to camel[Case] instead of [camelCase]._" one question per question post please. This should be moved to a new question post. – starball Apr 22 '23 at 23:51
  • `"editor.wordSeparators": "\`~!@#$%^&*()=+[{]}\\|;\",.<>/?" // exclude -, ' and :`. I use this for `"[css][typescript][typescriptreact]"`, so I can quickly edit classNames like `sm:px-6`. Ctrl/Cmd+D honours these separators and works for this purpose, but it would be nice to be able to use the smart select in the same way, and also for camelCase. – qlyde Apr 23 '23 at 03:27

1 Answers1

0

There is some help coming in vscode v1.80 (it is in the Insiders now). A new setting:

Editor > Smart Select: Select Subwords  // default is enabled
Whether subwords (like 'foo` in 'fooBar' or 'foo_bar') should be selected.

The default is the current version where camel[Case] or foo_[bar] would be selected with the smartSelect command (brackets indicating the selections after using the command).

By disabling the setting mentioned above the result becomes [camelCase] or [foo_bar].

So that helps with your camelCase question. However, for foo-bar, the result is still foo-[bar] with the setting disabled AND the "editor.wordSeparators" setting modified to remove the -. So apparently the smartSelect commands do not adjust to use the "editor.wordSeparators" value unfortunately.

I added a comment to the PR: see Add option for smartSelect to ignore subwords. It looks like it is supposed to work for words like foo-bar but it doesn't for me.

Mark
  • 143,421
  • 24
  • 428
  • 436