# project: Workaround invalid code action edits from pyright \(\#28354\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 38ec45008c69bc1d8042318708905f9baae311ed

Requested commit: 38ec45008c69bc1d8042318708905f9baae311ed

Commit: 38ec45008c69bc1d8042318708905f9baae311ed

Tree: 0d549fbdf070c6f5e9ba63e344e0326f1bd125eb

Author: Ben Kunkle

Committer: GitHub

## Message

````
project: Workaround invalid code action edits from pyright (#28354)

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Piotr Osiewicz <piotr@zed.dev>

fixes issue where:

In a two line python file like so
```

Path()
```

If the user asks for code actions on `Path` and they select (`From
pathlib import path`)
the result they get is
```

Pathfrom pathlib import Path


Path()
```
Instead of 

```

from pathlib import Path



Path()
```

This is due to a non-lsp-spec-compliant response from pyright below

```json
{"jsonrpc":"2.0","id":40,"result":[{"title":"from pathlib import Path","edit":{"changes":{"file:///Users/neb/Zed/example-project/pyright-project/main.py":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":4}},"newText":"Path"},{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"newText":"from pathlib import Path\n\n\n"}]}},"kind":"quickfix"}]}
```

Release Notes:

- Fixed an issue when using auto-import code actions provided by pyright
(or basedpyright) where the import would be jumbled with the scoped
import resulting in an invalid result

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
````

## Parents

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

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