Double-click selection should respect language token boundaries
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
## Current behavior
Double-click selection appears to be based on generic word separators rather than language tokens.
For example, in JavaScript:
```js
const a = 34.8;
```
Double-clicking may select either 34 or 8 depending on which side of the decimal is clicked, even though 34.8 is a single numeric literal.
The same applies to other numeric forms:
```js
1e-6
0xff
0b1010
1_000_000
123n
```
## Expected behavior
When language tokenization is available, double-click selection should select the entire language token.
## Why `editor.wordSeparators` isn't sufficient
Changing word separator behavior globally would also affect unrelated constructs such as:
`user.profile.name`
where selecting only the clicked identifier is usually the desired behavior.
The editor already recognizes numeric literals as single tokens for syntax highlighting and other language features, so it seems reasonable for double-click selection to use the same token boundaries when available.
This could also benefit other token types where punctuation is part of a single language token (for example, regex literals or CSS color literals), but numeric literals are the clearest and most common example.
Contributor guide
Research direction
Start by tracing how double-click selection uses editor.wordSeparators, then compare that path with the language tokenization used for syntax highlighting. Check how numeric literals such as 34.8, 1e-6, 0xff, and 1_000_000 are represented, while preserving identifier selection in user.profile.name. Done means selection follows language token boundaries when available without changing generic word behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- desktop, developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100