# Fix panic when clicking on a definition · gitcafe/zed

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

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

Visibility: public

Requested revision: e566929d9eed8d7897396ab65d1a2989357fe19e

Requested commit: e566929d9eed8d7897396ab65d1a2989357fe19e

Commit: e566929d9eed8d7897396ab65d1a2989357fe19e

Tree: a328cf5c342c48e6a69a6eec9fd5dd49004f76e1

Author: Antonio Scandurra

Committer: Antonio Scandurra

## Message

```
Fix panic when clicking on a definition

This was introduced with #2420 and was caused by re-entrantly updating
the workspace. Instead of passing the workspace reference from the outside,
we now define the definition navigation as a method on the editor which solves
the issue.

Note that we also needed to introduce a `defer` call when navigating to a definition
to prevent the workspace from reading the editor during `open_project_item`.

```

## Parents

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

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