# Add lua script access to code using \`cx\` \+ reuse project search logic \(\#26269\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 205f9a9f0391da47a87cac45a41f67d2a23f5a95

Requested commit: 205f9a9f0391da47a87cac45a41f67d2a23f5a95

Commit: 205f9a9f0391da47a87cac45a41f67d2a23f5a95

Tree: 1e776bfe31adf283fc015cfeaf9baff4f0954860

Author: Michael Sloan

Committer: GitHub

## Message

```
Add lua script access to code using `cx` + reuse project search logic (#26269)

Access to `cx` will be needed for anything that queries entities. In
this commit this is use of `WorktreeStore::find_search_candidates`. In
the future it will be things like access to LSP / tree-sitter outlines /
etc.

Changes to support access to `cx` from functions provided to the Lua
script:

* Adds a channel of requests that require a `cx`. Work enqueued to this
channel is run on the foreground thread.

* Adds `async` and `send` features to `mlua` crate so that async rust
functions can be used from Lua.

* Changes uses of `Rc<RefCell<...>>` to `Arc<Mutex<...>>` so that the
futures are `Send`.

One benefit of reusing project search logic for search candidates is
that it properly ignores paths.

Release Notes:

- N/A
```

## Parents

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

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