-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: terminal suggestion positioning #199420
fix: terminal suggestion positioning #199420
Conversation
Signed-off-by: Chapman Pendery <cpendery@microsoft.com>
Signed-off-by: Chapman Pendery <cpendery@microsoft.com>
if (!dimensions.width || !dimensions.height) { | ||
return; | ||
} | ||
// TODO: What do frozen and auto do? | ||
const xtermBox = this._terminal.element.getBoundingClientRect(); | ||
const xtermBox = this._terminal.element!.querySelector('.xterm-screen')!.getBoundingClientRect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I'll merge this when we branch the release off (likely this Friday). In the meantime if you want to build more upon this you can checkout with this branch as the base and make the PR against that:
git checkout fix/terminal-suggestion-positioning
git checkout -b fix/terminal-suggestion-positioning__second
Or just independently if they don't conflict
private _getTerminalDimensions(): { width: number; height: number } { | ||
return { | ||
width: (this._terminal as any)._core._renderService.dimensions.css.cell.width, | ||
height: (this._terminal as any)._core._renderService.dimensions.css.cell.height, | ||
}; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a slightly safer way of doing this:
((this._terminal as any)._core as IXtermCore)._renderService.dimensions.css.cell.height
We can also pull _core
out on activate
so we just do the cast a single time.
if (!dimensions.width || !dimensions.height) { | ||
return; | ||
} | ||
// TODO: What do frozen and auto do? | ||
const xtermBox = this._terminal.element!.getBoundingClientRect(); | ||
const xtermBox = this._terminal.element!.querySelector('.xterm-screen')!.getBoundingClientRect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If/when we move SuggestAddon
into a terminalContrib we can do this a single time in ITerminalContribution.xtermOpen
Description
Fixes the position of the terminal suggestions modal.
Testing