debugActionsWidget -> debugToolbar

This commit is contained in:
isidor 2018-09-19 16:06:48 +02:00
parent 08c2ce4910
commit f8092f7573
7 changed files with 41 additions and 36 deletions

View file

@ -11,7 +11,7 @@ import { editorMarkerNavigationError } from 'vs/editor/contrib/gotoError/gotoErr
import { overviewRulerModifiedForeground } from 'vs/workbench/parts/scm/electron-browser/dirtydiffDecorator';
import { STATUS_BAR_DEBUGGING_BACKGROUND } from 'vs/workbench/parts/debug/browser/statusbarColorProvider';
import { debugExceptionWidgetBackground } from 'vs/workbench/parts/debug/browser/exceptionWidget';
import { debugToolBarBackground } from 'vs/workbench/parts/debug/browser/debugActionsWidget';
import { debugToolBarBackground } from 'vs/workbench/parts/debug/browser/debugToolbar';
import { buttonBackground } from 'vs/workbench/parts/welcome/page/electron-browser/welcomePage';
import { embeddedEditorBackground } from 'vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart';
import { request, asText } from 'vs/base/node/request';

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/debugActionsWidget';
import 'vs/css!./media/debugToolbar';
import * as errors from 'vs/base/common/errors';
import * as browser from 'vs/base/browser/browser';
import * as dom from 'vs/base/browser/dom';
@ -31,8 +31,8 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IDisposable } from 'vs/base/common/lifecycle';
import { isExtensionHostDebugging } from 'vs/workbench/parts/debug/common/debugUtils';
const DEBUG_ACTIONS_WIDGET_POSITION_KEY = 'debug.actionswidgetposition';
const DEBUG_ACTIONS_WIDGET_Y_KEY = 'debug.actionswidgety';
const DEBUG_TOOLBAR_POSITION_KEY = 'debug.actionswidgetposition';
const DEBUG_TOOLBAR_Y_KEY = 'debug.actionswidgety';
export const debugToolBarBackground = registerColor('debugToolBar.background', {
dark: '#333333',
@ -45,7 +45,7 @@ export const debugToolBarBorder = registerColor('debugToolBar.border', {
hc: null
}, localize('debugToolBarBorder', "Debug toolbar border color."));
export class DebugActionsWidget extends Themable implements IWorkbenchContribution {
export class DebugToolbar extends Themable implements IWorkbenchContribution {
private $el: HTMLElement;
private dragArea: HTMLElement;
@ -71,7 +71,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
) {
super(themeService);
this.$el = dom.$('div.debug-actions-widget');
this.$el = dom.$('div.debug-toolbar');
this.$el.style.top = `${partService.getTitleBarOffset()}px`;
this.dragArea = dom.append(this.$el, dom.$('div.drag-area'));
@ -97,7 +97,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
return this.hide();
}
const actions = DebugActionsWidget.getActions(this.allActions, this.toDispose, this.debugService, this.keybindingService, this.instantiationService);
const actions = DebugToolbar.getActions(this.allActions, this.toDispose, this.debugService, this.keybindingService, this.instantiationService);
if (!arrays.equals(actions, this.activeActions, (first, second) => first.id === second.id)) {
this.actionBar.clear();
this.actionBar.push(actions, { icon: true, label: false });
@ -173,7 +173,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
private storePosition(): void {
const position = parseFloat(dom.getComputedStyle(this.$el).left) / window.innerWidth;
this.storageService.store(DEBUG_ACTIONS_WIDGET_POSITION_KEY, position, StorageScope.GLOBAL);
this.storageService.store(DEBUG_TOOLBAR_POSITION_KEY, position, StorageScope.GLOBAL);
}
protected updateStyles(): void {
@ -208,7 +208,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
}
const widgetWidth = this.$el.clientWidth;
if (x === undefined) {
const positionPercentage = this.storageService.get(DEBUG_ACTIONS_WIDGET_POSITION_KEY, StorageScope.GLOBAL);
const positionPercentage = this.storageService.get(DEBUG_TOOLBAR_POSITION_KEY, StorageScope.GLOBAL);
x = positionPercentage !== undefined ? parseFloat(positionPercentage) * window.innerWidth : (0.5 * window.innerWidth - 0.5 * widgetWidth);
}
@ -216,13 +216,13 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
this.$el.style.left = `${x}px`;
if (y === undefined) {
y = this.storageService.getInteger(DEBUG_ACTIONS_WIDGET_Y_KEY, StorageScope.GLOBAL, 0);
y = this.storageService.getInteger(DEBUG_TOOLBAR_Y_KEY, StorageScope.GLOBAL, 0);
}
const titleAreaHeight = 35;
if ((y < titleAreaHeight / 2) || (y > titleAreaHeight + titleAreaHeight / 2)) {
const moveToTop = y < titleAreaHeight;
this.setYCoordinate(moveToTop ? 0 : titleAreaHeight);
this.storageService.store(DEBUG_ACTIONS_WIDGET_Y_KEY, moveToTop ? 0 : 2 * titleAreaHeight, StorageScope.GLOBAL);
this.storageService.store(DEBUG_TOOLBAR_Y_KEY, moveToTop ? 0 : 2 * titleAreaHeight, StorageScope.GLOBAL);
}
}

View file

@ -26,7 +26,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { memoize } from 'vs/base/common/decorators';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { DebugActionsWidget } from 'vs/workbench/parts/debug/browser/debugActionsWidget';
import { DebugToolbar } from 'vs/workbench/parts/debug/browser/debugToolbar';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet';
@ -105,7 +105,7 @@ export class DebugViewlet extends ViewContainerViewlet {
return [this.startAction, this.configureAction, this.toggleReplAction];
}
return DebugActionsWidget.getActions(this.allActions, this.toDispose, this.debugService, this.keybindingService, this.instantiationService);
return DebugToolbar.getActions(this.allActions, this.toDispose, this.debugService, this.keybindingService, this.instantiationService);
}
public get showInitialDebugActions(): boolean {

View file

@ -5,7 +5,7 @@
/* Debug actions widget */
.monaco-workbench .debug-actions-widget {
.monaco-workbench .debug-toolbar {
position: absolute;
z-index: 200;
height: 32px;
@ -13,15 +13,15 @@
padding-left: 7px;
}
.monaco-workbench .debug-actions-widget .monaco-action-bar .action-item {
.monaco-workbench .debug-toolbar .monaco-action-bar .action-item {
height: 32px;
}
.monaco-workbench .debug-actions-widget .monaco-action-bar .action-item.select-container {
.monaco-workbench .debug-toolbar .monaco-action-bar .action-item.select-container {
margin-right: 7px;
}
.monaco-workbench .debug-actions-widget .drag-area {
.monaco-workbench .debug-toolbar .drag-area {
cursor: -webkit-grab;
height: 32px;
width: 16px;
@ -29,11 +29,11 @@
background-size: 16px 16px;
}
.monaco-workbench .debug-actions-widget .drag-area.dragged {
.monaco-workbench .debug-toolbar .drag-area.dragged {
cursor: -webkit-grabbing;
}
.monaco-workbench .debug-actions-widget .monaco-action-bar .action-item > .action-label {
.monaco-workbench .debug-toolbar .monaco-action-bar .action-item > .action-label {
width: 32px;
height: 32px;
margin-right: 0;

View file

@ -33,7 +33,7 @@ import {
StepOverAction, ClearReplAction, FocusReplAction, StepIntoAction, StepOutAction, StartAction, RestartAction, ContinueAction, StopAction, DisconnectAction, PauseAction, AddFunctionBreakpointAction,
ConfigureAction, DisableAllBreakpointsAction, EnableAllBreakpointsAction, RemoveAllBreakpointsAction, RunAction, ReapplyBreakpointsAction, SelectAndStartAction, TerminateThreadAction
} from 'vs/workbench/parts/debug/browser/debugActions';
import { DebugActionsWidget } from 'vs/workbench/parts/debug/browser/debugActionsWidget';
import { DebugToolbar } from 'vs/workbench/parts/debug/browser/debugToolbar';
import * as service from 'vs/workbench/parts/debug/electron-browser/debugService';
import { DebugContentProvider } from 'vs/workbench/parts/debug/browser/debugContentProvider';
import 'vs/workbench/parts/debug/electron-browser/debugEditorContribution';
@ -124,7 +124,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDebugPanelAction,
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDebugViewletAction, OpenDebugViewletAction.ID, OpenDebugViewletAction.LABEL, openViewletKb), 'View: Show Debug', nls.localize('view', "View"));
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugEditorModelManager, LifecyclePhase.Running);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugActionsWidget, LifecyclePhase.Running);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugToolbar, LifecyclePhase.Running);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugContentProvider, LifecyclePhase.Eventually);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(StatusBarColorProvider, LifecyclePhase.Eventually);

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { URI as uri } from 'vs/base/common/uri';
import { URI } from 'vs/base/common/uri';
import * as resources from 'vs/base/common/resources';
import * as nls from 'vs/nls';
import * as platform from 'vs/base/common/platform';
@ -209,7 +209,7 @@ export class DebugSession implements IDebugSession {
return TPromise.wrapError(new Error('no debug adapter'));
}
sendBreakpoints(modelUri: uri, breakpointsToSend: IBreakpoint[], sourceModified: boolean): TPromise<ActualBreakpoints | undefined> {
sendBreakpoints(modelUri: URI, breakpointsToSend: IBreakpoint[], sourceModified: boolean): TPromise<ActualBreakpoints | undefined> {
if (!this.raw) {
return TPromise.wrapError(new Error('no debug adapter'));
@ -404,7 +404,7 @@ export class DebugSession implements IDebugSession {
return TPromise.wrapError(new Error('no debug adapter'));
}
loadSource(resource: uri): TPromise<DebugProtocol.SourceResponse> {
loadSource(resource: URI): TPromise<DebugProtocol.SourceResponse> {
if (!this.raw) {
return TPromise.wrapError(new Error('no debug adapter'));
@ -735,23 +735,28 @@ export class DebugSession implements IDebugSession {
//---- sources
getSourceForUri(modelUri: uri): Source {
return this.sources.get(modelUri.toString());
getSourceForUri(uri: URI): Source {
return this.sources.get(this.getUriKey(uri));
}
getSource(raw: DebugProtocol.Source): Source {
let source = new Source(raw, this.getId());
if (this.sources.has(source.uri.toString())) {
source = this.sources.get(source.uri.toString());
const uriKey = this.getUriKey(source.uri);
if (this.sources.has(uriKey)) {
source = this.sources.get(uriKey);
source.raw = mixin(source.raw, raw);
if (source.raw && raw) {
// Always take the latest presentation hint from adapter #42139
source.raw.presentationHint = raw.presentationHint;
}
} else {
this.sources.set(source.uri.toString(), source);
this.sources.set(uriKey, source);
}
return source;
}
private getUriKey(uri: URI): string {
return platform.isLinux ? uri.toString() : uri.toString().toLowerCase();
}
}

View file

@ -13,17 +13,17 @@ import { IElement } from '../../vscode/driver';
const VIEWLET = 'div[id="workbench.view.debug"]';
const DEBUG_VIEW = `${VIEWLET} .debug-view-content`;
const CONFIGURE = `div[id="workbench.parts.sidebar"] .actions-container .configure`;
const STOP = `.debug-actions-widget .debug-action.stop`;
const STEP_OVER = `.debug-actions-widget .debug-action.step-over`;
const STEP_IN = `.debug-actions-widget .debug-action.step-into`;
const STEP_OUT = `.debug-actions-widget .debug-action.step-out`;
const CONTINUE = `.debug-actions-widget .debug-action.continue`;
const STOP = `.debug-toolbar .debug-action.stop`;
const STEP_OVER = `.debug-toolbar .debug-action.step-over`;
const STEP_IN = `.debug-toolbar .debug-action.step-into`;
const STEP_OUT = `.debug-toolbar .debug-action.step-out`;
const CONTINUE = `.debug-toolbar .debug-action.continue`;
const GLYPH_AREA = '.margin-view-overlays>:nth-child';
const BREAKPOINT_GLYPH = '.debug-breakpoint';
const PAUSE = `.debug-actions-widget .debug-action.pause`;
const PAUSE = `.debug-toolbar .debug-action.pause`;
const DEBUG_STATUS_BAR = `.statusbar.debugging`;
const NOT_DEBUG_STATUS_BAR = `.statusbar:not(debugging)`;
const TOOLBAR_HIDDEN = `.debug-actions-widget[aria-hidden="true"]`;
const TOOLBAR_HIDDEN = `.debug-toolbar[aria-hidden="true"]`;
const STACK_FRAME = `${VIEWLET} .monaco-tree-row .stack-frame`;
const SPECIFIC_STACK_FRAME = filename => `${STACK_FRAME} .file[title*="${filename}"]`;
const VARIABLE = `${VIEWLET} .debug-variables .monaco-tree-row .expression`;