# editor: Fix function completion expansion in string contexts and call expressions \(\#30351\) · gitcafe/zed

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

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

Visibility: public

Requested revision: b88ba44b32ec08b67399bb7dde70a648461848a0

Requested commit: b88ba44b32ec08b67399bb7dde70a648461848a0

Commit: b88ba44b32ec08b67399bb7dde70a648461848a0

Tree: c5aeefac02663753f5b553d51d28da3549170607

Author: Smit Barmase

Committer: GitHub

## Message

```
editor: Fix function completion expansion in string contexts and call expressions (#30351)

Closes #27582

Now, when accepting function completion, it doesn't expand with
parentheses and arguments in the following cases:
1. If it's in a string (like `type Foo = MyClass["sayHello"]` instead of
`type Foo = MyClass["sayHello(name)"]`)
2. If it's in a call expression (like `useRef<HTMLDivElement>(null)`
over `useRef(initialValue)<HTMLDivElement>(null)`)

This is a follow-up to https://github.com/zed-industries/zed/pull/30312,
more like cleaner version of it.

Release Notes:

- Fixed an issue where accepting a method as an object string in
JavaScript would incorrectly expand. E.g. `MyClass["sayHello(name)"]`
instead of `MyClass["sayHello"]`.
```

## Parents

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

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