Skip to content

debugger: Add support for inline value hints - #28656

Merged
Anthony-Eid merged 24 commits into
zed-industries:mainfrom
RemcoSmitsDev:debugger-inline-value
Apr 23, 2025
Merged

debugger: Add support for inline value hints#28656
Anthony-Eid merged 24 commits into
zed-industries:mainfrom
RemcoSmitsDev:debugger-inline-value

Conversation

@RemcoSmitsDev

@RemcoSmitsDev RemcoSmitsDev commented Apr 13, 2025

Copy link
Copy Markdown
Collaborator
Screenshot 2025-04-13 at 18 26 11

TODO:

  • Invalidate inline values after specific debug actions
  • Fix crash caused by stack frame context range
  • Add support for custom InlineValue Providers

After merge

  • Add better support for locale/scopes. based on variables.kind
    • use text object to dertermine this information.
    • show global scope variables outside all function scopes
  • Allow clicking on inlay variables show nested variables + update variable value

Edit by Zed Team

Context

This PR uses Tree Sitter to show inline values while a user is in a debug session.

We went with Tree Sitter over the LSP Inline Values request because the LSP request isn't widely supported. Tree Sitter is easy for languages/extensions to add support to. Tree Sitter can compute the inline values locally, so there's no need to add extra RPC messages for Collab. Tree Sitter also gives Zed more control over how we want to show variables.

There's still more work to be done after this PR, namely differentiating between global/local scoped variables, but it's a great starting point to start iteratively improving it.

Release Notes:

  • N/A

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 13, 2025
RemcoSmitsDev and others added 16 commits April 13, 2025 18:27
Co-authored-by: Piotr Osiewicz <peterosiewicz@gmail.com>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Remco Smits <djsmits12@gmail.com>
Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Remco Smits <djsmits12@gmail.com>
We only need the first level variables because we match nested variables
with the evaluate request
co-authored-by: Kirill <kirill@zed.dev>
Co-authored-by: Remco Smits <djsmits12@gmail.com>
Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Remco Smits <djsmits12@gmail.com>
Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Remco Smits <djsmits12@gmail.com>
Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Remco Smits <djsmits12@gmail.com>
Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Remco Smits <djsmits12@gmail.com>
@Anthony-Eid Anthony-Eid self-assigned this Apr 23, 2025
Anthony-Eid and others added 3 commits April 23, 2025 16:56
@Anthony-Eid
Anthony-Eid marked this pull request as ready for review April 23, 2025 21:37
Comment thread crates/project/src/debugger/session.rs Outdated
authored-by: Remco Smits <djsmits12@gmail.com>
@Anthony-Eid
Anthony-Eid enabled auto-merge (squash) April 23, 2025 22:10
@Anthony-Eid

Copy link
Copy Markdown
Contributor

Hats off to @RemcoSmitsDev with this PR! Great work

@Anthony-Eid
Anthony-Eid merged commit 2184967 into zed-industries:main Apr 23, 2025
pull Bot pushed a commit to kp-forks/zed that referenced this pull request Jun 9, 2026
The `ToggleInlineValues` action was added when inline value hints were
introduced, but the action was never registered, so it was not
dispatchable: it never appeared in the command palette and any
keybinding bound to it had no effect.

Follow-up to zed-industries#28656.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Closes zed-industries#58890.

Release Notes:

- Fixed “editor: toggle inline values” not appearing in the command
palette or responding to keybindings
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
The `ToggleInlineValues` action was added when inline value hints were
introduced, but the action was never registered, so it was not
dispatchable: it never appeared in the command palette and any
keybinding bound to it had no effect.

Follow-up to zed-industries#28656.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Closes zed-industries#58890.

Release Notes:

- Fixed “editor: toggle inline values” not appearing in the command
palette or responding to keybindings
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
This PR uses Tree Sitter to show inline values while a user is in a
debug session.

We went with Tree Sitter over the LSP Inline Values request because the
LSP request isn't widely supported. Tree Sitter is easy for
languages/extensions to add support to. Tree Sitter can compute the
inline values locally, so there's no need to add extra RPC messages for
Collab. Tree Sitter also gives Zed more control over how we want to show
variables.

There's still more work to be done after this PR, namely differentiating
between global/local scoped variables, but it's a great starting point
to start iteratively improving it.

Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <peterosiewicz@gmail.com>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Anthony <anthony@zed.dev>
Co-authored-by: Kirill <kirill@zed.dev>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
The `ToggleInlineValues` action was added when inline value hints were
introduced, but the action was never registered, so it was not
dispatchable: it never appeared in the command palette and any
keybinding bound to it had no effect.

Follow-up to zed-industries#28656.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Closes zed-industries#58890.

Release Notes:

- Fixed “editor: toggle inline values” not appearing in the command
palette or responding to keybindings
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants