Merge from vscode de81ccf04849309f843db21130c806a5783678f7 (#4738)

This commit is contained in:
Anthony Dresser
2019-03-28 13:06:16 -07:00
committed by GitHub
parent cc2951265e
commit e6785ffe95
77 changed files with 562 additions and 835 deletions

View File

@@ -157,6 +157,7 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget {
addClass(message, 'message');
parent.appendChild(message);
this._message = message;
this._message.tabIndex = 0;
const container = document.createElement('div');
addClass(container, 'results');
@@ -340,6 +341,7 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget {
this.setMetaTitle('');
this._message.innerText = message;
this._show();
this._message.focus();
}
async showItem(item: CallHierarchyItem): Promise<void> {

View File

@@ -10,7 +10,6 @@ import { IIdentityProvider, IListVirtualDelegate } from 'vs/base/browser/ui/list
import { FuzzyScore, createMatches } from 'vs/base/common/filters';
import { IconLabel } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { symbolKindToCssClass, Location } from 'vs/editor/common/modes';
import { ILabelService } from 'vs/platform/label/common/label';
import { Range } from 'vs/editor/common/core/range';
import { hash } from 'vs/base/common/hash';
@@ -67,21 +66,16 @@ export class CallRenderer implements ITreeRenderer<Call, FuzzyScore, CallRenderi
templateId: string = CallRenderer.id;
constructor(
@ILabelService private readonly _labelService: ILabelService,
) { }
renderTemplate(container: HTMLElement): CallRenderingTemplate {
const iconLabel = new IconLabel(container, { supportHighlights: true });
return { iconLabel };
}
renderElement(node: ITreeNode<Call, FuzzyScore>, _index: number, template: CallRenderingTemplate): void {
const { element, filterData } = node;
const detail = element.item.detail || this._labelService.getUriLabel(element.item.uri, { relative: true });
template.iconLabel.setLabel(
element.item.name,
detail,
element.item.detail,
{
labelEscapeNewLines: true,
matches: createMatches(filterData),

View File

@@ -16,6 +16,7 @@
display: inherit;
text-align: center;
padding-top: 3em;
height: 100%;
}
.monaco-workbench .action-label.calls-to {

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -279,7 +279,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: TOGGLE_WORD_WRAP_ID,
title: nls.localize('unwrapMinified', "Disable wrapping for this file"),
iconLocation: { dark: URI.parse(require.toUrl('vs/workbench/contrib/codeEditor/electron-browser/media/WordWrap_16x.svg')) }
iconLocation: { dark: URI.parse(require.toUrl('vs/workbench/contrib/codeEditor/browser/WordWrap_16x.svg')) }
},
group: 'navigation',
order: 1,
@@ -293,7 +293,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: TOGGLE_WORD_WRAP_ID,
title: nls.localize('wrapMinified', "Enable wrapping for this file"),
iconLocation: { dark: URI.parse(require.toUrl('vs/workbench/contrib/codeEditor/electron-browser/media/WordWrap_16x.svg')) }
iconLocation: { dark: URI.parse(require.toUrl('vs/workbench/contrib/codeEditor/browser/WordWrap_16x.svg')) }
},
group: 'navigation',
order: 1,

View File

@@ -199,27 +199,29 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
this._actionbarWidget = new ActionBar(actionsContainer, {});
this._disposables.push(this._actionbarWidget);
this._collapseAction = new Action('review.expand', nls.localize('label.collapse', "Collapse"), COLLAPSE_ACTION_CLASS, true, () => {
if (this._commentThread.comments.length === 0) {
if ((this._commentThread as modes.CommentThread2).commentThreadHandle === undefined) {
this.dispose();
return Promise.resolve();
} else {
const deleteCommand = (this._commentThread as modes.CommentThread2).deleteCommand;
if (deleteCommand) {
return this.commandService.executeCommand(deleteCommand.id, ...(deleteCommand.arguments || []));
}
}
}
this._isCollapsed = true;
this.hide();
return Promise.resolve();
});
this._collapseAction = new Action('review.expand', nls.localize('label.collapse', "Collapse"), COLLAPSE_ACTION_CLASS, true, () => this.collapse());
this._actionbarWidget.push(this._collapseAction, { label: false, icon: true });
}
public collapse(): Promise<void> {
if (this._commentThread.comments.length === 0) {
if ((this._commentThread as modes.CommentThread2).commentThreadHandle === undefined) {
this.dispose();
return Promise.resolve();
} else {
const deleteCommand = (this._commentThread as modes.CommentThread2).deleteCommand;
if (deleteCommand) {
return this.commandService.executeCommand(deleteCommand.id, ...(deleteCommand.arguments || []));
}
}
}
this._isCollapsed = true;
this.hide();
return Promise.resolve();
}
public getGlyphPosition(): number {
if (this._commentGlyph) {
return this._commentGlyph.getPosition().position!.lineNumber;
@@ -291,8 +293,10 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
// Move comment glyph widget and show position if the line has changed.
const lineNumber = this._commentThread.range.startLineNumber;
let shouldMoveWidget = false;
if (this._commentGlyph) {
if (this._commentGlyph.getPosition().position!.lineNumber !== lineNumber) {
shouldMoveWidget = true;
this._commentGlyph.setLineNumber(lineNumber);
}
}
@@ -301,7 +305,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
this.createReplyButton();
}
if (!this._isCollapsed) {
if (shouldMoveWidget && !this._isCollapsed) {
this.show({ lineNumber, column: 1 }, 2);
}
}
@@ -319,11 +323,11 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
}
protected _onWidth(widthInPixel: number): void {
this._commentEditor.layout({ height: (this._commentEditor.hasWidgetFocus() ? 5 : 1) * 18, width: widthInPixel - 54 /* margin 20px * 10 + scrollbar 14px*/ });
this._commentEditor.layout({ height: 5 * 18, width: widthInPixel - 54 /* margin 20px * 10 + scrollbar 14px*/ });
}
protected _doLayout(heightInPixel: number, widthInPixel: number): void {
this._commentEditor.layout({ height: (this._commentEditor.hasWidgetFocus() ? 5 : 1) * 18, width: widthInPixel - 54 /* margin 20px * 10 + scrollbar 14px*/ });
this._commentEditor.layout({ height: 5 * 18, width: widthInPixel - 54 /* margin 20px * 10 + scrollbar 14px*/ });
}
display(lineNumber: number) {
@@ -451,13 +455,15 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
this._disposables.push((this._commentThread as modes.CommentThread2).onDidChangeRange(range => {
// Move comment glyph widget and show position if the line has changed.
const lineNumber = this._commentThread.range.startLineNumber;
let shouldMoveWidget = false;
if (this._commentGlyph) {
if (this._commentGlyph.getPosition().position!.lineNumber !== lineNumber) {
shouldMoveWidget = true;
this._commentGlyph.setLineNumber(lineNumber);
}
}
if (!this._isCollapsed) {
if (shouldMoveWidget && !this._isCollapsed) {
this.show({ lineNumber, column: 1 }, 2);
}
}));
@@ -997,6 +1003,8 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
hide() {
this._isCollapsed = true;
// Focus the container so that the comment editor will be blurred before it is hidden
this.editor.focus();
super.hide();
}

View File

@@ -16,7 +16,6 @@ import { IEditorContribution, IModelChangedEvent } from 'vs/editor/common/editor
import { IRange, Range } from 'vs/editor/common/core/range';
import * as modes from 'vs/editor/common/modes';
import { peekViewResultsBackground, peekViewResultsSelectionBackground, peekViewTitleBackground } from 'vs/editor/contrib/referenceSearch/referencesWidget';
import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { editorForeground } from 'vs/platform/theme/common/colorRegistry';
@@ -36,8 +35,6 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { ctxCommentEditorFocused, SimpleCommentEditor } from 'vs/workbench/contrib/comments/browser/simpleCommentEditor';
import { onUnexpectedError } from 'vs/base/common/errors';
export const ctxCommentThreadVisible = new RawContextKey<boolean>('commentThreadVisible', false);
export const ID = 'editor.contrib.review';
export class ReviewViewZone implements IViewZone {
@@ -161,7 +158,6 @@ export class ReviewController implements IEditorContribution {
private editor: ICodeEditor;
private _newCommentWidget?: ReviewZoneWidget;
private _commentWidgets: ReviewZoneWidget[];
private _commentThreadVisible: IContextKey<boolean>;
private _commentInfos: ICommentInfo[];
private _commentingRangeDecorator: CommentingRangeDecorator;
private mouseDownInfo: { lineNumber: number } | null = null;
@@ -176,7 +172,6 @@ export class ReviewController implements IEditorContribution {
constructor(
editor: ICodeEditor,
@IContextKeyService readonly contextKeyService: IContextKeyService,
@ICommentService private readonly commentService: ICommentService,
@ICommandService private readonly _commandService: ICommandService,
@INotificationService private readonly notificationService: INotificationService,
@@ -193,7 +188,6 @@ export class ReviewController implements IEditorContribution {
this._pendingNewCommentCache = {};
this._computePromise = null;
this._commentThreadVisible = ctxCommentThreadVisible.bindTo(contextKeyService);
this._commentingRangeDecorator = new CommentingRangeDecorator();
this.globalToDispose.push(this.commentService.onDidDeleteDataProvider(ownerId => {
@@ -458,7 +452,6 @@ export class ReviewController implements IEditorContribution {
}
// add new comment
this._commentThreadVisible.set(true);
this._newCommentWidget = this.instantiationService.createInstance(ReviewZoneWidget, this.editor, ownerId, {
extensionId: extensionId,
threadId: null,
@@ -687,8 +680,6 @@ export class ReviewController implements IEditorContribution {
}
public closeWidget(): void {
this._commentThreadVisible.reset();
if (this._newCommentWidget) {
this._newCommentWidget.dispose();
this._newCommentWidget = undefined;
@@ -783,12 +774,17 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'closeReviewPanel',
id: 'workbench.action.hideComment',
weight: KeybindingWeight.EditorContrib,
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape],
when: ctxCommentThreadVisible,
handler: closeReviewPanel
when: ctxCommentEditorFocused,
handler: (accessor, args) => {
const activeCodeEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor();
if (activeCodeEditor instanceof SimpleCommentEditor) {
activeCodeEditor.getParentThread().collapse();
}
}
});
export function getActiveEditor(accessor: ServicesAccessor): IActiveCodeEditor | null {
@@ -809,21 +805,6 @@ export function getActiveEditor(accessor: ServicesAccessor): IActiveCodeEditor |
return activeTextEditorWidget;
}
function closeReviewPanel(accessor: ServicesAccessor, args: any) {
const outerEditor = getActiveEditor(accessor);
if (!outerEditor) {
return;
}
const controller = ReviewController.get(outerEditor);
if (!controller) {
return;
}
controller.closeWidget();
}
registerThemingParticipant((theme, collector) => {
const peekViewBackground = theme.getColor(peekViewResultsBackground);
if (peekViewBackground) {

View File

@@ -5,4 +5,5 @@
export interface ICommentThreadWidget {
submitComment: () => Promise<void>;
}
collapse: () => void;
}

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { RunOnceScheduler, ignoreErrors } from 'vs/base/common/async';
import { RunOnceScheduler, ignoreErrors, sequence } from 'vs/base/common/async';
import * as dom from 'vs/base/browser/dom';
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { IDebugService, State, IStackFrame, IDebugSession, IThread, CONTEXT_CALLSTACK_ITEM_TYPE, IDebugModel } from 'vs/workbench/contrib/debug/common/debug';
@@ -28,6 +28,7 @@ import { TreeResourceNavigator2, WorkbenchAsyncDataTree } from 'vs/platform/list
import { onUnexpectedError } from 'vs/base/common/errors';
import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel';
import { createMatches, FuzzyScore } from 'vs/base/common/filters';
import { Event } from 'vs/base/common/event';
const $ = dom.$;
@@ -45,6 +46,7 @@ export class CallStackView extends ViewletPanel {
private dataSource: CallStackDataSource;
private tree: WorkbenchAsyncDataTree<CallStackItem | IDebugModel, CallStackItem, FuzzyScore>;
private contributedContextMenu: IMenu;
private parentSessionToExpand = new Set<IDebugSession>();
constructor(
private options: IViewletViewOptions,
@@ -80,7 +82,11 @@ export class CallStackView extends ViewletPanel {
this.needsRefresh = false;
this.dataSource.deemphasizedStackFramesToShow = [];
this.tree.updateChildren().then(() => this.updateTreeSelection());
this.tree.updateChildren().then(() => {
this.parentSessionToExpand.forEach(s => this.tree.expand(s));
this.parentSessionToExpand.clear();
this.updateTreeSelection();
});
}, 50);
}
@@ -193,7 +199,8 @@ export class CallStackView extends ViewletPanel {
this.onCallStackChangeScheduler.schedule();
}
}));
this.disposables.push(this.debugService.getViewModel().onDidFocusStackFrame(() => {
const onCallStackChange = Event.any<any>(this.debugService.getViewModel().onDidFocusStackFrame, this.debugService.getViewModel().onDidFocusSession);
this.disposables.push(onCallStackChange(() => {
if (this.ignoreFocusStackFrameEvent) {
return;
}
@@ -216,6 +223,13 @@ export class CallStackView extends ViewletPanel {
this.onCallStackChangeScheduler.schedule();
}
}));
this.disposables.push(this.debugService.onDidNewSession(s => {
if (s.parentSession) {
// Auto expand sessions that have sub sessions
this.parentSessionToExpand.add(s.parentSession);
}
}));
}
layoutBody(height: number, width: number): void {
@@ -253,11 +267,20 @@ export class CallStackView extends ViewletPanel {
updateSelectionAndReveal(session);
}
} else {
const expansionsPromise = ignoreErrors(this.tree.expand(thread.session))
.then(() => ignoreErrors(this.tree.expand(thread)));
if (stackFrame) {
expansionsPromise.then(() => updateSelectionAndReveal(stackFrame));
const expandPromises = [() => ignoreErrors(this.tree.expand(thread))];
let s: IDebugSession | undefined = thread.session;
while (s) {
const sessionToExpand = s;
expandPromises.push(() => ignoreErrors(this.tree.expand(sessionToExpand)));
s = s.parentSession;
}
sequence(expandPromises.reverse()).then(() => {
const toReveal = stackFrame || session;
if (toReveal) {
updateSelectionAndReveal(toReveal);
}
});
}
}
@@ -574,7 +597,7 @@ class CallStackDataSource implements IAsyncDataSource<IDebugModel, CallStackItem
if (sessions.length === 0) {
return Promise.resolve([]);
}
if (sessions.length > 1) {
if (sessions.length > 1 || this.debugService.getViewModel().isMultiSessionView()) {
return Promise.resolve(sessions.filter(s => !s.parentSession));
}

View File

@@ -214,6 +214,10 @@ export class FocusSessionActionItem extends SelectActionItem {
this.update();
}
protected getActionContext(_: string, index: number): any {
return this.debugService.getModel().getSessions()[index];
}
private update() {
const session = this.debugService.getViewModel().focusedSession;
const sessions = this.getSessions();

View File

@@ -8,22 +8,14 @@ import { Action } from 'vs/base/common/actions';
import * as lifecycle from 'vs/base/common/lifecycle';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IDebugService, State, IDebugSession, IThread, IEnablement, IBreakpoint, IStackFrame, REPL_ID }
from 'vs/workbench/contrib/debug/common/debug';
import { Variable, Expression, Thread, Breakpoint } from 'vs/workbench/contrib/debug/common/debugModel';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { IDebugService, State, IEnablement, IBreakpoint, IDebugSession } from 'vs/workbench/contrib/debug/common/debug';
import { Variable, Breakpoint } from 'vs/workbench/contrib/debug/common/debugModel';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { TogglePanelAction } from 'vs/workbench/browser/panel';
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { CollapseAction } from 'vs/workbench/browser/viewlet';
import { first } from 'vs/base/common/arrays';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { memoize } from 'vs/base/common/decorators';
import { AsyncDataTree } from 'vs/base/browser/ui/tree/asyncDataTree';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
import { startDebugging } from 'vs/workbench/contrib/debug/common/debugUtils';
export abstract class AbstractDebugAction extends Action {
@@ -135,23 +127,8 @@ export class StartAction extends AbstractDebugAction {
this.toDispose.push(this.contextService.onDidChangeWorkbenchState(() => this.updateEnablement()));
}
// Note: When this action is executed from the process explorer, a config is passed. For all
// other cases it is run with no arguments.
public run(): Promise<any> {
const configurationManager = this.debugService.getConfigurationManager();
let launch = configurationManager.selectedConfiguration.launch;
if (!launch || launch.getConfigurationNames().length === 0) {
const rootUri = this.historyService.getLastActiveWorkspaceRoot();
launch = configurationManager.getLaunch(rootUri);
if (!launch || launch.getConfigurationNames().length === 0) {
const launches = configurationManager.getLaunches();
launch = first(launches, l => !!(l && l.getConfigurationNames().length), launch);
}
configurationManager.selectConfiguration(launch);
}
return this.debugService.startDebugging(launch, undefined, this.isNoDebug());
public run(): Promise<boolean> {
return startDebugging(this.debugService, this.historyService, this.isNoDebug());
}
protected isNoDebug(): boolean {
@@ -204,242 +181,6 @@ export class SelectAndStartAction extends AbstractDebugAction {
}
}
export class RestartAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.restart';
static LABEL = nls.localize('restartDebug', "Restart");
static RECONNECT_LABEL = nls.localize('reconnectDebug', "Reconnect");
constructor(id: string, label: string,
@IDebugService debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IHistoryService private readonly historyService: IHistoryService
) {
super(id, label, 'debug-action restart', debugService, keybindingService, 70);
this.setLabel(this.debugService.getViewModel().focusedSession);
this.toDispose.push(this.debugService.getViewModel().onDidFocusSession(() => this.setLabel(this.debugService.getViewModel().focusedSession)));
}
@memoize
private get startAction(): StartAction {
return new StartAction(StartAction.ID, StartAction.LABEL, this.debugService, this.keybindingService, this.contextService, this.historyService);
}
private setLabel(session: IDebugSession | undefined): void {
if (session) {
this.updateLabel(session && session.configuration.request === 'attach' ? RestartAction.RECONNECT_LABEL : RestartAction.LABEL);
}
}
public run(session: IDebugSession | undefined): Promise<any> {
if (!session || !session.getId) {
session = this.debugService.getViewModel().focusedSession;
}
if (!session) {
return this.startAction.run();
}
session.removeReplExpressions();
return this.debugService.restartSession(session);
}
protected isEnabled(state: State): boolean {
return super.isEnabled(state) && (
state === State.Running ||
state === State.Stopped ||
StartAction.isEnabled(this.debugService)
);
}
}
export class StepOverAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.stepOver';
static LABEL = nls.localize('stepOverDebug', "Step Over");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action step-over', debugService, keybindingService, 20);
}
public run(thread: IThread | undefined): Promise<any> {
if (!(thread instanceof Thread)) {
thread = this.debugService.getViewModel().focusedThread;
}
return thread ? thread.next() : Promise.resolve();
}
protected isEnabled(state: State): boolean {
return super.isEnabled(state) && state === State.Stopped;
}
}
export class StepIntoAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.stepInto';
static LABEL = nls.localize('stepIntoDebug', "Step Into");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action step-into', debugService, keybindingService, 30);
}
public run(thread: IThread | undefined): Promise<any> {
if (!(thread instanceof Thread)) {
thread = this.debugService.getViewModel().focusedThread;
}
return thread ? thread.stepIn() : Promise.resolve();
}
protected isEnabled(state: State): boolean {
return super.isEnabled(state) && state === State.Stopped;
}
}
export class StepOutAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.stepOut';
static LABEL = nls.localize('stepOutDebug', "Step Out");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action step-out', debugService, keybindingService, 40);
}
public run(thread: IThread | undefined): Promise<any> {
if (!(thread instanceof Thread)) {
thread = this.debugService.getViewModel().focusedThread;
}
return thread ? thread.stepOut() : Promise.resolve();
}
protected isEnabled(state: State): boolean {
return super.isEnabled(state) && state === State.Stopped;
}
}
export class StopAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.stop';
static LABEL = nls.localize('stopDebug', "Stop");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action stop', debugService, keybindingService, 80);
}
public run(session: IDebugSession | undefined): Promise<any> {
if (!session || !session.getId) {
session = this.debugService.getViewModel().focusedSession;
}
return this.debugService.stopSession(session);
}
protected isEnabled(state: State): boolean {
return super.isEnabled(state) && (state !== State.Inactive);
}
}
export class DisconnectAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.disconnect';
static LABEL = nls.localize('disconnectDebug', "Disconnect");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action disconnect', debugService, keybindingService, 80);
}
public run(): Promise<any> {
const session = this.debugService.getViewModel().focusedSession;
return this.debugService.stopSession(session);
}
protected isEnabled(state: State): boolean {
return super.isEnabled(state) && (state === State.Running || state === State.Stopped);
}
}
export class ContinueAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.continue';
static LABEL = nls.localize('continueDebug', "Continue");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action continue', debugService, keybindingService, 10);
}
public run(thread: IThread | undefined): Promise<any> {
if (!(thread instanceof Thread)) {
thread = this.debugService.getViewModel().focusedThread;
}
return thread ? thread.continue() : Promise.resolve();
}
protected isEnabled(state: State): boolean {
return super.isEnabled(state) && state === State.Stopped;
}
}
export class PauseAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.pause';
static LABEL = nls.localize('pauseDebug', "Pause");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action pause', debugService, keybindingService, 10);
}
public run(thread: IThread | undefined): Promise<any> {
if (!(thread instanceof Thread)) {
thread = this.debugService.getViewModel().focusedThread;
if (!thread) {
const session = this.debugService.getViewModel().focusedSession;
const threads = session && session.getAllThreads();
thread = threads && threads.length ? threads[0] : undefined;
}
}
return thread ? thread.pause() : Promise.resolve();
}
protected isEnabled(state: State): boolean {
return super.isEnabled(state) && state === State.Running;
}
}
export class TerminateThreadAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.terminateThread';
static LABEL = nls.localize('terminateThread', "Terminate Thread");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, '', debugService, keybindingService);
}
public run(thread: IThread | undefined): Promise<any> {
if (!(thread instanceof Thread)) {
thread = this.debugService.getViewModel().focusedThread;
}
return thread ? thread.terminate() : Promise.resolve();
}
protected isEnabled(state: State): boolean {
return super.isEnabled(state) && (state === State.Running || state === State.Stopped);
}
}
export class RestartFrameAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.restartFrame';
static LABEL = nls.localize('restartFrame', "Restart Frame");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, '', debugService, keybindingService);
}
public run(frame: IStackFrame | undefined): Promise<any> {
if (!frame) {
frame = this.debugService.getViewModel().focusedStackFrame;
}
return frame!.restart();
}
}
export class RemoveBreakpointAction extends AbstractDebugAction {
static readonly ID = 'workbench.debug.viewlet.action.removeBreakpoint';
static LABEL = nls.localize('removeBreakpoint', "Remove Breakpoint");
@@ -575,29 +316,6 @@ export class AddFunctionBreakpointAction extends AbstractDebugAction {
}
}
export class SetValueAction extends AbstractDebugAction {
static readonly ID = 'workbench.debug.viewlet.action.setValue';
static LABEL = nls.localize('setValue', "Set Value");
constructor(id: string, label: string, private variable: Variable, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, '', debugService, keybindingService);
}
public run(): Promise<any> {
if (this.variable instanceof Variable) {
this.debugService.getViewModel().setSelectedExpression(this.variable);
}
return Promise.resolve();
}
protected isEnabled(state: State): boolean {
const session = this.debugService.getViewModel().focusedSession;
return !!(super.isEnabled(state) && state === State.Stopped && session && session.capabilities.supportsSetVariable);
}
}
export class AddWatchExpressionAction extends AbstractDebugAction {
static readonly ID = 'workbench.debug.viewlet.action.addWatchExpression';
static LABEL = nls.localize('addWatchExpression', "Add Expression");
@@ -617,53 +335,6 @@ export class AddWatchExpressionAction extends AbstractDebugAction {
}
}
export class EditWatchExpressionAction extends AbstractDebugAction {
static readonly ID = 'workbench.debug.viewlet.action.editWatchExpression';
static LABEL = nls.localize('editWatchExpression', "Edit Expression");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, '', debugService, keybindingService);
}
public run(expression: Expression): Promise<any> {
this.debugService.getViewModel().setSelectedExpression(expression);
return Promise.resolve();
}
}
export class AddToWatchExpressionsAction extends AbstractDebugAction {
static readonly ID = 'workbench.debug.viewlet.action.addToWatchExpressions';
static LABEL = nls.localize('addToWatchExpressions', "Add to Watch");
constructor(id: string, label: string, private variable: Variable, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action add-to-watch', debugService, keybindingService);
this.updateEnablement();
}
public run(): Promise<any> {
this.debugService.addWatchExpression(this.variable.evaluateName);
return Promise.resolve(undefined);
}
protected isEnabled(state: State): boolean {
return super.isEnabled(state) && this.variable && !!this.variable.evaluateName;
}
}
export class RemoveWatchExpressionAction extends AbstractDebugAction {
static readonly ID = 'workbench.debug.viewlet.action.removeWatchExpression';
static LABEL = nls.localize('removeWatchExpression', "Remove Expression");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, '', debugService, keybindingService);
}
public run(expression: Expression): Promise<any> {
this.debugService.removeWatchExpressions(expression.getId());
return Promise.resolve();
}
}
export class RemoveAllWatchExpressionsAction extends AbstractDebugAction {
static readonly ID = 'workbench.debug.viewlet.action.removeAllWatchExpressions';
static LABEL = nls.localize('removeAllWatchExpressions', "Remove All Expressions");
@@ -683,53 +354,6 @@ export class RemoveAllWatchExpressionsAction extends AbstractDebugAction {
}
}
export class ToggleReplAction extends TogglePanelAction {
static readonly ID = 'workbench.debug.action.toggleRepl';
static LABEL = nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugConsoleAction' }, 'Debug Console');
private toDispose: lifecycle.IDisposable[];
constructor(id: string, label: string,
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
@IPanelService panelService: IPanelService
) {
super(id, label, REPL_ID, panelService, layoutService, 'debug-action toggle-repl');
this.toDispose = [];
this.registerListeners();
}
private registerListeners(): void {
this.toDispose.push(this.panelService.onDidPanelOpen(({ panel }) => {
if (panel.getId() === REPL_ID) {
this.class = 'debug-action toggle-repl';
this.tooltip = ToggleReplAction.LABEL;
}
}));
}
public dispose(): void {
super.dispose();
this.toDispose = lifecycle.dispose(this.toDispose);
}
}
export class FocusReplAction extends Action {
static readonly ID = 'workbench.debug.action.focusRepl';
static LABEL = nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugFocusConsole' }, 'Focus on Debug Console View');
constructor(id: string, label: string,
@IPanelService private readonly panelService: IPanelService
) {
super(id, label);
}
public run(): Promise<any> {
this.panelService.openPanel(REPL_ID, true);
return Promise.resolve();
}
}
export class FocusSessionAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.focusProcess';
static LABEL = nls.localize('focusSession', "Focus Session");
@@ -742,8 +366,7 @@ export class FocusSessionAction extends AbstractDebugAction {
super(id, label, '', debugService, keybindingService, 100);
}
public run(sessionName: string): Promise<any> {
const session = this.debugService.getModel().getSessions().filter(p => p.getLabel() === sessionName).pop();
public run(session: IDebugSession): Promise<any> {
this.debugService.focusStackFrame(undefined, undefined, session, true);
const stackFrame = this.debugService.getViewModel().focusedStackFrame;
if (stackFrame) {
@@ -754,65 +377,6 @@ export class FocusSessionAction extends AbstractDebugAction {
}
}
// Actions used by the chakra debugger
export class StepBackAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.stepBack';
static LABEL = nls.localize('stepBackDebug', "Step Back");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action step-back', debugService, keybindingService, 50);
}
public run(thread: IThread | undefined): Promise<any> {
if (!(thread instanceof Thread)) {
thread = this.debugService.getViewModel().focusedThread;
}
return thread ? thread.stepBack() : Promise.resolve();
}
protected isEnabled(state: State): boolean {
const session = this.debugService.getViewModel().focusedSession;
return !!(super.isEnabled(state) && state === State.Stopped &&
session && session.capabilities.supportsStepBack);
}
}
export class ReverseContinueAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.reverseContinue';
static LABEL = nls.localize('reverseContinue', "Reverse");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action reverse-continue', debugService, keybindingService, 60);
}
public run(thread: IThread | undefined): Promise<any> {
if (!(thread instanceof Thread)) {
thread = this.debugService.getViewModel().focusedThread;
}
return thread ? thread.reverseContinue() : Promise.resolve();
}
protected isEnabled(state: State): boolean {
const session = this.debugService.getViewModel().focusedSession;
return !!(super.isEnabled(state) && state === State.Stopped &&
session && session.capabilities.supportsStepBack);
}
}
export class ReplCollapseAllAction extends CollapseAction {
constructor(tree: AsyncDataTree<any, any, any>, private toFocus: { focus(): void; }) {
super(tree, true, undefined);
}
public run(event?: any): Promise<any> {
return super.run(event).then(() => {
this.toFocus.focus();
});
}
}
export class CopyValueAction extends Action {
static readonly ID = 'workbench.debug.viewlet.action.copyValue';
static LABEL = nls.localize('copyValue', "Copy Value");
@@ -840,57 +404,3 @@ export class CopyValueAction extends Action {
return Promise.resolve(undefined);
}
}
export class CopyEvaluatePathAction extends Action {
static readonly ID = 'workbench.debug.viewlet.action.copyEvaluatePath';
static LABEL = nls.localize('copyAsExpression', "Copy as Expression");
constructor(
id: string, label: string, private value: Variable,
@IClipboardService private readonly clipboardService: IClipboardService
) {
super(id, label);
this._enabled = this.value && !!this.value.evaluateName;
}
public run(): Promise<any> {
this.clipboardService.writeText(this.value.evaluateName!);
return Promise.resolve(undefined);
}
}
export class CopyAction extends Action {
static readonly ID = 'workbench.debug.action.copy';
static LABEL = nls.localize('copy', "Copy");
constructor(
id: string, label: string,
@IClipboardService private readonly clipboardService: IClipboardService
) {
super(id, label);
}
public run(): Promise<any> {
this.clipboardService.writeText(window.getSelection().toString());
return Promise.resolve(undefined);
}
}
export class CopyStackTraceAction extends Action {
static readonly ID = 'workbench.action.debug.copyStackTrace';
static LABEL = nls.localize('copyStackTrace', "Copy Call Stack");
constructor(
id: string, label: string,
@IClipboardService private readonly clipboardService: IClipboardService,
@ITextResourcePropertiesService private readonly textResourcePropertiesService: ITextResourcePropertiesService
) {
super(id, label);
}
public run(frame: IStackFrame): Promise<any> {
const eol = this.textResourcePropertiesService.getEOL(frame.source.uri);
this.clipboardService.writeText(frame.thread.getCallStack().map(sf => sf.toString()).join(eol));
return Promise.resolve(undefined);
}
}

View File

@@ -149,7 +149,19 @@ export function registerCommands(): void {
primary: KeyCode.F6,
when: CONTEXT_DEBUG_STATE.isEqualTo('running'),
handler: (accessor: ServicesAccessor, _: string, thread: IThread | undefined) => {
getThreadAndRun(accessor, thread, thread => thread.pause());
const debugService = accessor.get(IDebugService);
if (!(thread instanceof Thread)) {
thread = debugService.getViewModel().focusedThread;
if (!thread) {
const session = debugService.getViewModel().focusedSession;
const threads = session && session.getAllThreads();
thread = threads && threads.length ? threads[0] : undefined;
}
}
if (thread) {
thread.pause().then(undefined, onUnexpectedError);
}
}
});

View File

@@ -277,7 +277,7 @@ const registerDebugToolBarItem = (id: string, title: string, icon: string, order
};
registerDebugToolBarItem(CONTINUE_ID, continueLabel, 'continue', 10, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
registerDebugToolBarItem(PAUSE_ID, pauseLabel, 'pause', 10, CONTEXT_DEBUG_STATE.notEqualsTo('stopped'), CONTEXT_DEBUG_STATE.isEqualTo('running'));
registerDebugToolBarItem(PAUSE_ID, pauseLabel, 'pause', 10, CONTEXT_DEBUG_STATE.notEqualsTo('stopped'));
registerDebugToolBarItem(STOP_ID, stopLabel, 'stop', 70, CONTEXT_FOCUSED_SESSION_IS_ATTACH.toNegated());
registerDebugToolBarItem(DISCONNECT_ID, disconnectLabel, 'disconnect', 70, CONTEXT_FOCUSED_SESSION_IS_ATTACH);
registerDebugToolBarItem(STEP_OVER_ID, stepOverLabel, 'step-over', 20, undefined, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));

