Merge from vscode 10492ba146318412cbee8b76a8c630f226914734

This commit is contained in:
ADS Merger
2020-04-08 06:33:38 +00:00
parent fca2344c2e
commit 1868a7d370
339 changed files with 3795 additions and 3146 deletions

View File

@@ -37,6 +37,7 @@ import { TextEditorSelectionRevealType } from 'vs/platform/editor/common/editor'
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { Orientation } from 'vs/base/browser/ui/splitview/splitview';
import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
const $ = dom.$;
@@ -50,14 +51,15 @@ function createCheckbox(): HTMLInputElement {
}
const MAX_VISIBLE_BREAKPOINTS = 9;
export function getExpandedBodySize(model: IDebugModel): number {
export function getExpandedBodySize(model: IDebugModel, countLimit: number): number {
const length = model.getBreakpoints().length + model.getExceptionBreakpoints().length + model.getFunctionBreakpoints().length + model.getDataBreakpoints().length;
return Math.min(MAX_VISIBLE_BREAKPOINTS, length) * 22;
return Math.min(countLimit, length) * 22;
}
type BreakpointItem = IBreakpoint | IFunctionBreakpoint | IDataBreakpoint | IExceptionBreakpoint;
export class BreakpointsView extends ViewPane {
private list!: WorkbenchList<IEnablement>;
private list!: WorkbenchList<BreakpointItem>;
private needsRefresh = false;
constructor(
@@ -88,7 +90,7 @@ export class BreakpointsView extends ViewPane {
dom.addClass(container, 'debug-breakpoints');
const delegate = new BreakpointsDelegate(this.debugService);
this.list = <WorkbenchList<IEnablement>>this.instantiationService.createInstance(WorkbenchList, 'Breakpoints', container, delegate, [
this.list = <WorkbenchList<BreakpointItem>>this.instantiationService.createInstance(WorkbenchList, 'Breakpoints', container, delegate, [
this.instantiationService.createInstance(BreakpointsRenderer),
new ExceptionBreakpointsRenderer(this.debugService),
this.instantiationService.createInstance(FunctionBreakpointsRenderer),
@@ -104,6 +106,7 @@ export class BreakpointsView extends ViewPane {
getRole: (breakpoint: IEnablement) => 'checkbox',
isChecked: (breakpoint: IEnablement) => breakpoint.enabled
},
accessibilityProvider: new BreakpointsAccessibilityProvider(this.debugService),
overrideStyles: {
listBackground: this.getBackgroundColor()
}
@@ -230,8 +233,8 @@ export class BreakpointsView extends ViewPane {
private updateSize(): void {
// Adjust expanded body size
this.minimumBodySize = this.orientation === Orientation.VERTICAL ? getExpandedBodySize(this.debugService.getModel()) : 170;
this.maximumBodySize = this.orientation === Orientation.VERTICAL ? this.minimumBodySize : Number.POSITIVE_INFINITY;
this.minimumBodySize = this.orientation === Orientation.VERTICAL ? getExpandedBodySize(this.debugService.getModel(), MAX_VISIBLE_BREAKPOINTS) : 170;
this.maximumBodySize = this.orientation === Orientation.VERTICAL ? getExpandedBodySize(this.debugService.getModel(), Number.POSITIVE_INFINITY) : Number.POSITIVE_INFINITY;
}
private onBreakpointsChange(): void {
@@ -246,25 +249,25 @@ export class BreakpointsView extends ViewPane {
}
}
private get elements(): IEnablement[] {
private get elements(): BreakpointItem[] {
const model = this.debugService.getModel();
const elements = (<ReadonlyArray<IEnablement>>model.getExceptionBreakpoints()).concat(model.getFunctionBreakpoints()).concat(model.getDataBreakpoints()).concat(model.getBreakpoints());
return elements;
return elements as BreakpointItem[];
}
}
class BreakpointsDelegate implements IListVirtualDelegate<IEnablement> {
class BreakpointsDelegate implements IListVirtualDelegate<BreakpointItem> {
constructor(private debugService: IDebugService) {
// noop
}
getHeight(element: IEnablement): number {
getHeight(_element: BreakpointItem): number {
return 22;
}
getTemplateId(element: IEnablement): string {
getTemplateId(element: BreakpointItem): string {
if (element instanceof Breakpoint) {
return BreakpointsRenderer.ID;
}
@@ -291,7 +294,7 @@ interface IBaseBreakpointTemplateData {
breakpoint: HTMLElement;
name: HTMLElement;
checkbox: HTMLInputElement;
context: IEnablement;
context: BreakpointItem;
toDispose: IDisposable[];
}
@@ -621,6 +624,22 @@ class FunctionBreakpointInputRenderer implements IListRenderer<IFunctionBreakpoi
}
}
class BreakpointsAccessibilityProvider implements IAccessibilityProvider<BreakpointItem> {
constructor(private readonly debugService: IDebugService) { }
getAriaLabel(element: BreakpointItem): string | null {
if (element instanceof ExceptionBreakpoint) {
return element.toString();
}
const { message } = getBreakpointMessageAndClassName(this.debugService.state, this.debugService.getModel().areBreakpointsActivated(), element as IBreakpoint | IDataBreakpoint | IFunctionBreakpoint);
const toString = element.toString();
return message ? `${toString} ${message}` : toString;
}
}
export function openBreakpointSource(breakpoint: IBreakpoint, sideBySide: boolean, preserveFocus: boolean, debugService: IDebugService, editorService: IEditorService): Promise<IEditorPane | undefined> {
if (breakpoint.uri.scheme === DEBUG_SCHEME && debugService.state === State.Inactive) {
return Promise.resolve(undefined);

View File

@@ -3,8 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!../browser/media/debug.contribution';
import 'vs/css!../browser/media/debugHover';
import 'vs/css!./media/debug.contribution';
import 'vs/css!./media/debugHover';
import * as nls from 'vs/nls';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';

View File

@@ -177,7 +177,6 @@ export class DebugHoverWidget implements IContentWidget {
}
async showAt(range: Range, focus: boolean): Promise<void> {
const session = this.debugService.getViewModel().focusedSession;
if (!session || !this.editor.hasModel()) {
@@ -285,12 +284,12 @@ export class DebugHoverWidget implements IContentWidget {
this.valueContainer.hidden = true;
this.complexValueContainer.hidden = false;
await this.tree.setInput(expression);
this.complexValueTitle.textContent = expression.value;
this.complexValueTitle.title = expression.value;
this.layoutTreeAndContainer();
this.editor.layoutContentWidget(this);
this.scrollbar.scanDomNode();
await this.tree.setInput(expression);
this.tree.scrollTop = 0;
this.tree.scrollLeft = 0;

View File

@@ -7,12 +7,12 @@ import * as osPath from 'vs/base/common/path';
import * as platform from 'vs/base/common/platform';
import { URI } from 'vs/base/common/uri';
import * as nls from 'vs/nls';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IFileService } from 'vs/platform/files/common/files';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
const CONTROL_CODES = '\\u0000-\\u0020\\u007f-\\u009f';
const WEB_LINK_REGEX = new RegExp('(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\\/\\/|data:|www\\.)[^\\s' + CONTROL_CODES + '"]{2,}[^\\s' + CONTROL_CODES + '"\')}\\],:;.!?]', 'ug');
@@ -38,7 +38,7 @@ export class LinkDetector {
@IEditorService private readonly editorService: IEditorService,
@IFileService private readonly fileService: IFileService,
@IOpenerService private readonly openerService: IOpenerService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IRemotePathService private readonly remotePathService: IRemotePathService,
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService
) {
// noop
@@ -120,7 +120,10 @@ export class LinkDetector {
}
if (path[0] === '~') {
path = osPath.join(this.environmentService.userHome, path.substring(1));
const userHome = this.remotePathService.userHomeSync;
if (userHome) {
path = osPath.join(userHome.fsPath, path.substring(1));
}
}
const link = this.createLink(text);

View File

@@ -17,7 +17,6 @@ import { IDebugSession, IDebugService, CONTEXT_LOADED_SCRIPTS_ITEM_TYPE } from '
import { Source } from 'vs/workbench/contrib/debug/common/debugSource';
import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { tildify } from 'vs/base/common/labels';
import { isWindows } from 'vs/base/common/platform';
import { URI } from 'vs/base/common/uri';
@@ -40,6 +39,7 @@ import { IViewDescriptorService } from 'vs/workbench/common/views';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
const NEW_STYLE_COMPRESS = true;
@@ -241,12 +241,12 @@ class RootFolderTreeItem extends BaseTreeItem {
class RootTreeItem extends BaseTreeItem {
constructor(private _environmentService: IEnvironmentService, private _contextService: IWorkspaceContextService, private _labelService: ILabelService) {
constructor(private _remotePathService: IRemotePathService, private _contextService: IWorkspaceContextService, private _labelService: ILabelService) {
super(undefined, 'Root');
}
add(session: IDebugSession): SessionTreeItem {
return this.createIfNeeded(session.getId(), () => new SessionTreeItem(this._labelService, this, session, this._environmentService, this._contextService));
return this.createIfNeeded(session.getId(), () => new SessionTreeItem(this._labelService, this, session, this._remotePathService, this._contextService));
}
find(session: IDebugSession): SessionTreeItem {
@@ -262,7 +262,7 @@ class SessionTreeItem extends BaseTreeItem {
private _map = new Map<string, BaseTreeItem>();
private _labelService: ILabelService;
constructor(labelService: ILabelService, parent: BaseTreeItem, session: IDebugSession, private _environmentService: IEnvironmentService, private rootProvider: IWorkspaceContextService) {
constructor(labelService: ILabelService, parent: BaseTreeItem, session: IDebugSession, private _remotePathService: IRemotePathService, private rootProvider: IWorkspaceContextService) {
super(parent, session.getLabel(), true);
this._labelService = labelService;
this._session = session;
@@ -347,8 +347,9 @@ class SessionTreeItem extends BaseTreeItem {
} else {
// on unix try to tildify absolute paths
path = normalize(path);
if (!isWindows) {
path = tildify(path, this._environmentService.userHome);
const userHome = this._remotePathService.userHomeSync;
if (userHome && !isWindows) {
path = tildify(path, userHome.fsPath);
}
}
}
@@ -423,9 +424,9 @@ export class LoadedScriptsView extends ViewPane {
@IEditorService private readonly editorService: IEditorService,
@IContextKeyService readonly contextKeyService: IContextKeyService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IDebugService private readonly debugService: IDebugService,
@ILabelService private readonly labelService: ILabelService,
@IRemotePathService private readonly remotePathService: IRemotePathService,
@IOpenerService openerService: IOpenerService,
@IThemeService themeService: IThemeService,
@ITelemetryService telemetryService: ITelemetryService,
@@ -445,7 +446,7 @@ export class LoadedScriptsView extends ViewPane {
this.filter = new LoadedScriptsFilter();
const root = new RootTreeItem(this.environmentService, this.contextService, this.labelService);
const root = new RootTreeItem(this.remotePathService, this.contextService, this.labelService);
this.treeLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility });
this._register(this.treeLabels);

View File

@@ -79,7 +79,8 @@
}
.repl .repl-input-wrapper {
padding-left: 20px;
display: flex;
align-items: center;
border-top: 1px solid rgba(128, 128, 128, 0.35);
}
@@ -92,15 +93,14 @@
border-top-color: #6FC3DF;
}
.repl .repl-input-wrapper:before {
left: 8px;
position: absolute;
content: '\276f';
line-height: 18px;
}
.monaco-workbench.linux .repl .repl-input-wrapper:before {
font-size: 9px;
.repl .repl-input-wrapper .repl-input-chevron {
padding: 0 6px 0 8px;
width: 16px;
height: 100%;
display: flex;
flex-shrink: 0;
justify-content: center;
font-weight: 600;
}
/* Output coloring and styling */

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!vs/workbench/contrib/debug/browser/media/repl';
import 'vs/css!./media/repl';
import { URI as uri } from 'vs/base/common/uri';
import { IAction, IActionViewItem, Action } from 'vs/base/common/actions';
import * as dom from 'vs/base/browser/dom';
@@ -58,6 +58,7 @@ import { IViewsService, IViewDescriptorService } from 'vs/workbench/common/views
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { ReplGroup } from 'vs/workbench/contrib/debug/common/replModel';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { EDITOR_FONT_DEFAULTS, EditorOption } from 'vs/editor/common/config/editorOptions';
const $ = dom.$;
@@ -75,7 +76,6 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
_serviceBrand: undefined;
private static readonly REFRESH_DELAY = 100; // delay in ms to refresh the repl for new elements to show
private static readonly REPL_INPUT_LINE_HEIGHT = 19;
private static readonly URI = uri.parse(`${DEBUG_SCHEME}:replinput`);
private history: HistoryNavigator<string>;
@@ -284,6 +284,14 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
const lineHeight = debugConsole.lineHeight ? `${debugConsole.lineHeight}px` : '1.4em';
const backgroundColor = this.themeService.getColorTheme().getColor(this.getBackgroundColor());
this.replInput.updateOptions({
fontSize,
lineHeight: debugConsole.lineHeight,
fontFamily: debugConsole.fontFamily === 'default' ? EDITOR_FONT_DEFAULTS.fontFamily : debugConsole.fontFamily
});
const replInputLineHeight = this.replInput.getOption(EditorOption.lineHeight);
// Set the font size, font family, line height and align the twistie to be centered, and input theme color
this.styleElement.innerHTML = `
.repl .repl-tree .expression {
@@ -299,12 +307,20 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
background-position-y: calc(100% - ${fontSize * 1.4 / 2 - 8}px);
}
.repl .repl-input-wrapper .repl-input-chevron {
line-height: ${replInputLineHeight}px
}
.repl .repl-input-wrapper .monaco-editor .lines-content {
background-color: ${backgroundColor};
}
`;
this.tree.rerender();
if (this.dimension) {
this.layoutBody(this.dimension.height, this.dimension.width);
}
}
}
@@ -396,7 +412,7 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
protected layoutBody(height: number, width: number): void {
this.dimension = new dom.Dimension(width, height);
const replInputHeight = Repl.REPL_INPUT_LINE_HEIGHT * this.replInputLineCount;
const replInputHeight = Math.min(this.replInput.getContentHeight(), height);
if (this.tree) {
const lastElementVisible = this.tree.scrollTop + this.tree.renderHeight >= this.tree.scrollHeight;
const treeHeight = height - replInputHeight;
@@ -408,7 +424,7 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
}
this.replInputContainer.style.height = `${replInputHeight}px`;
this.replInput.layout({ width: width - 20, height: replInputHeight });
this.replInput.layout({ width: width - 30, height: replInputHeight });
}
focus(): void {
@@ -543,6 +559,7 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
private createReplInput(container: HTMLElement): void {
this.replInputContainer = dom.append(container, $('.repl-input-wrapper'));
dom.append(this.replInputContainer, $('.repl-input-chevron.codicon.codicon-chevron-right'));
const { scopedContextKeyService, historyNavigationEnablement } = createAndBindHistoryNavigationWidgetScopedContextKeyService(this.contextKeyService, { target: this.replInputContainer, historyNavigator: this });
this.historyNavigationEnablement = historyNavigationEnablement;

View File

@@ -98,10 +98,10 @@ suite('Debug - Breakpoints', () => {
const modelUri1 = uri.file('/myfolder/my file first.js');
const modelUri2 = uri.file('/secondfolder/second/second file.js');
addBreakpointsAndCheckEvents(model, modelUri1, [{ lineNumber: 5, enabled: true }, { lineNumber: 10, enabled: false }]);
assert.equal(getExpandedBodySize(model), 44);
assert.equal(getExpandedBodySize(model, 9), 44);
addBreakpointsAndCheckEvents(model, modelUri2, [{ lineNumber: 1, enabled: true }, { lineNumber: 2, enabled: true }, { lineNumber: 3, enabled: false }]);
assert.equal(getExpandedBodySize(model), 110);
assert.equal(getExpandedBodySize(model, 9), 110);
assert.equal(model.getBreakpoints().length, 5);
assert.equal(model.getBreakpoints({ uri: modelUri1 }).length, 2);
@@ -135,7 +135,7 @@ suite('Debug - Breakpoints', () => {
assert.equal(bp.enabled, true);
model.removeBreakpoints(model.getBreakpoints({ uri: modelUri1 }));
assert.equal(getExpandedBodySize(model), 66);
assert.equal(getExpandedBodySize(model, 9), 66);
assert.equal(model.getBreakpoints().length, 3);
});