Skip to content

Commit a4dec1a

Browse files
committed
Address pr feedback
1 parent d4677c3 commit a4dec1a

3 files changed

Lines changed: 23 additions & 15 deletions

File tree

src/vs/workbench/parts/debug/common/debug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ export interface IDebugConfiguration {
351351
showInStatusBar: 'never' | 'always' | 'onFirstSessionStart';
352352
internalConsoleOptions: 'neverOpen' | 'openOnSessionStart' | 'openOnFirstSessionStart';
353353
extensionHostDebugAdapter: boolean;
354-
hideNonDebugHovers: boolean;
354+
enableAllHovers: boolean;
355355
}
356356

357357
export interface IGlobalConfig {

src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ configurationRegistry.registerConfiguration({
205205
default: 'openOnFirstSessionStart',
206206
description: nls.localize('openDebug', "Controls whether debug view should be open on debugging session start.")
207207
},
208-
'debug.hideNonDebugHovers': {
208+
'debug.enableAllHovers': {
209209
type: 'boolean',
210-
description: nls.localize({ comment: ['This is the description for a setting'], key: 'hideNonDebugHovers' }, "Controls if the non debug hovers should be hidden while debugging. If false the hover providers will be called to provide a hover. Regular hovers will not be shown even if this setting is false."),
211-
default: true
210+
description: nls.localize({ comment: ['This is the description for a setting'], key: 'enableAllHovers' }, "Controls if the non debug hovers should be enabled while debugging. If true the hover providers will be called to provide a hover. Regular hovers will not be shown even if this setting is true."),
211+
default: false
212212
},
213213
'launch': {
214214
type: 'object',

src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as nls from 'vs/nls';
77
import * as errors from 'vs/base/common/errors';
88
import { TPromise } from 'vs/base/common/winjs.base';
9-
import { RunOnceScheduler, asWinJsPromise } from 'vs/base/common/async';
9+
import { RunOnceScheduler } from 'vs/base/common/async';
1010
import * as lifecycle from 'vs/base/common/lifecycle';
1111
import * as env from 'vs/base/common/platform';
1212
import uri from 'vs/base/common/uri';
@@ -16,7 +16,7 @@ import { Constants } from 'vs/editor/common/core/uint';
1616
import { IAction, Action } from 'vs/base/common/actions';
1717
import { KeyCode } from 'vs/base/common/keyCodes';
1818
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
19-
import { StandardTokenType, HoverProviderRegistry } from 'vs/editor/common/modes';
19+
import { StandardTokenType } from 'vs/editor/common/modes';
2020
import { DEFAULT_WORD_REGEXP } from 'vs/editor/common/model/wordHelper';
2121
import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser';
2222
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
@@ -45,6 +45,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
4545
import { ContextSubMenu } from 'vs/base/browser/contextmenu';
4646
import { memoize } from 'vs/base/common/decorators';
4747
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
48+
import { getHover } from 'vs/editor/contrib/hover/getHover';
4849

4950
const HOVER_DELAY = 300;
5051
const LAUNCH_JSON_REGEX = /launch\.json$/;
@@ -240,6 +241,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
240241
this.toDispose.push(this.editor.onMouseDown((e: IEditorMouseEvent) => this.onEditorMouseDown(e)));
241242
this.toDispose.push(this.editor.onMouseMove((e: IEditorMouseEvent) => this.onEditorMouseMove(e)));
242243
this.toDispose.push(this.editor.onMouseLeave((e: IEditorMouseEvent) => {
244+
this.provideNonDebugHoverScheduler.cancel();
243245
const hoverDomNode = this.hoverWidget.getDomNode();
244246
if (!hoverDomNode) {
245247
return;
@@ -333,30 +335,36 @@ export class DebugEditorContribution implements IDebugEditorContribution {
333335

334336
@memoize
335337
private get showHoverScheduler(): RunOnceScheduler {
336-
return new RunOnceScheduler(() => this.showHover(this.hoverRange, false), HOVER_DELAY);
338+
const scheduler = new RunOnceScheduler(() => this.showHover(this.hoverRange, false), HOVER_DELAY);
339+
this.toDispose.push(scheduler);
340+
341+
return scheduler;
337342
}
338343

339344
@memoize
340345
private get hideHoverScheduler(): RunOnceScheduler {
341-
return new RunOnceScheduler(() => this.hoverWidget.hide(), HOVER_DELAY);
346+
const scheduler = new RunOnceScheduler(() => this.hoverWidget.hide(), HOVER_DELAY);
347+
this.toDispose.push(scheduler);
348+
349+
return scheduler;
342350
}
343351

344352
@memoize
345353
private get provideNonDebugHoverScheduler(): RunOnceScheduler {
346-
return new RunOnceScheduler(() => {
347-
const model = this.editor.getModel();
348-
const supports = HoverProviderRegistry.ordered(model);
349-
TPromise.join(supports.map(s =>
350-
asWinJsPromise(token => s.provideHover(model, this.nonDebugHoverPosition, token)))
351-
).done(undefined, errors.onUnexpectedError);
354+
const scheduler = new RunOnceScheduler(() => {
355+
getHover(this.editor.getModel(), this.nonDebugHoverPosition);
352356
}, HOVER_DELAY);
357+
this.toDispose.push(scheduler);
358+
359+
return scheduler;
353360
}
354361

355362
private hideHoverWidget(): void {
356363
if (!this.hideHoverScheduler.isScheduled() && this.hoverWidget.isVisible()) {
357364
this.hideHoverScheduler.schedule();
358365
}
359366
this.showHoverScheduler.cancel();
367+
this.provideNonDebugHoverScheduler.cancel();
360368
}
361369

362370
// hover business
@@ -374,7 +382,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
374382
return;
375383
}
376384

377-
if (!this.configurationService.getValue<IDebugConfiguration>('debug').hideNonDebugHovers) {
385+
if (!this.configurationService.getValue<IDebugConfiguration>('debug').enableAllHovers) {
378386
this.nonDebugHoverPosition = mouseEvent.target.position;
379387
this.provideNonDebugHoverScheduler.schedule();
380388
}

0 commit comments

Comments
 (0)