Skip to content

Commit

Permalink
Make widget manager not know about hovers
Browse files Browse the repository at this point in the history
This also no longer dismisses the hover when terminal output occurs, this
was over zealous anyway. The actual bug it was trying to fix it tracked
in #95081
  • Loading branch information
Tyriar committed Apr 17, 2020
1 parent 1234dc5 commit 186a07b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
11 changes: 5 additions & 6 deletions src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {

private _messageTitleDisposable: IDisposable | undefined;

private _hoverManager: TerminalWidgetManager = this._instantiationService.createInstance(TerminalWidgetManager);
private _widgetManager: TerminalWidgetManager = this._instantiationService.createInstance(TerminalWidgetManager);
private _linkManager: TerminalLinkManager | undefined;
private _environmentVariableWidget: EnvironmentVariableInfoWidget | undefined;
private _commandTrackerAddon: CommandTrackerAddon | undefined;
Expand Down Expand Up @@ -587,8 +587,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this._refreshSelectionContextKey();
}));

this._hoverManager.attachToElement(this._wrapperElement);
this._processManager.onProcessReady(() => this._linkManager?.setWidgetManager(this._hoverManager));
this._widgetManager.attachToElement(this._wrapperElement);
this._processManager.onProcessReady(() => this._linkManager?.setWidgetManager(this._widgetManager));

const computedStyle = window.getComputedStyle(this._container);
const width = parseInt(computedStyle.getPropertyValue('width').replace('px', ''), 10);
Expand Down Expand Up @@ -723,7 +723,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this._linkManager = undefined;
dispose(this._commandTrackerAddon);
this._commandTrackerAddon = undefined;
dispose(this._hoverManager);
dispose(this._widgetManager);

if (this._xterm && this._xterm.element) {
this._hadFocusOnExit = dom.hasClass(this._xterm.element, 'focus');
Expand Down Expand Up @@ -917,7 +917,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}

private _onProcessData(data: string): void {
this._hoverManager?.closeHover();
this._xterm?.write(data);
}

Expand Down Expand Up @@ -1363,7 +1362,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
private _onEnvironmentVariableInfoChanged(info: IEnvironmentVariableInfo): void {
this._environmentVariableWidget?.dispose();
this._environmentVariableWidget = this._instantiationService.createInstance(EnvironmentVariableInfoWidget, info);
this._hoverManager.attachWidget(this._environmentVariableWidget);
this._widgetManager.attachWidget(this._environmentVariableWidget);
}

private _getXtermTheme(theme?: IColorTheme): any {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
*--------------------------------------------------------------------------------------------*/

import { IDisposable } from 'vs/base/common/lifecycle';
import { HoverWidget } from 'vs/workbench/contrib/terminal/browser/widgets/hoverWidget';
import { ITerminalWidget } from 'vs/workbench/contrib/terminal/browser/widgets/widgets';

export class TerminalWidgetManager implements IDisposable {
private _container: HTMLElement | undefined;
private _xtermViewport: HTMLElement | undefined;
private _hoverWidget: HoverWidget | undefined;
private _attached: Map<string, ITerminalWidget> = new Map();

attachToElement(terminalWrapper: HTMLElement) {
Expand Down Expand Up @@ -48,10 +46,6 @@ export class TerminalWidgetManager implements IDisposable {
};
}

closeHover(): void {
this._hoverWidget?.dispose();
}

private _trackTerminalDimensions(terminalWrapper: HTMLElement) {
// Watch the xterm.js viewport for style changes and do a layout if it changes
this._xtermViewport = <HTMLElement>terminalWrapper.querySelector('.xterm-viewport');
Expand Down

0 comments on commit 186a07b

Please sign in to comment.