Merge from vscode 2b0b9136329c181a9e381463a1f7dc3a2d105a34 (#4880)

This commit is contained in:
Karl Burtram
2019-04-05 10:09:18 -07:00
committed by GitHub
parent 9bd7e30d18
commit cb5bcf2248
433 changed files with 8915 additions and 8361 deletions

View File

@@ -558,6 +558,7 @@ export function openBreakpointSource(breakpoint: IBreakpoint, sideBySide: boolea
preserveFocus,
selection,
revealIfVisible: true,
revealIfOpened: true,
revealInCenterIfOutsideViewport: true,
pinned: !preserveFocus
}

View File

@@ -12,7 +12,7 @@ import { SelectBox, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selec
import { SelectActionItem, IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IDebugService, IDebugSession } from 'vs/workbench/contrib/debug/common/debug';
import { IDebugService, IDebugSession, IDebugConfiguration } from 'vs/workbench/contrib/debug/common/debug';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { attachSelectBoxStyler, attachStylerCallback } from 'vs/platform/theme/common/styler';
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
@@ -192,9 +192,10 @@ export class StartDebugActionItem implements IActionItem {
export class FocusSessionActionItem extends SelectActionItem {
constructor(
action: IAction,
@IDebugService protected debugService: IDebugService,
@IDebugService protected readonly debugService: IDebugService,
@IThemeService themeService: IThemeService,
@IContextViewService contextViewService: IContextViewService,
@IConfigurationService private readonly configurationService: IConfigurationService
) {
super(null, action, [], -1, contextViewService, { ariaLabel: nls.localize('debugSession', 'Debug Session') });
@@ -234,6 +235,9 @@ export class FocusSessionActionItem extends SelectActionItem {
}
protected getSessions(): ReadonlyArray<IDebugSession> {
return this.debugService.getModel().getSessions();
const hideSubSessions = this.configurationService.getValue<IDebugConfiguration>('debug').hideSubSessions;
const sessions = this.debugService.getModel().getSessions();
return hideSubSessions ? sessions.filter(s => !s.parentSession) : sessions;
}
}

View File

@@ -9,7 +9,7 @@ import { List } from 'vs/base/browser/ui/list/listWidget';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IListService } from 'vs/platform/list/browser/listService';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IDebugService, IEnablement, CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_WATCH_EXPRESSIONS_FOCUSED, CONTEXT_VARIABLES_FOCUSED, EDITOR_CONTRIBUTION_ID, IDebugEditorContribution, CONTEXT_IN_DEBUG_MODE, CONTEXT_EXPRESSION_SELECTED, CONTEXT_BREAKPOINT_SELECTED, IConfig, IStackFrame, IThread, IDebugSession, CONTEXT_DEBUG_STATE, REPL_ID } from 'vs/workbench/contrib/debug/common/debug';
import { IDebugService, IEnablement, CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_WATCH_EXPRESSIONS_FOCUSED, CONTEXT_VARIABLES_FOCUSED, EDITOR_CONTRIBUTION_ID, IDebugEditorContribution, CONTEXT_IN_DEBUG_MODE, CONTEXT_EXPRESSION_SELECTED, CONTEXT_BREAKPOINT_SELECTED, IConfig, IStackFrame, IThread, IDebugSession, CONTEXT_DEBUG_STATE, REPL_ID, IDebugConfiguration } from 'vs/workbench/contrib/debug/common/debug';
import { Expression, Variable, Breakpoint, FunctionBreakpoint, Thread } from 'vs/workbench/contrib/debug/common/debugModel';
import { IExtensionsViewlet, VIEWLET_ID as EXTENSIONS_VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
@@ -30,6 +30,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { startDebugging } from 'vs/workbench/contrib/debug/common/debugUtils';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export const ADD_CONFIGURATION_ID = 'debug.addConfiguration';
export const TOGGLE_INLINE_BREAKPOINT_ID = 'editor.debug.action.toggleInlineBreakpoint';
@@ -183,6 +184,12 @@ export function registerCommands(): void {
const debugService = accessor.get(IDebugService);
if (!session || !session.getId) {
session = debugService.getViewModel().focusedSession;
const configurationService = accessor.get(IConfigurationService);
const hideSubSessions = configurationService.getValue<IDebugConfiguration>('debug').hideSubSessions;
// Stop should be sent to the root parent session
while (hideSubSessions && session && session.parentSession) {
session = session.parentSession;
}
}
debugService.stopSession(session).then(undefined, onUnexpectedError);

View File

@@ -23,7 +23,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { registerColor, contrastBorder, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
import { localize } from 'vs/nls';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { RunOnceScheduler } from 'vs/base/common/async';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@@ -67,7 +67,6 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution {
@IConfigurationService private readonly configurationService: IConfigurationService,
@IThemeService themeService: IThemeService,
@IKeybindingService private readonly keybindingService: IKeybindingService,
@IContextViewService contextViewService: IContextViewService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IMenuService menuService: IMenuService,
@IContextMenuService contextMenuService: IContextMenuService,
@@ -89,7 +88,7 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution {
orientation: ActionsOrientation.HORIZONTAL,
actionItemProvider: (action: IAction) => {
if (action.id === FocusSessionAction.ID) {
return new FocusSessionActionItem(action, this.debugService, this.themeService, contextViewService);
return this.instantiationService.createInstance(FocusSessionActionItem, action);
}
if (action instanceof MenuItemAction) {
return new MenuItemActionItem(action, this.keybindingService, this.notificationService, contextMenuService);

View File

@@ -136,7 +136,7 @@ export class DebugViewlet extends ViewContainerViewlet {
return this.startDebugActionItem;
}
if (action.id === FocusSessionAction.ID) {
return new FocusSessionActionItem(action, this.debugService, this.themeService, this.contextViewService);
return new FocusSessionActionItem(action, this.debugService, this.themeService, this.contextViewService, this.configurationService);
}
if (action instanceof MenuItemAction) {
return new MenuItemActionItem(action, this.keybindingService, this.notificationService, this.contextMenuService);

View File

@@ -138,7 +138,7 @@ export class LinkDetector {
private onLinkClick(event: IMouseEvent, resource: uri, line: number, column: number = 0): void {
const selection = window.getSelection();
if (selection.type === 'Range') {
if (!selection || selection.type === 'Range') {
return; // do not navigate when user is selecting
}

View File

@@ -23,7 +23,7 @@ import { isWindows } from 'vs/base/common/platform';
import { URI } from 'vs/base/common/uri';
import { ltrim } from 'vs/base/common/strings';
import { RunOnceScheduler } from 'vs/base/common/async';
import { ResourceLabels, IResourceLabelProps, IResourceLabelOptions, IResourceLabel, IResourceLabelsContainer } from 'vs/workbench/browser/labels';
import { ResourceLabels, IResourceLabelProps, IResourceLabelOptions, IResourceLabel } from 'vs/workbench/browser/labels';
import { FileKind } from 'vs/platform/files/common/files';
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { ITreeRenderer, ITreeNode, ITreeFilter, TreeVisibility, TreeFilterResult, IAsyncDataSource } from 'vs/base/browser/ui/tree/tree';
@@ -416,7 +416,7 @@ export class LoadedScriptsView extends ViewletPanel {
const root = new RootTreeItem(this.debugService.getModel(), this.environmentService, this.contextService, this.labelService);
this.treeLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility } as IResourceLabelsContainer);
this.treeLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility });
this.disposables.push(this.treeLabels);
this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, this.treeContainer, new LoadedScriptsDelegate(),

View File

@@ -158,9 +158,15 @@
display: flex;
}
.debug-viewlet .debug-call-stack .thread > .name,
.debug-viewlet .debug-call-stack .session > .name {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
}
.debug-viewlet .debug-call-stack .thread > .state,
.debug-viewlet .debug-call-stack .session > .state {
flex: 1;
text-align: right;
overflow: hidden;
text-overflow: ellipsis;

View File

@@ -424,6 +424,7 @@ export interface IDebugConfiguration {
internalConsoleOptions: 'neverOpen' | 'openOnSessionStart' | 'openOnFirstSessionStart';
extensionHostDebugAdapter: boolean;
enableAllHovers: boolean;
hideSubSessions: boolean;
console: {
fontSize: number;
fontFamily: string;

View File

@@ -93,6 +93,7 @@ export class Source {
preserveFocus,
selection,
revealIfVisible: true,
revealIfOpened: true,
revealInCenterIfOutsideViewport: true,
pinned: pinned || (!preserveFocus && !this.inMemory)
}

View File

@@ -68,7 +68,7 @@ export class ViewModel implements IViewModel {
this.loadedScriptsSupportedContextKey.set(session ? !!session.capabilities.supportsLoadedSourcesRequest : false);
this.stepBackSupportedContextKey.set(session ? !!session.capabilities.supportsStepBack : false);
this.restartFrameSupportedContextKey.set(session ? !!session.capabilities.supportsRestartFrame : false);
const attach = !!session && session.configuration.request === 'attach' && !isExtensionHostDebugging(session.configuration);
const attach = !!session && !session.parentSession && session.configuration.request === 'attach' && !isExtensionHostDebugging(session.configuration);
this.focusedSessionIsAttach.set(attach);
if (shouldEmitForSession) {

View File

@@ -33,9 +33,7 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IWorkspaceContextService, WorkbenchState, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { EXTENSION_LOG_BROADCAST_CHANNEL, EXTENSION_ATTACH_BROADCAST_CHANNEL, EXTENSION_TERMINATE_BROADCAST_CHANNEL, EXTENSION_RELOAD_BROADCAST_CHANNEL, EXTENSION_CLOSE_EXTHOST_BROADCAST_CHANNEL } from 'vs/platform/extensions/common/extensionHost';
import { IBroadcastService } from 'vs/workbench/services/broadcast/common/broadcast';
import { IRemoteConsoleLog, parse, getFirstFrame } from 'vs/base/common/console';
import { parse, getFirstFrame } from 'vs/base/common/console';
import { TaskEvent, TaskEventKind, TaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService } from 'vs/platform/notification/common/notification';
@@ -47,6 +45,7 @@ import { IDebugService, State, IDebugSession, CONTEXT_DEBUG_TYPE, CONTEXT_DEBUG_
import { isExtensionHostDebugging } from 'vs/workbench/contrib/debug/common/debugUtils';
import { isErrorWithActions, createErrorWithActions } from 'vs/base/common/errorsWithActions';
import { RunOnceScheduler } from 'vs/base/common/async';
import { IExtensionHostDebugService } from 'vs/workbench/services/extensions/common/extensionHostDebug';
const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint';
const DEBUG_BREAKPOINTS_ACTIVATED_KEY = 'debug.breakpointactivated';
@@ -98,7 +97,6 @@ export class DebugService implements IDebugService {
@INotificationService private readonly notificationService: INotificationService,
@IDialogService private readonly dialogService: IDialogService,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
@IBroadcastService private readonly broadcastService: IBroadcastService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IContextKeyService contextKeyService: IContextKeyService,
@@ -109,6 +107,7 @@ export class DebugService implements IDebugService {
@ITaskService private readonly taskService: ITaskService,
@IFileService private readonly fileService: IFileService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IExtensionHostDebugService private readonly extensionHostDebugService: IExtensionHostDebugService
) {
this.toDispose = [];
@@ -136,34 +135,31 @@ export class DebugService implements IDebugService {
this.toDispose.push(this.storageService.onWillSaveState(this.saveState, this));
this.lifecycleService.onShutdown(this.dispose, this);
this.toDispose.push(this.broadcastService.onBroadcast(broadcast => {
const session = this.model.getSession(broadcast.payload.debugId, true);
this.toDispose.push(this.extensionHostDebugService.onAttachSession(data => {
const session = this.model.getSession(data.id, true);
if (session) {
switch (broadcast.channel) {
case EXTENSION_ATTACH_BROADCAST_CHANNEL:
// EH was started in debug mode -> attach to it
session.configuration.request = 'attach';
session.configuration.port = broadcast.payload.port;
this.launchOrAttachToSession(session);
break;
case EXTENSION_TERMINATE_BROADCAST_CHANNEL:
// EH was terminated
session.disconnect();
break;
case EXTENSION_LOG_BROADCAST_CHANNEL:
// extension logged output -> show it in REPL
const extensionOutput = <IRemoteConsoleLog>broadcast.payload.logEntry;
const sev = extensionOutput.severity === 'warn' ? severity.Warning : extensionOutput.severity === 'error' ? severity.Error : severity.Info;
const { args, stack } = parse(extensionOutput);
const frame = !!stack ? getFirstFrame(stack) : undefined;
session.logToRepl(sev, args, frame);
break;
}
// EH was started in debug mode -> attach to it
session.configuration.request = 'attach';
session.configuration.port = data.port;
this.launchOrAttachToSession(session).then(undefined, errors.onUnexpectedError);
}
}, this));
}));
this.toDispose.push(this.extensionHostDebugService.onTerminateSession(sessionId => {
const session = this.model.getSession(sessionId);
if (session) {
session.disconnect().then(undefined, errors.onUnexpectedError);
}
}));
this.toDispose.push(this.extensionHostDebugService.onLogToSession(data => {
const session = this.model.getSession(data.id, true);
if (session) {
// extension logged output -> show it in REPL
const sev = data.log.severity === 'warn' ? severity.Warning : data.log.severity === 'error' ? severity.Error : severity.Info;
const { args, stack } = parse(data.log);
const frame = !!stack ? getFirstFrame(stack) : undefined;
session.logToRepl(sev, args, frame);
}
}));
this.toDispose.push(this.viewModel.onDidFocusStackFrame(() => {
this.onStateChange();
@@ -443,8 +439,10 @@ export class DebugService implements IDebugService {
}
this.viewModel.firstSessionStart = false;
if (this.model.getSessions().length > 1) {
const hideSubSessions = this.configurationService.getValue<IDebugConfiguration>('debug').hideSubSessions;
const sessions = this.model.getSessions();
const shownSessions = hideSubSessions ? sessions.filter(s => !s.parentSession) : sessions;
if (shownSessions.length > 1) {
this.viewModel.setMultiSessionView(true);
}
@@ -510,10 +508,7 @@ export class DebugService implements IDebugService {
// 'Run without debugging' mode VSCode must terminate the extension host. More details: #3905
if (isExtensionHostDebugging(session.configuration) && session.state === State.Running && session.configuration.noDebug) {
this.broadcastService.broadcast({
channel: EXTENSION_CLOSE_EXTHOST_BROADCAST_CHANNEL,
payload: [session.root.uri.toString()]
});
this.extensionHostDebugService.close(session.root.uri);
}
this.telemetryDebugSessionStop(session, adapterExitEvent);
@@ -561,10 +556,7 @@ export class DebugService implements IDebugService {
}
if (isExtensionHostDebugging(session.configuration) && session.root) {
return runTasks().then(taskResult => taskResult === TaskRunResult.Success ? this.broadcastService.broadcast({
channel: EXTENSION_RELOAD_BROADCAST_CHANNEL,
payload: [session.root.uri.toString()]
}) : undefined);
return runTasks().then(taskResult => taskResult === TaskRunResult.Success ? this.extensionHostDebugService.reload(session.root.uri) : undefined);
}
const shouldFocus = this.viewModel.focusedSession && session.getId() === this.viewModel.focusedSession.getId();