Skip to content

Commit d4677c3

Browse files
committed
debug: debug.hideNonDebugHovers
1 parent 01b7ae0 commit d4677c3

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

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

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

356357
export interface IGlobalConfig {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ 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': {
209+
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
212+
},
208213
'launch': {
209214
type: 'object',
210215
description: nls.localize({ comment: ['This is the description for a setting'], key: 'launch' }, "Global debug launch configuration. Should be used as an alternative to 'launch.json' that is shared across workspaces"),

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

Lines changed: 18 additions & 2 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 } from 'vs/base/common/async';
9+
import { RunOnceScheduler, asWinJsPromise } 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 } from 'vs/editor/common/modes';
19+
import { StandardTokenType, HoverProviderRegistry } 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';
@@ -57,6 +57,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
5757

5858
private toDispose: lifecycle.IDisposable[];
5959
private hoverWidget: DebugHoverWidget;
60+
private nonDebugHoverPosition: Position;
6061
private hoverRange: Range;
6162

6263
private breakpointHintDecoration: string[];
@@ -340,6 +341,17 @@ export class DebugEditorContribution implements IDebugEditorContribution {
340341
return new RunOnceScheduler(() => this.hoverWidget.hide(), HOVER_DELAY);
341342
}
342343

344+
@memoize
345+
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);
352+
}, HOVER_DELAY);
353+
}
354+
343355
private hideHoverWidget(): void {
344356
if (!this.hideHoverScheduler.isScheduled() && this.hoverWidget.isVisible()) {
345357
this.hideHoverScheduler.schedule();
@@ -362,6 +374,10 @@ export class DebugEditorContribution implements IDebugEditorContribution {
362374
return;
363375
}
364376

377+
if (!this.configurationService.getValue<IDebugConfiguration>('debug').hideNonDebugHovers) {
378+
this.nonDebugHoverPosition = mouseEvent.target.position;
379+
this.provideNonDebugHoverScheduler.schedule();
380+
}
365381
const targetType = mouseEvent.target.type;
366382
const stopKey = env.isMacintosh ? 'metaKey' : 'ctrlKey';
367383

0 commit comments

Comments
 (0)