Skip to content

Adapt suggestions to available terminal space - #498

Open
Yaroslav Slepukhin (yslpn) wants to merge 1 commit into
microsoft:mainfrom
yslpn:adaptive-suggestion-layout
Open

Yaroslav Slepukhin (yslpn) wants to merge 1 commit into
microsoft:mainfrom
yslpn:adaptive-suggestion-layout

Conversation

@yslpn

Copy link
Copy Markdown

Closes #497

Autocomplete currently disappears when its full popup does not fit in the terminal. This change adapts the suggestion list and description to the available space, which keeps completions usable in small VS Code terminal panes.

What it looks like

These examples are taken from the terminal resize snapshots. The outer ASCII border represents the terminal boundaries; the inner boxes are the suggestion list and description.

Narrow terminal: description moves below the list

+-----------------------+
| > git st              |
| ┌───────────────────┐ |
| │📦 stage           │ |
| │📦 status          │ |
| │📦 stash           │ |
| └───────────────────┘ |
| ┌───────────────────┐ |
| │Add file contents  │ |
| │to the staging area│ |
| └───────────────────┘ |
+-----------------------+

Less height: the description is truncated, then hidden

+-----------------------+
| > git st              |
| ┌───────────────────┐ |
| │📦 stage           │ |
| │📦 status          │ |
| │📦 stash           │ |
| └───────────────────┘ |
| ┌───────────────────┐ |
| │Add file contents …│ |
| └───────────────────┘ |
+-----------------------+
+-----------------------+
| > git st              |
| ┌───────────────────┐ |
| │📦 stage           │ |
| │📦 status          │ |
| │📦 stash           │ |
| └───────────────────┘ |
+-----------------------+

Even less height: the list shrinks; keyboard navigation keeps other suggestions accessible

+-----------------------+
| > git st              |
| ┌───────────────────┐ |
| │📦 stage           │ |
| │📦 status          │ |
| └───────────────────┘ |
+-----------------------+

The popup also truncates long text to the available width and preserves the selected suggestion while navigating and resizing.

Validation

  • TypeScript build
  • 43 focused unit tests covering the suggestion manager, renderer and text formatting
  • Terminal resize snapshots cover stacked, truncated and hidden descriptions, reduced suggestion counts and restoring the original layout.

@yslpn

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adapt autocomplete suggestions and descriptions to small terminal panes

1 participant