# agent: LSP tools \(\#55744\) · gitcafe/zed

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

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

Visibility: public

Requested revision: f482f9e18c1d8bae9433b6723e557e0a3cdd06bd

Requested commit: f482f9e18c1d8bae9433b6723e557e0a3cdd06bd

Commit: f482f9e18c1d8bae9433b6723e557e0a3cdd06bd

Tree: c864a66eb35ea027c44fd8888d354e5a9d16bb17

Author: Cameron Mcloughlin

Committer: GitHub

## Message

```
agent: LSP tools (#55744)

Adds 4 (technically 5) new tools to the zed agent, corresponding to LSP
actions:
- `find_references`
- `goto_definition`
- `rename_symbol`
- `get_code_actions` and `apply_code_actions`

Notes:
- `rename_symbol` skips doing a `prepare_rename`. If there is nothing to
rename at the position, it will forward the error to the agent
- The code action tools are stateful. The state is stored in the
`get_code_actions` tool itself as a `PendingCodeActions`. It is not
passed into/out of subagents. Calling `apply_code_actions` without
calling `get_code_actions` first is an error, but I've never seen an
agent do this

Symbols are identified by:
- file name
- line number
- symbol

If there is no substring match on that line for the symbol text, it is
an error. If there are multiple, it chooses the first. This may not be
great if you have a line like: `fn convert(x: foo::Something) ->
bar::Something` - the second `Something` is a different symbol, but is
inacessible to these tools. Probably fine for now, but we can look into
improving


Release Notes:

- Added: New tools for the Zed Agent for interacting with language
servers

---------

Co-authored-by: Lukas Wirth <me@lukaswirth.dev>
```

## Parents

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

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