# Dash Separated / Kebab Case Selection Too Inclusive

**URL:** https://discuss.codemirror.net/t/dash-separated-kebab-case-selection-too-inclusive/9619
**Category:** v6
**Created:** [December 19, 2025, 4:38pm UTC](https://discuss.codemirror.net/t/dash-separated-kebab-case-selection-too-inclusive/9619 "2025-12-19T16:38:42Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![shshaw](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/shshaw/32/2184_2.png) [@shshaw](https://discuss.codemirror.net/u/shshaw)
#### Post date: [December 19, 2025, 4:38pm UTC](https://discuss.codemirror.net/t/dash-separated-kebab-case-selection-too-inclusive/9619/1 "2025-12-19T16:38:42Z")

</div>

Typically on Mac, double clicking a dash separated “word” ( `like-this-example` ) will only select the clicked segment up until a dash. (Double click `example` and you’d get `like-this-` **`example`** with the bold text showing the selection.)

Example in TextEdit: [Screen Recording 2025-12-19 at 10.mp4 - Droplr](https://d.pr/v/ixTBmI)

In CodeMirror 5, that’s how it works: [Screen Recording 2025-12-19 at 10.mp4 - Droplr](https://d.pr/v/0CD78H)

But in CodeMirror 6, the whole dash separated word is selected: [Screen Recording 2025-12-19 at 10.mp4 - Droplr](https://d.pr/v/lIRVvJ)

> **[Try CodeMirror](https://codemirror.net/try/#c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge2Nzc30gZnJvbSAiQGNvZGVtaXJyb3IvbGFuZy1jc3MiCgpuZXcgRWRpdG9yVmlldyh7CiAgZG9jOiBgLmZpcnN0LXNlY29uZC10aGlyZCB7CiAgYmFja2dyb3VuZC1jb2xvcjogZ3JlZW47CiAgZmxleC13cmFwOiB3cmFwLXJldmVyc2U7Cn1gLAogIGV4dGVuc2lvbnM6IFtiYXNpY1NldHVwLCBjc3MoKV0sCiAgcGFyZW50OiBkb2N1bWVudC5ib2R5Cn0pCg==)**

If I’m understanding this question ( [Can I change what constitutes a "word" in terms of selection?](https://discuss.codemirror.net/t/can-i-change-what-constitutes-a-word-in-terms-of-selection/5747) ) correctly, then this selection functionality is due to the CSS languages containing `wordChar` of `-`.

This is unexpected for some of our users. Is there a simple way to change that or does it require making your own CSS `LRLanguage` (and any CSS based language) to override the `wordChar` option?

And if you do override the `wordChar` option, what other features does that affect?

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [December 22, 2025, 9:43am UTC](https://discuss.codemirror.net/t/dash-separated-kebab-case-selection-too-inclusive/9619/2 "2025-12-22T09:43:24Z")

</div>

> [@shshaw](#):
>
> Is there a simple way to change that

There wasn’t, but that wouldn’t do, so now there is.

> <https://github.com/codemirror/language/commit/a8de2ea32868710bbcebebe3246b65dc5e01b1f3>
>
> FEATURE: \`LRLanguage.reconfigure\` now supports changing the language data associ…ated
> with the language.
> 
> See https://discuss.codemirror.net/t/dash-separated-kebab-case-selection-too-inclusive/9619

> [@shshaw](#):
>
> And if you do override the `wordChar` option, what other features does that affect?

Anything that works with words, like by-word cursor motion, will be affected by this.

(It’s not always necessary to change something as soon as a user complains. Being able to select entire identifiers by double clicking is really quite convenient.)

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [December 22, 2025, 3:36pm UTC](https://discuss.codemirror.net/t/dash-separated-kebab-case-selection-too-inclusive/9619/3 "2025-12-22T15:36:15Z")

</div>

Actually, ignore that patch I linked. It is very broken. With @codemirror/state 6.5.3 you can now add a higher-precedence bit of language data (`cssLanguage.data.of({wordChars: ""})`) to your configuration to override the default word characters.

---

<div class="post-metadata">

### Author: ![shshaw](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/shshaw/32/2184_2.png) [@shshaw](https://discuss.codemirror.net/u/shshaw)
#### Post date: [December 23, 2025, 5:59pm UTC](https://discuss.codemirror.net/t/dash-separated-kebab-case-selection-too-inclusive/9619/4 "2025-12-23T17:59:44Z")

</div>

Thanks for the quick response & solution! That’s a much better way to patch this. We’ll do some testing and see if we want to offer this by default or via an option for users.

---

<div class="post-metadata">

### Author: ![shshaw](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/shshaw/32/2184_2.png) [@shshaw](https://discuss.codemirror.net/u/shshaw)
#### Post date: [April 29, 2026, 4:35pm UTC](https://discuss.codemirror.net/t/dash-separated-kebab-case-selection-too-inclusive/9619/5 "2026-04-29T16:35:24Z")

</div>

To be clear: In order to implement this across any CSS-like language (Sass, Less, etc), you’d need to add `sassLanguage.data.of({ wordChars: "" })` extension for each language?

---

<div class="post-metadata">

### Author: ![shshaw](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/shshaw/32/2184_2.png) [@shshaw](https://discuss.codemirror.net/u/shshaw)
#### Post date: [August 12, 2026, 8:39pm UTC](https://discuss.codemirror.net/t/dash-separated-kebab-case-selection-too-inclusive/9619/6 "2026-08-12T20:39:59Z")

</div>

@marijn Just to confirm: This setting has to be overridden in _every_ CSS language?

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [August 14, 2026, 9:40am UTC](https://discuss.codemirror.net/t/dash-separated-kebab-case-selection-too-inclusive/9619/7 "2026-08-14T09:40:59Z")

</div>

Yes, they have different language IDs, so there’s no way to reconfigure all of them in one go.
