Skip to content

agent: LSP tools - #55744

Merged
cameron1024 merged 7 commits into
mainfrom
lsp-tool
May 5, 2026
Merged

agent: LSP tools#55744
cameron1024 merged 7 commits into
mainfrom
lsp-tool

Conversation

@cameron1024

@cameron1024 cameron1024 commented May 5, 2026

Copy link
Copy Markdown
Contributor

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:

  • N/A

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 5, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label May 5, 2026

@bennetbo bennetbo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's experiment with it and see how it feels

@cameron1024
cameron1024 enabled auto-merge May 5, 2026 09:25
@cameron1024
cameron1024 added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit f482f9e May 5, 2026
31 checks passed
@cameron1024
cameron1024 deleted the lsp-tool branch May 5, 2026 09:38
@morgankrey morgankrey mentioned this pull request May 5, 2026
@AJenbo

AJenbo commented May 5, 2026

Copy link
Copy Markdown
Contributor

Made some improvements based on testing #55803

ebaah46 pushed a commit to ebaah46/zed that referenced this pull request May 6, 2026
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>
@AJenbo

AJenbo commented May 9, 2026

Copy link
Copy Markdown
Contributor

The agent seems surprised that the rename tool doesn't save the files it edits:

Many unsaved files. The rename tool updated them but they weren't saved. Let me save all of them:

This caused it to have to do grep to find all unsaved files and then save them one by one or simply do the edits again manually. It probably spent as much time trying to recover form this as it would have if it did all the edits traditionally. This should probably be addressed if the tool it to be made generally available, either by having it save, letting it be an option, or making it clear to the agent that the tool doesn't save the changes.

jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
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>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants