Merge branch 'master' into ben/editor

This commit is contained in:
Benjamin Pasero
2018-05-19 15:13:19 +02:00
15 changed files with 170 additions and 179 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
},
{
"name": "ms-vscode.node-debug2",
"version": "1.24.1",
"version": "1.24.2",
"repo": "https://github.com/Microsoft/vscode-node-debug2"
}
]
@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/e667795f83c83e36dc6f90bde14632a963c52e34",
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/ab08007feb924996eff9399c169f171fa17899ca",
"name": "Markdown",
"scopeName": "text.html.markdown",
"patterns": [
@@ -162,6 +162,9 @@
{
"include": "#fenced_code_block_fsharp"
},
{
"include": "#fenced_code_block_dart"
},
{
"include": "#fenced_code_block_unknown"
},
@@ -1649,6 +1652,39 @@
}
]
},
"fenced_code_block_dart": {
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(dart)(\\s+[^`~]*)?$)",
"name": "markup.fenced_code.block.markdown",
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
"beginCaptures": {
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
},
"6": {
"name": "fenced_code.block.language.attributes"
}
},
"endCaptures": {
"3": {
"name": "punctuation.definition.markdown"
}
},
"patterns": [
{
"begin": "(^|\\G)(\\s*)(.*)",
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
"contentName": "meta.embedded.block.dart",
"patterns": [
{
"include": "source.dart"
}
]
}
]
},
"fenced_code_block_unknown": {
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?=([^`~]*)?$)",
"beginCaptures": {
@@ -10,22 +10,25 @@ import * as PConst from '../protocol.const';
import { ITypeScriptServiceClient } from '../typescriptService';
import * as typeConverters from '../utils/typeConverters';
const outlineTypeTable: { [kind: string]: SymbolKind } = Object.create(null);
outlineTypeTable[PConst.Kind.module] = SymbolKind.Module;
outlineTypeTable[PConst.Kind.class] = SymbolKind.Class;
outlineTypeTable[PConst.Kind.enum] = SymbolKind.Enum;
outlineTypeTable[PConst.Kind.interface] = SymbolKind.Interface;
outlineTypeTable[PConst.Kind.memberFunction] = SymbolKind.Method;
outlineTypeTable[PConst.Kind.memberVariable] = SymbolKind.Property;
outlineTypeTable[PConst.Kind.memberGetAccessor] = SymbolKind.Property;
outlineTypeTable[PConst.Kind.memberSetAccessor] = SymbolKind.Property;
outlineTypeTable[PConst.Kind.variable] = SymbolKind.Variable;
outlineTypeTable[PConst.Kind.const] = SymbolKind.Variable;
outlineTypeTable[PConst.Kind.localVariable] = SymbolKind.Variable;
outlineTypeTable[PConst.Kind.variable] = SymbolKind.Variable;
outlineTypeTable[PConst.Kind.function] = SymbolKind.Function;
outlineTypeTable[PConst.Kind.localFunction] = SymbolKind.Function;
const getSymbolKind = (kind: string): SymbolKind => {
switch (kind) {
case PConst.Kind.module: return SymbolKind.Module;
case PConst.Kind.class: return SymbolKind.Class;
case PConst.Kind.enum: return SymbolKind.Enum;
case PConst.Kind.interface: return SymbolKind.Interface;
case PConst.Kind.memberFunction: return SymbolKind.Method;
case PConst.Kind.memberVariable: return SymbolKind.Property;
case PConst.Kind.memberGetAccessor: return SymbolKind.Property;
case PConst.Kind.memberSetAccessor: return SymbolKind.Property;
case PConst.Kind.variable: return SymbolKind.Variable;
case PConst.Kind.const: return SymbolKind.Variable;
case PConst.Kind.localVariable: return SymbolKind.Variable;
case PConst.Kind.variable: return SymbolKind.Variable;
case PConst.Kind.function: return SymbolKind.Function;
case PConst.Kind.localFunction: return SymbolKind.Function;
}
return SymbolKind.Variable;
};
export default class TypeScriptDocumentSymbolProvider implements DocumentSymbolProvider {
public constructor(
@@ -45,9 +48,9 @@ export default class TypeScriptDocumentSymbolProvider implements DocumentSymbolP
const response = await this.client.execute('navtree', args, token);
if (response.body) {
// The root represents the file. Ignore this when showing in the UI
let tree = response.body;
const tree = response.body;
if (tree.childItems) {
let result = new Array<Hierarchy<SymbolInformation2>>();
const result = new Array<Hierarchy<SymbolInformation2>>();
tree.childItems.forEach(item => TypeScriptDocumentSymbolProvider.convertNavTree(resource.uri, result, item));
return result;
}
@@ -55,8 +58,8 @@ export default class TypeScriptDocumentSymbolProvider implements DocumentSymbolP
} else {
const response = await this.client.execute('navbar', args, token);
if (response.body) {
let result = new Array<SymbolInformation>();
let foldingMap: ObjectMap<SymbolInformation> = Object.create(null);
const result = new Array<SymbolInformation>();
const foldingMap: ObjectMap<SymbolInformation> = Object.create(null);
response.body.forEach(item => TypeScriptDocumentSymbolProvider.convertNavBar(resource.uri, 0, foldingMap, result as SymbolInformation[], item));
return result;
}
@@ -68,11 +71,11 @@ export default class TypeScriptDocumentSymbolProvider implements DocumentSymbolP
}
private static convertNavBar(resource: Uri, indent: number, foldingMap: ObjectMap<SymbolInformation>, bucket: SymbolInformation[], item: Proto.NavigationBarItem, containerLabel?: string): void {
let realIndent = indent + item.indent;
let key = `${realIndent}|${item.text}`;
if (realIndent !== 0 && !foldingMap[key] && TypeScriptDocumentSymbolProvider.shouldInclueEntry(item.text)) {
let result = new SymbolInformation(item.text,
outlineTypeTable[item.kind as string] || SymbolKind.Variable,
const realIndent = indent + item.indent;
const key = `${realIndent}|${item.text}`;
if (realIndent !== 0 && !foldingMap[key] && TypeScriptDocumentSymbolProvider.shouldInclueEntry(item)) {
const result = new SymbolInformation(item.text,
getSymbolKind(item.kind),
containerLabel ? containerLabel : '',
typeConverters.Location.fromTextSpan(resource, item.spans[0]));
foldingMap[key] = result;
@@ -85,28 +88,31 @@ export default class TypeScriptDocumentSymbolProvider implements DocumentSymbolP
}
}
private static convertNavTree(resource: Uri, bucket: Hierarchy<SymbolInformation>[], item: Proto.NavigationTree): void {
if (!TypeScriptDocumentSymbolProvider.shouldInclueEntry(item.text)) {
return;
}
private static convertNavTree(resource: Uri, bucket: Hierarchy<SymbolInformation>[], item: Proto.NavigationTree): boolean {
const symbolInfo = new SymbolInformation2(
item.text,
'', // todo@joh detail
outlineTypeTable[item.kind as string] || SymbolKind.Variable,
getSymbolKind(item.kind),
typeConverters.Range.fromTextSpan(item.spans[0]),
typeConverters.Location.fromTextSpan(resource, item.spans[0]),
);
const hierarchy = new Hierarchy(symbolInfo);
let shouldInclude = TypeScriptDocumentSymbolProvider.shouldInclueEntry(item);
if (item.childItems && item.childItems.length > 0) {
for (const child of item.childItems) {
TypeScriptDocumentSymbolProvider.convertNavTree(resource, hierarchy.children, child);
shouldInclude = shouldInclude || TypeScriptDocumentSymbolProvider.convertNavTree(resource, hierarchy.children, child);
}
}
bucket.push(hierarchy);
if (shouldInclude) {
bucket.push(hierarchy);
}
return shouldInclude;
}
private static shouldInclueEntry(name: string): boolean {
return !!(name && name !== '<function>' && name !== '<class>');
private static shouldInclueEntry(item: Proto.NavigationTree | Proto.NavigationBarItem): boolean {
return !!(item.text && item.text !== '<function>' && item.text !== '<class>');
}
}
+1 -1
View File
@@ -49,7 +49,7 @@
"vscode-nsfw": "1.0.17",
"vscode-ripgrep": "^0.8.1",
"vscode-textmate": "^3.3.3",
"vscode-xterm": "3.5.0-beta5",
"vscode-xterm": "3.5.0-beta6",
"yauzl": "^2.9.1"
},
"devDependencies": {
+3 -3
View File
@@ -634,11 +634,11 @@ export function getDomNodePagePosition(domNode: HTMLElement): IDomNodePagePositi
}
export interface IStandardWindow {
scrollX: number;
scrollY: number;
readonly scrollX: number;
readonly scrollY: number;
}
export const StandardWindow: IStandardWindow = new class {
export const StandardWindow: IStandardWindow = new class implements IStandardWindow {
get scrollX(): number {
if (typeof window.scrollX === 'number') {
// modern browsers
+4 -103
View File
@@ -2,113 +2,14 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { Event as _Event, Emitter, mapEvent } from 'vs/base/common/event';
import { Event, Emitter, mapEvent } from 'vs/base/common/event';
export type EventHandler = HTMLElement | HTMLDocument | Window;
export interface IDomEvent {
(element: EventHandler, type: 'MSContentZoom', useCapture?: boolean): _Event<UIEvent>;
(element: EventHandler, type: 'MSGestureChange', useCapture?: boolean): _Event<MSGestureEvent>;
(element: EventHandler, type: 'MSGestureDoubleTap', useCapture?: boolean): _Event<MSGestureEvent>;
(element: EventHandler, type: 'MSGestureEnd', useCapture?: boolean): _Event<MSGestureEvent>;
(element: EventHandler, type: 'MSGestureHold', useCapture?: boolean): _Event<MSGestureEvent>;
(element: EventHandler, type: 'MSGestureStart', useCapture?: boolean): _Event<MSGestureEvent>;
(element: EventHandler, type: 'MSGestureTap', useCapture?: boolean): _Event<MSGestureEvent>;
(element: EventHandler, type: 'MSGotPointerCapture', useCapture?: boolean): _Event<MSPointerEvent>;
(element: EventHandler, type: 'MSInertiaStart', useCapture?: boolean): _Event<MSGestureEvent>;
(element: EventHandler, type: 'MSLostPointerCapture', useCapture?: boolean): _Event<MSPointerEvent>;
(element: EventHandler, type: 'MSPointerCancel', useCapture?: boolean): _Event<MSPointerEvent>;
(element: EventHandler, type: 'MSPointerDown', useCapture?: boolean): _Event<MSPointerEvent>;
(element: EventHandler, type: 'MSPointerEnter', useCapture?: boolean): _Event<MSPointerEvent>;
(element: EventHandler, type: 'MSPointerLeave', useCapture?: boolean): _Event<MSPointerEvent>;
(element: EventHandler, type: 'MSPointerMove', useCapture?: boolean): _Event<MSPointerEvent>;
(element: EventHandler, type: 'MSPointerOut', useCapture?: boolean): _Event<MSPointerEvent>;
(element: EventHandler, type: 'MSPointerOver', useCapture?: boolean): _Event<MSPointerEvent>;
(element: EventHandler, type: 'MSPointerUp', useCapture?: boolean): _Event<MSPointerEvent>;
(element: EventHandler, type: 'abort', useCapture?: boolean): _Event<UIEvent>;
(element: EventHandler, type: 'activate', useCapture?: boolean): _Event<UIEvent>;
(element: EventHandler, type: 'beforeactivate', useCapture?: boolean): _Event<UIEvent>;
(element: EventHandler, type: 'beforecopy', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'beforecut', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'beforedeactivate', useCapture?: boolean): _Event<UIEvent>;
(element: EventHandler, type: 'beforepaste', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'blur', useCapture?: boolean): _Event<FocusEvent>;
(element: EventHandler, type: 'canplay', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'canplaythrough', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'change', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'click', useCapture?: boolean): _Event<MouseEvent>;
(element: EventHandler, type: 'contextmenu', useCapture?: boolean): _Event<PointerEvent>;
(element: EventHandler, type: 'copy', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'cuechange', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'cut', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'dblclick', useCapture?: boolean): _Event<MouseEvent>;
(element: EventHandler, type: 'deactivate', useCapture?: boolean): _Event<UIEvent>;
(element: EventHandler, type: 'drag', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'dragend', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'dragenter', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'dragleave', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'dragover', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'dragstart', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'drop', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'durationchange', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'emptied', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'ended', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'error', useCapture?: boolean): _Event<ErrorEvent>;
(element: EventHandler, type: 'focus', useCapture?: boolean): _Event<FocusEvent>;
(element: EventHandler, type: 'gotpointercapture', useCapture?: boolean): _Event<PointerEvent>;
(element: EventHandler, type: 'input', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'keydown', useCapture?: boolean): _Event<KeyboardEvent>;
(element: EventHandler, type: 'keypress', useCapture?: boolean): _Event<KeyboardEvent>;
(element: EventHandler, type: 'keyup', useCapture?: boolean): _Event<KeyboardEvent>;
(element: EventHandler, type: 'load', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'loadeddata', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'loadedmetadata', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'loadstart', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'lostpointercapture', useCapture?: boolean): _Event<PointerEvent>;
(element: EventHandler, type: 'mousedown', useCapture?: boolean): _Event<MouseEvent>;
(element: EventHandler, type: 'mouseenter', useCapture?: boolean): _Event<MouseEvent>;
(element: EventHandler, type: 'mouseleave', useCapture?: boolean): _Event<MouseEvent>;
(element: EventHandler, type: 'mousemove', useCapture?: boolean): _Event<MouseEvent>;
(element: EventHandler, type: 'mouseout', useCapture?: boolean): _Event<MouseEvent>;
(element: EventHandler, type: 'mouseover', useCapture?: boolean): _Event<MouseEvent>;
(element: EventHandler, type: 'mouseup', useCapture?: boolean): _Event<MouseEvent>;
(element: EventHandler, type: 'mousewheel', useCapture?: boolean): _Event<MouseWheelEvent>;
(element: EventHandler, type: 'paste', useCapture?: boolean): _Event<DragEvent>;
(element: EventHandler, type: 'pause', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'play', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'playing', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'pointercancel', useCapture?: boolean): _Event<PointerEvent>;
(element: EventHandler, type: 'pointerdown', useCapture?: boolean): _Event<PointerEvent>;
(element: EventHandler, type: 'pointerenter', useCapture?: boolean): _Event<PointerEvent>;
(element: EventHandler, type: 'pointerleave', useCapture?: boolean): _Event<PointerEvent>;
(element: EventHandler, type: 'pointermove', useCapture?: boolean): _Event<PointerEvent>;
(element: EventHandler, type: 'pointerout', useCapture?: boolean): _Event<PointerEvent>;
(element: EventHandler, type: 'pointerover', useCapture?: boolean): _Event<PointerEvent>;
(element: EventHandler, type: 'pointerup', useCapture?: boolean): _Event<PointerEvent>;
(element: EventHandler, type: 'progress', useCapture?: boolean): _Event<ProgressEvent>;
(element: EventHandler, type: 'ratechange', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'reset', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'scroll', useCapture?: boolean): _Event<UIEvent>;
(element: EventHandler, type: 'seeked', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'seeking', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'select', useCapture?: boolean): _Event<UIEvent>;
(element: EventHandler, type: 'selectstart', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'stalled', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'submit', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'suspend', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'timeupdate', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'touchcancel', useCapture?: boolean): _Event<TouchEvent>;
(element: EventHandler, type: 'touchend', useCapture?: boolean): _Event<TouchEvent>;
(element: EventHandler, type: 'touchmove', useCapture?: boolean): _Event<TouchEvent>;
(element: EventHandler, type: 'touchstart', useCapture?: boolean): _Event<TouchEvent>;
(element: EventHandler, type: 'volumechange', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'waiting', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'webkitfullscreenchange', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'webkitfullscreenerror', useCapture?: boolean): _Event<Event>;
(element: EventHandler, type: 'wheel', useCapture?: boolean): _Event<WheelEvent>;
(element: EventHandler, type: string, useCapture?: boolean): _Event<any>;
<K extends keyof HTMLElementEventMap>(element: EventHandler, type: K, useCapture?: boolean): Event<HTMLElementEventMap[K]>;
(element: EventHandler, type: string, useCapture?: boolean): Event<any>;
}
export const domEvent: IDomEvent = (element: EventHandler, type: string, useCapture?: boolean) => {
@@ -130,7 +31,7 @@ export interface CancellableEvent {
stopPropagation();
}
export function stop<T extends CancellableEvent>(event: _Event<T>): _Event<T> {
export function stop<T extends CancellableEvent>(event: Event<T>): Event<T> {
return mapEvent(event, e => {
e.preventDefault();
e.stopPropagation();
@@ -321,20 +321,6 @@ export class IssueReporter extends Disposable {
});
});
const labelElements = document.getElementsByClassName('caption');
for (let i = 0; i < labelElements.length; i++) {
const label = labelElements.item(i);
label.addEventListener('click', (e) => {
e.stopPropagation();
const containingDiv = (<HTMLLabelElement>e.target).parentElement;
const checkbox = <HTMLInputElement>containingDiv.firstElementChild;
if (checkbox) {
this.issueReporterModel.update({ [checkbox.id]: !this.issueReporterModel.getData()[checkbox.id] });
}
});
}
const showInfoElements = document.getElementsByClassName('showInfo');
for (let i = 0; i < showInfoElements.length; i++) {
const showInfo = showInfoElements.item(i);
@@ -66,7 +66,7 @@ export default (): string => `
<label class="caption" for="includeSystemInfo">${escape(localize({
key: 'sendSystemInfo',
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibililty of the system information']
}, "Send my system information ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
}, "Include my system information ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
<div class="block-info hidden">
<!-- To be dynamically filled -->
</div>
@@ -76,7 +76,7 @@ export default (): string => `
<label class="caption" for="includeProcessInfo">${escape(localize({
key: 'sendProcessInfo',
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibililty of the process info']
}, "Send my currently running processes ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
}, "Include my currently running processes ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
<pre class="block-info hidden">
<code>
<!-- To be dynamically filled -->
@@ -88,7 +88,7 @@ export default (): string => `
<label class="caption" for="includeWorkspaceInfo">${escape(localize({
key: 'sendWorkspaceInfo',
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibililty of the workspace information']
}, "Send my workspace metadata ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
}, "Include my workspace metadata ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
<pre id="systemInfo" class="block-info hidden">
<code>
<!-- To be dynamically filled -->
@@ -100,7 +100,7 @@ export default (): string => `
<label class="caption" for="includeExtensions">${escape(localize({
key: 'sendExtensions',
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibililty of the enabled extensions list']
}, "Send my enabled extensions ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
}, "Include my enabled extensions ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
<div id="systemInfo" class="block-info hidden">
<!-- To be dynamically filled -->
</div>
@@ -30,7 +30,11 @@ import { IBadge } from 'vs/workbench/services/activity/common/activity';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { Dimension } from 'vs/base/browser/dom';
import { localize } from 'vs/nls';
import { IDisposable } from 'vs/base/common/lifecycle';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
const ActivePanleContextId = 'activePanel';
export const ActivePanelContext = new RawContextKey<string>(ActivePanleContextId, '');
export class PanelPart extends CompositePart<Panel> implements IPanelService {
@@ -40,10 +44,12 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
public _serviceBrand: any;
private activePanelContextKey: IContextKey<string>;
private blockOpeningPanel: boolean;
private compositeBar: CompositeBar;
private compositeActions: { [compositeId: string]: { activityAction: PanelActivityAction, pinnedAction: ToggleCompositePinnedAction } };
private dimension: Dimension;
private disposables: IDisposable[] = [];
constructor(
id: string,
@@ -54,7 +60,8 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
@IPartService partService: IPartService,
@IKeybindingService keybindingService: IKeybindingService,
@IInstantiationService instantiationService: IInstantiationService,
@IThemeService themeService: IThemeService
@IThemeService themeService: IThemeService,
@IContextKeyService contextKeyService: IContextKeyService,
) {
super(
notificationService,
@@ -100,6 +107,9 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
for (const panel of this.getPanels()) {
this.compositeBar.addComposite(panel, false);
}
this.activePanelContextKey = ActivePanelContext.bindTo(contextKeyService);
this.onDidPanelOpen(this._onDidPanelOpen, this, this.disposables);
this.onDidPanelClose(this._onDidPanelClose, this, this.disposables);
this.registerListeners();
}
@@ -119,6 +129,18 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
this.toUnbind.push(this.onDidPanelClose(panel => this.compositeBar.deactivateComposite(panel.getId())));
}
private _onDidPanelOpen(viewlet: IPanel): void {
this.activePanelContextKey.set(viewlet.getId());
}
private _onDidPanelClose(viewlet: IPanel): void {
const id = viewlet.getId();
if (this.activePanelContextKey.get() === id) {
this.activePanelContextKey.reset();
}
}
public get onDidPanelOpen(): Event<IPanel> {
return this._onDidCompositeOpen.event;
}
@@ -277,6 +299,11 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
}
return this.toolBar.getItemsWidth();
}
dispose(): void {
super.dispose();
this.disposables = dispose(this.disposables);
}
}
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
@@ -340,7 +340,7 @@ export class StopAction extends AbstractDebugAction {
}
protected isEnabled(state: State): boolean {
return super.isEnabled(state) && (state === State.Running || state === State.Stopped);
return super.isEnabled(state) && (state !== State.Inactive);
}
}
@@ -92,7 +92,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
this.updateScheduler = new RunOnceScheduler(() => {
const state = this.debugService.state;
if (state === State.Inactive || state === State.Initializing || this.configurationService.getValue<IDebugConfiguration>('debug').hideActionBar
if (state === State.Inactive || this.configurationService.getValue<IDebugConfiguration>('debug').hideActionBar
|| this.configurationService.getValue<IDebugConfiguration>('debug').toolbar !== 'float') {
return this.hide();
}
@@ -38,6 +38,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
// How long in milliseconds should an average frame take to render for a notification to appear
// which suggests the fallback DOM-based renderer
const SLOW_CANVAS_RENDER_THRESHOLD = 50;
const NUMBER_OF_FRAMES_TO_MEASURE = 20;
let Terminal: typeof XTermTerminal;
@@ -436,13 +437,16 @@ export class TerminalInstance implements ITerminalInstance {
}
private _measureRenderTime(): void {
let frameTimes: number[] = [];
const textRenderLayer = (<any>this._xterm).renderer._renderLayers[0];
const originalOnGridChanged = textRenderLayer.onGridChanged;
textRenderLayer.onGridChanged = (terminal: XTermTerminal, firstRow: number, lastRow: number) => {
const startTime = performance.now();
originalOnGridChanged.call(textRenderLayer, terminal, firstRow, lastRow);
const renderTimeMilliseconds = performance.now() - startTime;
if (renderTimeMilliseconds > SLOW_CANVAS_RENDER_THRESHOLD) {
const evaluateCanvasRenderer = () => {
// Discard first frame time as it's normal to take longer
frameTimes.shift();
const averageTime = frameTimes.reduce((p, c) => p + c) / frameTimes.length;
if (averageTime > SLOW_CANVAS_RENDER_THRESHOLD) {
const promptChoices: IPromptChoice[] = [
{
label: nls.localize('yes', "Yes"),
@@ -453,7 +457,8 @@ export class TerminalInstance implements ITerminalInstance {
}
} as IPromptChoice,
{
label: nls.localize('no', "No")
label: nls.localize('no', "No"),
run: () => { }
} as IPromptChoice,
{
label: nls.localize('dontShowAgain', "Don't Show Again"),
@@ -463,13 +468,21 @@ export class TerminalInstance implements ITerminalInstance {
];
this._notificationService.prompt(
Severity.Warning,
nls.localize('terminal.slowRendering', 'The current standard canvas renderer for the integrated terminal appears to be slow on your computer. Using the DOM-based renderer may improve performance, do you want to switch to the DOM-based renderer? [Read more about terminal settings](https://code.visualstudio.com/docs/editor/integrated-terminal#_changing-how-the-terminal-is-rendered).'),
nls.localize('terminal.slowRendering', 'The standard renderer for the integrated terminal appears to be slow on your computer. Would you like to switch to the alternative DOM-based renderer which may improve performance? [Read more about terminal settings](https://code.visualstudio.com/docs/editor/integrated-terminal#_changing-how-the-terminal-is-rendered).'),
promptChoices
);
}
};
// Restore original function
textRenderLayer.onGridChanged = originalOnGridChanged;
textRenderLayer.onGridChanged = (terminal: XTermTerminal, firstRow: number, lastRow: number) => {
const startTime = performance.now();
originalOnGridChanged.call(textRenderLayer, terminal, firstRow, lastRow);
frameTimes.push(performance.now() - startTime);
if (frameTimes.length === NUMBER_OF_FRAMES_TO_MEASURE) {
evaluateCanvasRenderer();
// Restore original function
textRenderLayer.onGridChanged = originalOnGridChanged;
}
};
}
@@ -4,19 +4,21 @@
*--------------------------------------------------------------------------------------------*/
import * as DOM from 'vs/base/browser/dom';
import { domEvent } from 'vs/base/browser/event';
import { Emitter, Event } from 'vs/base/common/event';
import { IDisposable } from 'vs/base/common/lifecycle';
import URI from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { EditorOptions } from 'vs/workbench/common/editor';
import { IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
import { WebviewEditorInput } from 'vs/workbench/parts/webview/electron-browser/webviewEditorInput';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IPartService, Parts } from 'vs/workbench/services/part/common/partService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { BaseWebviewEditor, KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED, KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE } from './baseWebviewEditor';
import { WebviewElement } from './webviewElement';
import { CancellationToken } from 'vs/base/common/cancellation';
@@ -31,6 +33,7 @@ export class WebviewEditor extends BaseWebviewEditor {
private _webviewFocusTracker?: DOM.IFocusTracker;
private _webviewFocusListenerDisposable?: IDisposable;
private _onFocusWindowHandler?: IDisposable;
private readonly _onDidFocusWebview = new Emitter<void>();
@@ -41,6 +44,7 @@ export class WebviewEditor extends BaseWebviewEditor {
@IPartService private readonly _partService: IPartService,
@IWorkspaceContextService private readonly _contextService: IWorkspaceContextService,
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@IWorkbenchEditorService private readonly _editorService: IWorkbenchEditorService,
) {
super(WebviewEditor.ID, telemetryService, themeService, _contextKeyService);
}
@@ -72,6 +76,20 @@ export class WebviewEditor extends BaseWebviewEditor {
super.layout(dimension);
}
public focus() {
super.focus();
if (this._onFocusWindowHandler) {
return;
}
// Make sure we restore focus when switching back to a VS Code window
this._onFocusWindowHandler = domEvent(window, 'focus')(() => {
if (this._editorService.getActiveEditor() === this) {
this.focus();
}
});
}
public dispose(): void {
// Let the editor input dispose of the webview.
this._webview = undefined;
@@ -87,6 +105,10 @@ export class WebviewEditor extends BaseWebviewEditor {
this._webviewFocusListenerDisposable.dispose();
}
if (this._onFocusWindowHandler) {
this._onFocusWindowHandler.dispose();
}
super.dispose();
}
@@ -57,7 +57,7 @@ export class ViewletService implements IViewletService {
const id = viewlet.getId();
if (this.activeViewletContextKey.get() === id) {
this.activeViewletContextKey.set('');
this.activeViewletContextKey.reset();
}
}
+3 -3
View File
@@ -5997,9 +5997,9 @@ vscode-textmate@^3.3.3:
fast-plist "^0.1.2"
oniguruma "^6.0.1"
vscode-xterm@3.5.0-beta5:
version "3.5.0-beta5"
resolved "https://registry.yarnpkg.com/vscode-xterm/-/vscode-xterm-3.5.0-beta5.tgz#f44c0e327d292a90110ef086d9d98954f479b74b"
vscode-xterm@3.5.0-beta6:
version "3.5.0-beta6"
resolved "https://registry.yarnpkg.com/vscode-xterm/-/vscode-xterm-3.5.0-beta6.tgz#215df0c812536830ce65c3266ad5fc9ffe7b4a4f"
vso-node-api@^6.1.2-preview:
version "6.1.2-preview"