# debugger: Improve debug console autocompletions \(\#33868\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 66e45818af4c93c64bf0707de1103cb23ecb34e6

Requested commit: 66e45818af4c93c64bf0707de1103cb23ecb34e6

Commit: 66e45818af4c93c64bf0707de1103cb23ecb34e6

Tree: 436c21e94df2b816b1982482533e29c7f4247f49

Author: Remco Smits

Committer: GitHub

## Message

```
debugger: Improve debug console autocompletions (#33868)

Partially fixes:
https://github.com/zed-industries/zed/discussions/33777#discussioncomment-13646294

### Improves debug console autocompletion behavior

This PR fixes a regression in completion trigger support for the debug
console, as we only looked if a completion trigger, was in the beginning
of the search text, but we also had to check if the current text is a
word so we also show completions for variables/input that doesn't start
with any of the completion triggers.

We now also leverage DAP provided information to sort completion items
more effectively. This results in improved prioritization, showing
variable completions above classes and global scope types.

I also added for completion the documentation field, that directly comes
from the DAP server. NOTE: I haven't found an adapter that returns this,
but it needs to have.

**Before**
<img width="1200" alt="Screenshot 2025-07-03 at 21 00 19"
src="https://github.com/user-attachments/assets/611e8d38-e302-4995-a425-ce2c0a1843d4"
/>

**After**
<img width="1200" alt="Screenshot 2025-07-03 at 20 59 38"
src="https://github.com/user-attachments/assets/ab1312db-bbad-49b7-872d-712d6ec708d7"
/>

Release Notes:

- Debugger: Improve autocompletion sorting for debug console
- Debugger: Fix autocompletion menu now shown when you type
- Debugger: Fix completion item showing up twice for some adapters
```

## Parents

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

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