# editor: Fix double $ sign on completion accept in PHP \(\#34726\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/1dd470ca48fef83e920972f175f232f9ea252b44)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 1dd470ca48fef83e920972f175f232f9ea252b44

Requested commit: 1dd470ca48fef83e920972f175f232f9ea252b44

Commit: 1dd470ca48fef83e920972f175f232f9ea252b44

Tree: 691302c7e9c1f8437f58fdb3f800307838d2b9ed

Author: Smit Barmase

Committer: GitHub

## Message

```
editor: Fix double $ sign on completion accept in PHP (#34726)

Closes #33510 https://github.com/zed-extensions/php/issues/29

If certain language servers do not provide an insert/replace range, we
use `surrounding_word` as a fallback for that range, which internally
uses `word_characters`. It makes sense to use
`completion_query_characters` instead of `word_characters` to get that
range, because we use `completion_query_characters` to query completions
in the first place.

That means, for some hypothetical reason (e.g., if the Tailwind server
stops providing insert/replace ranges), we would correctly fall back to
the range "bg-blue-200^" instead of "200^", because
`completion_query_characters` includes "-" in this case.

For this particular fix, right now the default PHP language server
`phpactor` does not provide an insert/replace range, and hence
completion query character is used, which is `$` in this case.

Note that `$` isn't in word characters for reasons mentioned here:
https://github.com/zed-extensions/php/issues/14

Release Notes:

- Fixed an issue where accepting variable completion in PHP would result
in a double $ sign in the prefix.
```

## Parents

- [8bc8d61fa6991cf0f1a675088a2a5e6356d16a6a](https://git.cafe/gitcafe/zed/commit/8bc8d61fa6991cf0f1a675088a2a5e6356d16a6a?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/1dd470ca48fef83e920972f175f232f9ea252b44?format=markdown)
