# Fix language server path displayed in LSP status tooltip \(\#62919\) · gitcafe/zed

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

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

Visibility: public

Requested revision: b0e37a6c18a6321061ba842e26ee7156729f0870

Requested commit: b0e37a6c18a6321061ba842e26ee7156729f0870

Commit: b0e37a6c18a6321061ba842e26ee7156729f0870

Tree: 1b4bf9534e6e29a2efa3b0a8193c7dd8ecc206c6

Author: Xin Zhao

Committer: GitHub

## Message

````
Fix language server path displayed in LSP status tooltip (#62919)

# Objective

Closes #52822

When hovering over the LSP status tooltip for a running language server,
the binary path is displayed. Currently, this tooltip shows
`LanguageServerBinary.path`. However, many language servers are executed
through runtimes such as Node or Python. For example, Zed-managed
`Basedpyright` produces a `LanguageServerBinary` like:
```Rust
LanguageServerBinary {
    path: "/usr/bin/node",
    arguments: [
        "/home/xin/.local/share/zed/languages/basedpyright/node_modules/basedpyright/langserver.index.js",
        "--stdio",
    ],
    env: ...
}
``` 
In this case, only `"/usr/bin/node"` is displayed, which doesn't convey
useful information about the actual language server script being
executed.

## Solution

There was a PR #53076 in which I was involved, and the solution there
was to populate every language server adapter with a special marker for
the path to be shown in the tooltip. That solution is accurate, but in
order to make this solution work for extension-provided servers, the
final diff became huge for a simple fix.

So here, as commented in
https://github.com/zed-industries/zed/pull/53076#pullrequestreview-4204849892,
a guess is performed by a newly introduced function
`tooltip_for_server_binary()` to get the real path to be shown. It may
have some edge cases, but works for current cases and is simple to
implement.

## Testing

Added new unit tests, built and tested locally, with the comparision
attached in the Showcase section.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] 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)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

For the mentioned `Basedpyright` language server case, the comparision
is shown below:
| Before | After |
|:--:|:--:|
| <img width="431" height="187" alt="before"
src="https://github.com/user-attachments/assets/0611f2fe-687b-4d67-ba78-380d89ed0212"
/> | <img width="582" height="185" alt="after"
src="https://github.com/user-attachments/assets/6ad08720-ac53-4b2d-a72c-3febb441e2f1"
/> |

---

Release Notes:

- Improved the LSP status tooltip to display the target script path for
runtime-managed language servers
````

## Parents

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

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