Vscode: Customisable double click-select behaviour

Created on 14 Jan 2016  路  12Comments  路  Source: microsoft/vscode

Upon double-clicking, people have different expectations across various languages.
The ability to define custom highlighting rules based on the selected text would simultaneously solve a lot of highlighting issues and increase the flexibility of the editor.

My motivation for bringing this up comes from my frustration with variable selection in PHP.
When double-clicking 'foo' in '$foo->bar()' you will end up selecting '$foo-', my preference would be 'foo'.
I also noticed another issue regarding double clicking white-space where the user would like it to select all connected white-space.
These kinds of rules would be perfectly suited for on the fly user customisation.

editor feature-request languages-basic

Most helpful comment

@jtarbox Yes, please try changing the following setting that now customizes word definitions when doing word operations:

// default:
, "editor.wordSeparators": "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?"
// without $:
, "editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?"

All 12 comments

I would love to see that as well. Sometimes I need to replace just part of the string. For example a part of class name in CSS like .block--modifier but the default double click selects whole class. Making the behavior customizable would solve this.

May I add a simple use case: The first time I select a string via douple-click I would like the selection to _exclude_ the double quotes.

I noticed a change with the recent update with how this behaved. For PHP, could we have this as an editable option or something? As I would personally prefer it grab the preceding '$' character when double-click selecting.

@jtarbox Yes, please try changing the following setting that now customizes word definitions when doing word operations:

// default:
, "editor.wordSeparators": "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?"
// without $:
, "editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?"

Actually, I think the new option editor.wordSeparators that just shipped with 0.10.11 resolves this issue

thx, worked perfectly! (still getting used to the text based settings)

Thank you! Works great!

This just made my day. Works like a charm.

This is great, I removed the dollar for angular coding.
Is there a way to specify this for different languages?
Or do I need to edit my settings file each time I change language?

This is great, I removed '$' from editor.wordSeparators and now I can double click on PowerShell variables and get the entire variable '$var' in my clipboard.

Fantastic configuration feature. I have immediatelly removed $ from that ;-) I'm used to $variable being selected ;-)

These days I came across this issue of double click behavior. I noticed that most of the time I would like to "select the whole string", but it was annoying me. So, what if I double click on a "-" and the behavior would be something like "select an entire string". If I clicked on a word (as we usually do) would I still have the default behavior?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jsftw86 picture jsftw86  路  361Comments

Tekbr picture Tekbr  路  191Comments

fabiopicchi picture fabiopicchi  路  192Comments

Brakkar picture Brakkar  路  364Comments

niagr picture niagr  路  246Comments