View File

@@ -524,6 +524,7 @@ export class DebugService implements IDebugService {
);
}
session.shutdown();
this.endInitializingState();
this._onDidEndSession.fire(session);
const focusedSession = this.viewModel.focusedSession;

View File

@@ -34,7 +34,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { INotificationService } from 'vs/platform/notification/common/notification';
import { ViewletPanel, IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { distinct } from 'vs/base/common/arrays';
import { distinct, coalesce } from 'vs/base/common/arrays';
import { IExperimentService, IExperiment, ExperimentActionType } from 'vs/workbench/contrib/experiments/node/experimentService';
import { alert } from 'vs/base/browser/ui/aria/aria';
import { IListContextMenuEvent } from 'vs/base/browser/ui/list/list';
@@ -118,7 +118,7 @@ export class ExtensionsListView extends ViewletPanel {
horizontalScrolling: false
}) as WorkbenchPagedList<IExtension>;
this.list.onContextMenu(e => this.onContextMenu(e), this, this.disposables);
this.list.onFocusChange(e => extensionsViewState.onFocusChange(e.elements), this, this.disposables);
this.list.onFocusChange(e => extensionsViewState.onFocusChange(coalesce(e.elements)), this, this.disposables);
this.disposables.push(this.list);
this.disposables.push(extensionsViewState);

