Closed dimitrisnl closed 1 week ago
I believe this is language dependent (for example this doesn't happen in JSON) based on the tree-sitter queries. Which language(s) are you seeing this issue?
I can confirm that this doesn't happen in JSON!
This happens in Elixir (.ex
& .heex
) and Javascript (.js
& .jsx
)
This happens in Elixir (
.ex
&.heex
) and Javascript (.js
&.jsx
)
I believe this was done to support easy-selecting of kebab-case css things and is controlled by these lines:
https://github.com/zed-industries/zed/blob/80594cc7f823ad7324ba2578fd38c2225c9aa0b5/extensions/elixir/languages/heex/config.toml#L12 https://github.com/zed-industries/zed/blob/80594cc7f823ad7324ba2578fd38c2225c9aa0b5/extensions/elixir/languages/elixir/config.toml#L16-L17 https://github.com/zed-industries/zed/blob/80594cc7f823ad7324ba2578fd38c2225c9aa0b5/crates/languages/src/tsx/config.toml#L26-L27
I (personally) would prefer consistent behavior across filetypes, but I'm not sure.
Seconding this issue. I was annoyed by Zed's unique behavior here when I was editing a filepath containing dashes in a CSS file.
I started looking in to this today – Here is the problem. I'll use tsx
as an example here.
If we remove overrides.string.word_characters
for tsx it does fix the selection problem:
https://github.com/user-attachments/assets/02bec82e-b6ae-4cf1-a4d0-c47b930e97f6
However it creates a larger problem: All completions stop working after the first -
in a class
/className
. In the case of Typescript/Javascript this completely breaks completions from the TailwindLSP.
It seems like we need a way to opt out of overrides.string.word_characters
for selections, but not for related LSPs.
Here is the PR that introduce this: https://github.com/zed-industries/zed/commit/fc457d45f5f529fa4d0ade52c48b62516baa388c
In terms of next steps, I'll see if someone here who is more familiar with selections & completions can weigh in on what to do next.
Check for existing issues
Describe the bug / provide steps to reproduce it
In the following example I want to select the
white
part, and replace it withred
.Zed will select the whole world, and instead of
bg-red
I'll find myself having writtenred
,In other editors like VSCode, I can select the substring just fine on a double click. This is a common issue when using Tailwind.![CleanShot 2024-08-01 at 14 42 06](https://github.com/user-attachments/assets/047036d8-f0a3-4458-a709-9249a3f9b19b)
Environment
Zed: v0.145.1 (Zed) OS: macOS 14.4.1 Memory: 18 GiB Architecture: aarch64
I've also opened a discussion couple months ago, but nothing came out of it, so I'm opening this ticket instead.