Sublime Forum

ST4: Word selection (word_separators) in javascript syntax

#1

I used to select words by double clicking or selection with keyboard (shift + control + arrow keys).

This works fine until ST4 and javascript syntax. Only in javascript syntax, the word selection does not work as expected.

Example:
ezgif-6-42f68fe932d3

The settings for word_separators is:
“word_separators”: “./\()”’:,.;<>~!@#%^&*|+=[]{}`~?$",

0 Likes

#2

looks like you answered your own question - - is not in the word separators.
Maybe you changed something, looks like it is there by default: https://github.com/sublimehq/Packages/pull/2793/files

0 Likes

#3

It’s still weird that JavaScript seems to ignore this settings though. I have confirmed this behavior. That is to say, if you remove - from the list of word separators, JavaScript syntax highlighting causes it to still treat it as one. Maybe that is what they meant?

0 Likes

#4

well it’s overridden in the syntax specific settings, which take precedence over User settings, no?

0 Likes

#5

Oh, right. That makes sense.

0 Likes

#6

Good to know. The user settings in syntax specific settings in javascript were completely empty. So the default settings in syntax-specific overwrites the global user-specific settings.

So I need to repeat these settings in every syntax… Great!

0 Likes

#7

It was done in JS/JSX/TS/TSX because the dollar-sign ($) can be part of an identifier. e.g. $foo can be a variable name. You want to be able to double-click on $foo and select the whole identifier, not just the foo part.

I’m not too familiar with JS but I don’t think - can be part of an identifier. If that’s indeed the case then the behavior makes complete sense to me.

0 Likes