View File

@@ -42,7 +42,7 @@ import { Constants } from 'vs/editor/common/core/uint';
import { CLOSE_EDITORS_AND_GROUP_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands';
import { coalesce } from 'vs/base/common/arrays';
import { AsyncDataTree } from 'vs/base/browser/ui/tree/asyncDataTree';
import { ExplorerItem } from 'vs/workbench/contrib/files/common/explorerModel';
import { ExplorerItem, NewExplorerItem } from 'vs/workbench/contrib/files/common/explorerModel';
import { onUnexpectedError } from 'vs/base/common/errors';
import { sequence } from 'vs/base/common/async';
@@ -100,7 +100,6 @@ export class BaseErrorReportingAction extends Action {
}
}
const PLACEHOLDER_URI = URI.file('');
function refreshIfSeparator(value: string, explorerService: IExplorerService): void {
if (value && ((value.indexOf('/') >= 0) || (value.indexOf('\\') >= 0))) {
// New input contains separator, multiple resources will get created workaround for #68204
@@ -143,7 +142,7 @@ export class NewFileAction extends BaseErrorReportingAction {
return Promise.reject(new Error('Parent folder is readonly.'));
}
const stat = new ExplorerItem(PLACEHOLDER_URI, folder, false);
const stat = new NewExplorerItem(folder, false);
return folder.fetchChildren(this.fileService, this.explorerService).then(() => {
folder.addChild(stat);
@@ -211,7 +210,7 @@ export class NewFolderAction extends BaseErrorReportingAction {
return Promise.reject(new Error('Parent folder is readonly.'));
}
const stat = new ExplorerItem(PLACEHOLDER_URI, folder, true);
const stat = new NewExplorerItem(folder, true);
return folder.fetchChildren(this.fileService, this.explorerService).then(() => {
folder.addChild(stat);

View File

@@ -36,10 +36,6 @@ export class ExplorerDecorationsProvider implements IDecorationsProvider {
return this._onDidChange.event;
}
changed(uris: URI[]): void {
this._onDidChange.fire(uris);
}
provideDecorations(resource: URI): IDecorationData | undefined {
const fileStat = this.explorerService.findClosest(resource);
if (fileStat && fileStat.isRoot && fileStat.isError) {

View File

@@ -37,7 +37,7 @@ import { ITreeContextMenuEvent } from 'vs/base/browser/ui/tree/tree';
import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions';
import { fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { ExplorerItem } from 'vs/workbench/contrib/files/common/explorerModel';
import { ExplorerItem, NewExplorerItem } from 'vs/workbench/contrib/files/common/explorerModel';
import { onUnexpectedError } from 'vs/base/common/errors';
import { ResourceLabels, IResourceLabelsContainer } from 'vs/workbench/browser/labels';
import { createFileIconThemableTreeContainerScope } from 'vs/workbench/browser/parts/views/views';
@@ -45,9 +45,6 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import { IAsyncDataTreeViewState } from 'vs/base/browser/ui/tree/asyncDataTree';
import { FuzzyScore } from 'vs/base/common/filters';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { isMacintosh } from 'vs/base/common/platform';
import { KeyCode } from 'vs/base/common/keyCodes';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { isEqualOrParent } from 'vs/base/common/resources';
import { values } from 'vs/base/common/map';
import { first } from 'vs/base/common/arrays';
@@ -68,7 +65,6 @@ export class ExplorerView extends ViewletPanel {
// Refresh is needed on the initial explorer open
private shouldRefresh = true;
private dragHandler: DelayedDragHandler;
private decorationProvider: ExplorerDecorationsProvider;
private autoReveal = false;
constructor(
@@ -99,9 +95,9 @@ export class ExplorerView extends ViewletPanel {
this.readonlyContext = ExplorerResourceReadonlyContext.bindTo(contextKeyService);
this.rootContext = ExplorerRootContext.bindTo(contextKeyService);
this.decorationProvider = new ExplorerDecorationsProvider(this.explorerService, contextService);
decorationService.registerDecorationsProvider(this.decorationProvider);
this.disposables.push(this.decorationProvider);
const decorationProvider = new ExplorerDecorationsProvider(this.explorerService, contextService);
decorationService.registerDecorationsProvider(decorationProvider);
this.disposables.push(decorationProvider);
this.disposables.push(this.resourceContext);
}
@@ -285,7 +281,13 @@ export class ExplorerView extends ViewletPanel {
accessibilityProvider: new ExplorerAccessibilityProvider(),
ariaLabel: nls.localize('treeAriaLabel', "Files Explorer"),
identityProvider: {
getId: (stat: ExplorerItem) => stat.resource
getId: (stat: ExplorerItem) => {
if (stat instanceof NewExplorerItem) {
return `new:${stat.resource}`;
}
return stat.resource;
}
},
keyboardNavigationLabelProvider: {
getKeyboardNavigationLabel: (stat: ExplorerItem) => {
@@ -338,17 +340,6 @@ export class ExplorerView extends ViewletPanel {
}));
this.disposables.push(this.tree.onContextMenu(e => this.onContextMenu(e)));
this.disposables.push(this.tree.onKeyDown(e => {
const event = new StandardKeyboardEvent(e);
const toggleCollapsed = isMacintosh ? (event.keyCode === KeyCode.DownArrow && event.metaKey) : event.keyCode === KeyCode.Enter;
if (toggleCollapsed && !this.explorerService.isEditable(undefined)) {
const focus = this.tree.getFocus();
if (focus.length === 1 && focus[0].isDirectory) {
this.tree.toggleCollapsed(focus[0]);
}
}
}));
// save view state on shutdown
this.storageService.onWillSaveState(() => {

View File

@@ -222,7 +222,8 @@ export class FilesRenderer implements ITreeRenderer<ExplorerItem, FuzzyScore, IF
const value = inputBox.value;
dispose(toDispose);
container.removeChild(label.element);
editableData.onFinish(value, success);
// Timeout: once done rendering only then re-render #70902
setTimeout(() => editableData.onFinish(value, success), 0);
});
let ignoreDisposeAndBlur = true;
@@ -252,7 +253,7 @@ export class FilesRenderer implements ITreeRenderer<ExplorerItem, FuzzyScore, IF
return toDisposable(() => {
if (!ignoreDisposeAndBlur) {
blurDisposable.dispose();
done(inputBox.isInputValid());
done(false);
}
});
}
@@ -781,7 +782,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
rootsToMove.push(data);
}
}
if (!targetIndex) {
if (targetIndex === undefined) {
targetIndex = workspaceCreationData.length;
}
@@ -804,6 +805,10 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
// Otherwise move
const targetResource = joinPath(target.resource, source.name);
if (source.isReadonly) {
// Do not allow moving readonly items
return Promise.resolve();
}
return this.textFileService.move(source.resource, targetResource).then(undefined, error => {

View File

@@ -367,3 +367,9 @@ export class ExplorerItem {
return null;
}
}
export class NewExplorerItem extends ExplorerItem {
constructor(parent: ExplorerItem, isDirectory: boolean) {
super(URI.file(''), parent, isDirectory);
}
}

View File

@@ -69,8 +69,8 @@ export class ActivityUpdater extends Disposable implements IWorkbenchContributio
}
private updateBadge(): void {
const { errors, warnings, infos, unknowns } = this.markerService.getStatistics();
const total = errors + warnings + infos + unknowns;
const { errors, warnings, infos } = this.markerService.getStatistics();
const total = errors + warnings + infos;
const message = localize('totalProblems', 'Total {0} Problems', total);
this.activityService.showActivity(Constants.MARKERS_PANEL_ID, new NumberBadge(total, () => message));
}

View File

@@ -91,7 +91,6 @@ export class OpenGlobalSettingsAction extends Action {
export class OpenRemoteSettingsAction extends Action {
static readonly ID = 'workbench.action.openRemoteSettings';
static readonly LABEL = nls.localize('openRemoteSettings', "Open User Settings (Remote)");
constructor(
id: string,

View File

@@ -1220,7 +1220,16 @@ export class SettingsTreeFilter implements ITreeFilter<SettingsTreeElement> {
}
class SettingsTreeDelegate implements IListVirtualDelegate<SettingsTreeGroupChild> {
getHeight(element: SettingsTreeElement): number {
private heightCache = new WeakMap<SettingsTreeGroupChild, number>();
getHeight(element: SettingsTreeGroupChild): number {
const cachedHeight = this.heightCache.get(element);
if (typeof cachedHeight === 'number') {
return cachedHeight;
}
if (element instanceof SettingsTreeGroupElement) {
if (element.isFirstGroup) {
return 31;
@@ -1273,6 +1282,10 @@ class SettingsTreeDelegate implements IListVirtualDelegate<SettingsTreeGroupChil
hasDynamicHeight(element: SettingsTreeGroupElement | SettingsTreeSettingElement | SettingsTreeNewExtensionsElement): boolean {
return !(element instanceof SettingsTreeGroupElement);
}
setDynamicHeight(element: SettingsTreeGroupChild, height: number): void {
this.heightCache.set(element, height);
}
}
class NonCollapsibleObjectTreeModel<T> extends ObjectTreeModel<T> {

View File

@@ -38,6 +38,10 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
import { DefaultPreferencesEditorInput, KeybindingsEditorInput, PreferencesEditorInput, SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
import { ExplorerRootContext, ExplorerFolderContext } from 'vs/workbench/contrib/files/common/files';
import { ILabelService } from 'vs/platform/label/common/label';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IWindowService } from 'vs/platform/windows/common/windows';
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
registerSingleton(IPreferencesSearchService, PreferencesSearchService, true);
@@ -385,7 +389,10 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
constructor(
@IEnvironmentService environmentService: IEnvironmentService,
@IPreferencesService private readonly preferencesService: IPreferencesService,
@IWorkspaceContextService private readonly workpsaceContextService: IWorkspaceContextService
@IWorkspaceContextService private readonly workpsaceContextService: IWorkspaceContextService,
@ILabelService labelService: ILabelService,
@IExtensionService extensionService: IExtensionService,
@IWindowService windowService: IWindowService
) {
super();
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
@@ -418,10 +425,27 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
order: 1
});
this.updatePreferencesEditorMenuItem();
this._register(workpsaceContextService.onDidChangeWorkbenchState(() => this.updatePreferencesEditorMenuItem()));
this._register(workpsaceContextService.onDidChangeWorkspaceFolders(() => this.updatePreferencesEditorMenuItemForWorkspaceFolders()));
extensionService.whenInstalledExtensionsRegistered()
.then(() => {
const remoteAuthority = windowService.getConfiguration().remoteAuthority;
const hostLabel = labelService.getHostLabel(REMOTE_HOST_SCHEME, remoteAuthority) || remoteAuthority;
const label = nls.localize('openRemoteSettings', "Open User Settings ({0})", hostLabel);
CommandsRegistry.registerCommand(OpenRemoteSettingsAction.ID, serviceAccessor => {
serviceAccessor.get(IInstantiationService).createInstance(OpenRemoteSettingsAction, OpenRemoteSettingsAction.ID, label).run();
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: OpenRemoteSettingsAction.ID,
title: { value: label, original: `Preferences: Open User Settings (${hostLabel})` },
category: nls.localize('preferencesCategory', "Preferences")
},
when: IsRemoteContext
});
});
}
private updatePreferencesEditorMenuItem() {
@@ -566,18 +590,6 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
group: '1_keyboard_preferences_actions'
});
CommandsRegistry.registerCommand(OpenRemoteSettingsAction.ID, serviceAccessor => {
serviceAccessor.get(IInstantiationService).createInstance(OpenRemoteSettingsAction, OpenRemoteSettingsAction.ID, OpenRemoteSettingsAction.LABEL).run();
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: OpenRemoteSettingsAction.ID,
title: { value: OpenRemoteSettingsAction.LABEL, original: 'Preferences: Open Remote Settings' },
category: nls.localize('preferencesCategory', "Preferences")
},
when: IsRemoteContext
});
abstract class SettingsCommand extends Command {
protected getPreferencesEditor(accessor: ServicesAccessor): PreferencesEditor | SettingsEditor2 | null {

View File

@@ -1384,6 +1384,8 @@ class TaskService extends Disposable implements ITaskService {
return Promise.all([this.extensionService.activateByEvent('onCommand:workbench.action.tasks.runTask'), TaskDefinitionRegistry.onReady()]).then(() => {
let validTypes: IStringDictionary<boolean> = Object.create(null);
TaskDefinitionRegistry.all().forEach(definition => validTypes[definition.taskType] = true);
validTypes['shell'] = true;
validTypes['process'] = true;
return new Promise<TaskSet[]>(resolve => {
let result: TaskSet[] = [];
let counter: number = 0;

View File

@@ -426,16 +426,23 @@ export class TerminalInstance implements ITerminalInstance {
this._xterm.on('key', (key, ev) => this._onKey(key, ev));
if (this._processManager) {
if (this._processManager.os === platform.OperatingSystem.Windows) {
this._xterm.winptyCompatInit();
}
this._processManager.onProcessData(data => this._onProcessData(data));
this._xterm.on('data', data => this._processManager!.write(data));
// TODO: How does the cwd work on detached processes?
this._linkHandler = this._instantiationService.createInstance(TerminalLinkHandler, this._xterm, platform.platform, this._processManager);
this.processReady.then(async () => {
this._linkHandler.processCwd = await this._processManager!.getInitialCwd();
});
// Init winpty compat and link handler after process creation as they rely on the
// underlying process OS
this._processManager.onProcessReady(() => {
if (!this._processManager) {
return;
}
if (this._processManager.os === platform.OperatingSystem.Windows) {
this._xterm.winptyCompatInit();
}
this._linkHandler = this._instantiationService.createInstance(TerminalLinkHandler, this._xterm, platform.platform, this._processManager);
});
}
this._xterm.on('focus', () => this._onFocus.fire(this));
@@ -579,7 +586,7 @@ export class TerminalInstance implements ITerminalInstance {
if (this._processManager) {
this._widgetManager = new TerminalWidgetManager(this._wrapperElement);
this._linkHandler.setWidgetManager(this._widgetManager);
this._processManager.onProcessReady(() => this._linkHandler.setWidgetManager(this._widgetManager));
}
const computedStyle = window.getComputedStyle(this._container);