Merge from vscode fb5dc0083bfa9a0e3da7ed1f86e1ecb9836fcc8b

This commit is contained in:
ADS Merger
2020-03-13 05:35:18 +00:00
parent 7658a5df28
commit a7e56d334f
88 changed files with 1627 additions and 553 deletions

View File

@@ -9,7 +9,6 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IFilesConfigurationService, AutoSaveMode } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
import { IWorkingCopyService, IWorkingCopy, WorkingCopyCapabilities } from 'vs/workbench/services/workingCopy/common/workingCopyService';
import { ILifecycleService, LifecyclePhase, ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { ConfirmResult, IFileDialogService, IDialogService } from 'vs/platform/dialogs/common/dialogs';
import Severity from 'vs/base/common/severity';
import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
@@ -20,6 +19,7 @@ import { BackupTracker } from 'vs/workbench/contrib/backup/common/backupTracker'
import { ILogService } from 'vs/platform/log/common/log';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { SaveReason } from 'vs/workbench/common/editor';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
export class NativeBackupTracker extends BackupTracker implements IWorkbenchContribution {
@@ -28,13 +28,13 @@ export class NativeBackupTracker extends BackupTracker implements IWorkbenchCont
@IFilesConfigurationService filesConfigurationService: IFilesConfigurationService,
@IWorkingCopyService workingCopyService: IWorkingCopyService,
@ILifecycleService lifecycleService: ILifecycleService,
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
@IFileDialogService private readonly fileDialogService: IFileDialogService,
@IDialogService private readonly dialogService: IDialogService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IElectronService private readonly electronService: IElectronService,
@ILogService logService: ILogService,
@IEditorService private readonly editorService: IEditorService
@IEditorService private readonly editorService: IEditorService,
@IEnvironmentService private readonly environmentService: IEnvironmentService
) {
super(backupFileService, filesConfigurationService, workingCopyService, logService, lifecycleService);
}
@@ -120,32 +120,36 @@ export class NativeBackupTracker extends BackupTracker implements IWorkbenchCont
// ever activated when quit is requested.
let doBackup: boolean | undefined;
switch (reason) {
case ShutdownReason.CLOSE:
if (this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.filesConfigurationService.hotExitConfiguration === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) {
doBackup = true; // backup if a folder is open and onExitAndWindowClose is configured
} else if (await this.electronService.getWindowCount() > 1 || isMacintosh) {
doBackup = false; // do not backup if a window is closed that does not cause quitting of the application
} else {
doBackup = true; // backup if last window is closed on win/linux where the application quits right after
}
break;
if (this.environmentService.isExtensionDevelopment) {
doBackup = true; // always backup closing extension development window without asking to speed up debugging
} else {
switch (reason) {
case ShutdownReason.CLOSE:
if (this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.filesConfigurationService.hotExitConfiguration === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) {
doBackup = true; // backup if a folder is open and onExitAndWindowClose is configured
} else if (await this.electronService.getWindowCount() > 1 || isMacintosh) {
doBackup = false; // do not backup if a window is closed that does not cause quitting of the application
} else {
doBackup = true; // backup if last window is closed on win/linux where the application quits right after
}
break;
case ShutdownReason.QUIT:
doBackup = true; // backup because next start we restore all backups
break;
case ShutdownReason.QUIT:
doBackup = true; // backup because next start we restore all backups
break;
case ShutdownReason.RELOAD:
doBackup = true; // backup because after window reload, backups restore
break;
case ShutdownReason.RELOAD:
doBackup = true; // backup because after window reload, backups restore
break;
case ShutdownReason.LOAD:
if (this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.filesConfigurationService.hotExitConfiguration === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) {
doBackup = true; // backup if a folder is open and onExitAndWindowClose is configured
} else {
doBackup = false; // do not backup because we are switching contexts
}
break;
case ShutdownReason.LOAD:
if (this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.filesConfigurationService.hotExitConfiguration === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) {
doBackup = true; // backup if a folder is open and onExitAndWindowClose is configured
} else {
doBackup = false; // do not backup because we are switching contexts
}
break;
}
}
// Perform a backup of all dirty working copies unless a backup already exists
@@ -247,10 +251,6 @@ export class NativeBackupTracker extends BackupTracker implements IWorkbenchCont
return false; // if editors have not restored, we are not up to speed with backups and thus should not discard them
}
if (this.environmentService.isExtensionDevelopment) {
return false; // extension development does not track any backups
}
return Promise.all(backupsToDiscard.map(workingCopy => this.backupFileService.discardBackup(workingCopy.resource))).then(() => false, () => false);
}
}

View File

@@ -32,7 +32,6 @@ import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/wo
import { ILogService } from 'vs/platform/log/common/log';
import { HotExitConfiguration } from 'vs/platform/files/common/files';
import { ShutdownReason, ILifecycleService, BeforeShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IFileDialogService, ConfirmResult, IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IWorkspaceContextService, Workspace } from 'vs/platform/workspace/common/workspace';
import { IElectronService } from 'vs/platform/electron/node/electron';
@@ -42,9 +41,10 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { TestFilesConfigurationService, TestEnvironmentService } from 'vs/workbench/test/browser/workbenchTestServices';
import { TestFilesConfigurationService } from 'vs/workbench/test/browser/workbenchTestServices';
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
const userdataDir = getRandomTestPath(os.tmpdir(), 'vsctests', 'backuprestorer');
const backupHome = path.join(userdataDir, 'Backups');
@@ -60,15 +60,15 @@ class TestBackupTracker extends NativeBackupTracker {
@IFilesConfigurationService filesConfigurationService: IFilesConfigurationService,
@IWorkingCopyService workingCopyService: IWorkingCopyService,
@ILifecycleService lifecycleService: ILifecycleService,
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@IFileDialogService fileDialogService: IFileDialogService,
@IDialogService dialogService: IDialogService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IElectronService electronService: IElectronService,
@ILogService logService: ILogService,
@IEditorService editorService: IEditorService
@IEditorService editorService: IEditorService,
@IEnvironmentService environmentService: IEnvironmentService
) {
super(backupFileService, filesConfigurationService, workingCopyService, lifecycleService, environmentService, fileDialogService, dialogService, contextService, electronService, logService, editorService);
super(backupFileService, filesConfigurationService, workingCopyService, lifecycleService, fileDialogService, dialogService, contextService, electronService, logService, editorService, environmentService);
// Reduce timeout for tests
BackupTracker.BACKUP_FROM_CONTENT_CHANGE_DELAY = 10;
@@ -131,8 +131,7 @@ suite.skip('BackupTracker', () => { // {{SQL CARBON EDIT}} skip failing tests
instantiationService.stub(IFilesConfigurationService, new TestFilesConfigurationService(
<IContextKeyService>instantiationService.createInstance(MockContextKeyService),
configurationService,
TestEnvironmentService
configurationService
));
const part = instantiationService.createInstance(EditorPart);

View File

@@ -284,7 +284,11 @@ class ShowAccessibilityHelpAction extends EditorAction {
kbOpts: {
kbExpr: EditorContextKeys.focus,
primary: KeyMod.Alt | KeyCode.F1,
weight: KeybindingWeight.EditorContrib
weight: KeybindingWeight.EditorContrib,
linux: {
primary: KeyMod.Alt | KeyMod.Shift | KeyCode.F1,
secondary: [KeyMod.Alt | KeyCode.F1]
}
}
});
}

View File

@@ -8,7 +8,7 @@ import { IKeyMods } from 'vs/platform/quickinput/common/quickInput';
import { IEditor } from 'vs/editor/common/editorCommon';
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IRange } from 'vs/editor/common/core/range';
import { AbstractGotoLineQuickAccessProvider } from 'vs/editor/contrib/quickAccess/gotoLine';
import { AbstractGotoLineQuickAccessProvider } from 'vs/editor/contrib/quickAccess/gotoLineQuickAccess';
import { Registry } from 'vs/platform/registry/common/platform';
import { IQuickAccessRegistry, Extensions } from 'vs/platform/quickinput/common/quickAccess';

View File

@@ -40,7 +40,7 @@ CommandsRegistry.registerCommand('_workbench.openWith', (accessor: ServicesAcces
// #region Reopen With
const REOPEN_WITH_COMMAND_ID = 'reOpenWith';
const REOPEN_WITH_TITLE = { value: nls.localize('reopenWith.title', 'Reopen With...'), original: 'Reopen With' };
const REOPEN_WITH_TITLE = { value: nls.localize('reopenWith.title', 'Reopen With...'), original: 'Reopen With...' };
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: REOPEN_WITH_COMMAND_ID,

View File

@@ -15,6 +15,7 @@ import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ILabelService } from 'vs/platform/label/common/label';
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
import { GroupIdentifier, IEditorInput, IRevertOptions, ISaveOptions, Verbosity } from 'vs/workbench/common/editor';
import { ICustomEditorModel, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
import { IWebviewService, WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview';
@@ -44,6 +45,7 @@ export class CustomEditorInput extends LazilyResolvedWebviewEditorInput {
@IFileDialogService private readonly fileDialogService: IFileDialogService,
@IFilesConfigurationService private readonly filesConfigurationService: IFilesConfigurationService,
@IEditorService private readonly editorService: IEditorService,
@IUndoRedoService private readonly undoRedoService: IUndoRedoService,
) {
super(id, viewType, '', webview, webviewService, webviewWorkbenchService);
this._editorResource = resource;
@@ -175,10 +177,12 @@ export class CustomEditorInput extends LazilyResolvedWebviewEditorInput {
}
public undo(): void {
assertIsDefined(this._modelRef).object.undo();
assertIsDefined(this._modelRef);
this.undoRedoService.undo(this.resource);
}
public redo(): void {
assertIsDefined(this._modelRef).object.redo();
assertIsDefined(this._modelRef);
this.undoRedoService.redo(this.resource);
}
}

View File

@@ -52,8 +52,6 @@ export interface ICustomEditorModel extends IDisposable {
isDirty(): boolean;
readonly onDidChangeDirty: Event<void>;
undo(): void;
redo(): void;
revert(options?: IRevertOptions): Promise<void>;
save(options?: ISaveOptions): Promise<boolean>;

View File

@@ -64,14 +64,6 @@ export class CustomTextEditorModel extends Disposable implements ICustomEditorMo
return this.textFileService.revert(this.resource, options);
}
public undo() {
this.textFileService.files.get(this.resource)?.textEditorModel?.undo();
}
public redo() {
this.textFileService.files.get(this.resource)?.textEditorModel?.redo();
}
public async save(options?: ISaveOptions): Promise<boolean> {
return !!await this.textFileService.save(this.resource, options);
}

View File

@@ -118,7 +118,7 @@ registerCommands();
// register action to open viewlet
const registry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionRegistryExtensions.WorkbenchActions);
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenDebugPanelAction, OpenDebugPanelAction.ID, OpenDebugPanelAction.LABEL, openPanelKb), 'View: Debug Console', nls.localize('view', "View"));
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenDebugViewletAction, OpenDebugViewletAction.ID, OpenDebugViewletAction.LABEL, openViewletKb), 'View: Show Debug', nls.localize('view', "View"));
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenDebugViewletAction, OpenDebugViewletAction.ID, OpenDebugViewletAction.LABEL, openViewletKb), 'View: Show Run and Debug', nls.localize('view', "View"));
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugToolBar, LifecyclePhase.Restored);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugContentProvider, LifecyclePhase.Eventually);

View File

@@ -125,7 +125,8 @@
font-style: italic;
}
.monaco-workbench .monaco-list-row .expression .error {
.monaco-workbench .monaco-list-row .expression .error,
.monaco-workbench .debug-pane .debug-variables .scope .error {
color: #e51400;
}
@@ -145,7 +146,8 @@
color: rgba(204, 204, 204, 0.6);
}
.vs-dark .monaco-workbench .monaco-list-row .expression .error {
.vs-dark .monaco-workbench .monaco-list-row .expression .error,
.vs-dark .monaco-workbench .debug-pane .debug-variables .scope .error {
color: #f48771;
}
@@ -173,7 +175,8 @@
color: #ce9178;
}
.hc-black .monaco-workbench .monaco-list-row .expression .error {
.hc-black .monaco-workbench .monaco-list-row .expression .error,
.hc-black .monaco-workbench .debug-pane .debug-variables .scope .error {
color: #f48771;
}

View File

@@ -316,6 +316,14 @@
animation-name: debugViewletValueChanged;
}
.debug-pane .debug-variables .scope .error {
font-style: italic;
text-overflow: ellipsis;
overflow: hidden;
font-family: var(--monaco-monospace-font);
font-weight: normal;
}
/* Breakpoints */
.debug-pane .monaco-list-row {

View File

@@ -9,7 +9,7 @@ import * as dom from 'vs/base/browser/dom';
import { CollapseAction } from 'vs/workbench/browser/viewlet';
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { IDebugService, IExpression, IScope, CONTEXT_VARIABLES_FOCUSED, IViewModel } from 'vs/workbench/contrib/debug/common/debug';
import { Variable, Scope } from 'vs/workbench/contrib/debug/common/debugModel';
import { Variable, Scope, ErrorScope } from 'vs/workbench/contrib/debug/common/debugModel';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { renderViewTree, renderVariable, IInputBoxOptions, AbstractExpressionsRenderer, IExpressionTemplateData } from 'vs/workbench/contrib/debug/browser/baseDebugView';
@@ -97,7 +97,7 @@ export class VariablesView extends ViewPane {
const treeContainer = renderViewTree(container);
this.tree = <WorkbenchAsyncDataTree<IViewModel | IExpression | IScope, IExpression | IScope, FuzzyScore>>this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'VariablesView', treeContainer, new VariablesDelegate(),
[this.instantiationService.createInstance(VariablesRenderer), new ScopesRenderer()],
[this.instantiationService.createInstance(VariablesRenderer), new ScopesRenderer(), new ScopeErrorRenderer()],
new VariablesDataSource(), {
ariaLabel: nls.localize('variablesAriaTreeLabel', "Debug Variables"),
accessibilityProvider: new VariablesAccessibilityProvider(),
@@ -217,7 +217,7 @@ function isViewModel(obj: any): obj is IViewModel {
export class VariablesDataSource implements IAsyncDataSource<IViewModel, IExpression | IScope> {
hasChildren(element: IViewModel | IExpression | IScope): boolean {
if (isViewModel(element) || element instanceof Scope) {
if (isViewModel(element)) {
return true;
}
@@ -246,6 +246,10 @@ class VariablesDelegate implements IListVirtualDelegate<IExpression | IScope> {
}
getTemplateId(element: IExpression | IScope): string {
if (element instanceof ErrorScope) {
return ScopeErrorRenderer.ID;
}
if (element instanceof Scope) {
return ScopesRenderer.ID;
}
@@ -278,6 +282,33 @@ class ScopesRenderer implements ITreeRenderer<IScope, FuzzyScore, IScopeTemplate
}
}
interface IScopeErrorTemplateData {
error: HTMLElement;
}
class ScopeErrorRenderer implements ITreeRenderer<IScope, FuzzyScore, IScopeErrorTemplateData> {
static readonly ID = 'scopeError';
get templateId(): string {
return ScopeErrorRenderer.ID;
}
renderTemplate(container: HTMLElement): IScopeErrorTemplateData {
const wrapper = dom.append(container, $('.scope'));
const error = dom.append(wrapper, $('.error'));
return { error };
}
renderElement(element: ITreeNode<IScope, FuzzyScore>, index: number, templateData: IScopeErrorTemplateData): void {
templateData.error.innerText = element.element.name;
}
disposeTemplate(): void {
// noop
}
}
export class VariablesRenderer extends AbstractExpressionsRenderer {
static readonly ID = 'variable';

View File

@@ -190,9 +190,7 @@ export class WatchExpressionsView extends ViewPane {
this.debugService.getViewModel().setSelectedExpression(expression);
return Promise.resolve();
}));
if (!expression.hasChildren) {
actions.push(this.instantiationService.createInstance(CopyValueAction, CopyValueAction.ID, CopyValueAction.LABEL, expression.value, 'watch'));
}
actions.push(this.instantiationService.createInstance(CopyValueAction, CopyValueAction.ID, CopyValueAction.LABEL, expression.value, 'watch'));
actions.push(new Separator());
actions.push(new Action('debug.removeWatchExpression', nls.localize('removeWatchExpression', "Remove Expression"), undefined, true, () => {
@@ -204,9 +202,7 @@ export class WatchExpressionsView extends ViewPane {
actions.push(new AddWatchExpressionAction(AddWatchExpressionAction.ID, AddWatchExpressionAction.LABEL, this.debugService, this.keybindingService));
if (element instanceof Variable) {
const variable = element as Variable;
if (!variable.hasChildren) {
actions.push(this.instantiationService.createInstance(CopyValueAction, CopyValueAction.ID, CopyValueAction.LABEL, variable, 'watch'));
}
actions.push(this.instantiationService.createInstance(CopyValueAction, CopyValueAction.ID, CopyValueAction.LABEL, variable, 'watch'));
actions.push(new Separator());
}
actions.push(new RemoveAllWatchExpressionsAction(RemoveAllWatchExpressionsAction.ID, RemoveAllWatchExpressionsAction.LABEL, this.debugService, this.keybindingService));

View File

@@ -88,22 +88,26 @@ export class WelcomeView extends ViewPane {
const viewsRegistry = Registry.as<IViewsRegistry>(Extensions.ViewsRegistry);
viewsRegistry.registerViewWelcomeContent(WelcomeView.ID, {
content: localize('openAFileWhichCanBeDebugged', "[Open a file](command:{0}) which can be debugged or run.", isMacintosh ? OpenFileFolderAction.ID : OpenFileAction.ID),
content: localize({ key: 'openAFileWhichCanBeDebugged', comment: ['Please do not translate the word "commmand", it is part of our internal syntax which must not change'] },
"[Open a file](command:{0}) which can be debugged or run.", isMacintosh ? OpenFileFolderAction.ID : OpenFileAction.ID),
when: CONTEXT_DEBUGGER_INTERESTED_IN_ACTIVE_EDITOR.toNegated()
});
let debugKeybindingLabel = '';
viewsRegistry.registerViewWelcomeContent(WelcomeView.ID, {
content: localize('runAndDebugAction', "[Run and Debug{0}](command:{1})", debugKeybindingLabel, StartAction.ID),
content: localize({ key: 'runAndDebugAction', comment: ['Please do not translate the word "commmand", it is part of our internal syntax which must not change'] },
"[Run and Debug{0}](command:{1})", debugKeybindingLabel, StartAction.ID),
preconditions: [CONTEXT_DEBUGGER_INTERESTED_IN_ACTIVE_EDITOR]
});
viewsRegistry.registerViewWelcomeContent(WelcomeView.ID, {
content: localize('customizeRunAndDebug', "To customize Run and Debug [create a launch.json file](command:{0}).", ConfigureAction.ID),
content: localize({ key: 'customizeRunAndDebug', comment: ['Please do not translate the word "commmand", it is part of our internal syntax which must not change'] },
"To customize Run and Debug [create a launch.json file](command:{0}).", ConfigureAction.ID),
when: WorkbenchStateContext.notEqualsTo('empty')
});
viewsRegistry.registerViewWelcomeContent(WelcomeView.ID, {
content: localize('customizeRunAndDebugOpenFolder', "To customize Run and Debug, [open a folder](command:{0}) and create a launch.json file.", isMacintosh ? OpenFileFolderAction.ID : OpenFolderAction.ID),
content: localize({ key: 'customizeRunAndDebugOpenFolder', comment: ['Please do not translate the word "commmand", it is part of our internal syntax which must not change'] },
"To customize Run and Debug, [open a folder](command:{0}) and create a launch.json file.", isMacintosh ? OpenFileFolderAction.ID : OpenFolderAction.ID),
when: WorkbenchStateContext.isEqualTo('empty')
});

View File

@@ -301,6 +301,7 @@ export interface IScope extends IExpressionContainer {
readonly name: string;
readonly expensive: boolean;
readonly range?: IRange;
readonly hasChildren: boolean;
}
export interface IStackFrame extends ITreeElement {

View File

@@ -269,6 +269,21 @@ export class Scope extends ExpressionContainer implements IScope {
}
}
export class ErrorScope extends Scope {
constructor(
stackFrame: IStackFrame,
index: number,
message: string,
) {
super(stackFrame, index, message, 0, false);
}
toString(): string {
return this.name;
}
}
export class StackFrame implements IStackFrame {
private scopes: Promise<Scope[]> | undefined;
@@ -293,7 +308,7 @@ export class StackFrame implements IStackFrame {
return response && response.body && response.body.scopes ?
response.body.scopes.map((rs, index) => new Scope(this, index, rs.name, rs.variablesReference, rs.expensive, rs.namedVariables, rs.indexedVariables,
rs.line && rs.column && rs.endLine && rs.endColumn ? new Range(rs.line, rs.column, rs.endLine, rs.endColumn) : undefined)) : [];
}, err => []);
}, err => [new ErrorScope(this, 0, err.message)]);
}
return this.scopes;

View File

@@ -70,7 +70,9 @@ declare module DebugProtocol {
}
/** Cancel request; value of command field is 'cancel'.
The 'cancel' request is used by the frontend to indicate that it is no longer interested in the result produced by a specific request issued earlier.
The 'cancel' request is used by the frontend in two situations:
- to indicate that it is no longer interested in the result produced by a specific request issued earlier
- to cancel a progress indicator.
This request has a hint characteristic: a debug adapter can only be expected to make a 'best effort' in honouring this request but there are no guarantees.
The 'cancel' request may return an error if it could not cancel an operation but a frontend should refrain from presenting this error to end users.
A frontend client should only call this request if the capability 'supportsCancelRequest' is true.
@@ -85,8 +87,10 @@ declare module DebugProtocol {
/** Arguments for 'cancel' request. */
export interface CancelArguments {
/** The ID (attribute 'seq') of the request to cancel. */
/** The ID (attribute 'seq') of the request to cancel. If missing no request is cancelled. Both a 'requestId' and a 'progressId' can be specified in one request. */
requestId?: number;
/** The ID (attribute 'progressId') of the progress to cancel. If missing no progress is cancelled. Both a 'requestId' and a 'progressId' can be specified in one request. */
progressId?: string;
}
/** Response to 'cancel' request. This is just an acknowledgement, so no body field is required. */
@@ -302,6 +306,64 @@ declare module DebugProtocol {
};
}
/** Event message for 'progressStart' event type.
The event signals that a long running operation is about to start and
provides additional information for the client to set up a corresponding progress and cancellation UI.
The client is free to delay the showing of the UI in order to reduce flicker.
*/
export interface ProgressStartEvent extends Event {
// event: 'progressStart';
body: {
/** An ID that must be used in subsequent 'progressUpdate' and 'progressEnd' events to make them refer to the same progress reporting. IDs must be unique within a debug session. */
progressId: string;
/** Mandatory (short) title of the progress reporting. Shown in the UI to describe the long running operation. */
title: string;
/** The request ID that this progress report is related to. If specified a debug adapter is expected to emit
progress events for the long running request until the request has been either completed or cancelled.
If the request ID is omitted, the progress report is assumed to be related to some general activity of the debug adapter.
*/
requestId?: number;
/** If true, the request that reports progress may be canceled with a 'cancel' request.
So this property basically controls whether the client should use UX that supports cancellation.
Clients that don't support cancellation are allowed to ignore the setting.
*/
cancellable?: boolean;
/** Optional, more detailed progress message. */
message?: string;
/** Optional progress percentage to display (value range: 0 to 100). If omitted no percentage will be shown. */
percentage?: number;
};
}
/** Event message for 'progressUpdate' event type.
The event signals that the progress reporting needs to updated with a new message and/or percentage.
The client does not have to update the UI immediately, but the clients needs to keep track of the message and/or percentage values.
*/
export interface ProgressUpdateEvent extends Event {
// event: 'progressUpdate';
body: {
/** The ID that was introduced in the initial 'progressStart' event. */
progressId: string;
/** Optional, more detailed progress message. If omitted, the previous message (if any) is used. */
message?: string;
/** Optional progress percentage to display (value range: 0 to 100). If omitted no percentage will be shown. */
percentage?: number;
};
}
/** Event message for 'progressEnd' event type.
The event signals the end of the progress reporting with an optional final message.
*/
export interface ProgressEndEvent extends Event {
// event: 'progressEnd';
body: {
/** The ID that was introduced in the initial 'ProgressStartEvent'. */
progressId: string;
/** Optional, more detailed progress message. If omitted, the previous message (if any) is used. */
message?: string;
};
}
/** RunInTerminal request; value of command field is 'runInTerminal'.
This request is sent from the debug adapter to the client to run a command in a terminal. This is typically used to launch the debuggee in a terminal provided by the client.
*/
@@ -370,6 +432,8 @@ declare module DebugProtocol {
supportsRunInTerminalRequest?: boolean;
/** Client supports memory references. */
supportsMemoryReferences?: boolean;
/** Client supports progress reporting. */
supportsProgressReporting?: boolean;
}
/** Response to 'initialize' request. */
@@ -1100,6 +1164,7 @@ declare module DebugProtocol {
'watch': evaluate is run in a watch.
'repl': evaluate is run from REPL console.
'hover': evaluate is run from a data hover.
'clipboard': evaluate is run to generate the value that will be stored in the clipboard.
etc.
*/
context?: string;
@@ -1409,6 +1474,8 @@ declare module DebugProtocol {
supportsCancelRequest?: boolean;
/** The debug adapter supports the 'breakpointLocations' request. */
supportsBreakpointLocationsRequest?: boolean;
/** The debug adapter supports the 'clipboard' context value in the 'evaluate' request. */
supportsClipboardContext?: boolean;
}
/** An ExceptionBreakpointsFilter is shown in the UI as an option for configuring how exceptions are dealt with. */

View File

@@ -15,7 +15,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import { dispose, Disposable } from 'vs/base/common/lifecycle';
import { IExtension, ExtensionState, IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewPaneContainer, AutoUpdateConfigurationKey, IExtensionContainer, EXTENSIONS_CONFIG, TOGGLE_IGNORE_EXTENSION_ACTION_ID } from 'vs/workbench/contrib/extensions/common/extensions';
import { ExtensionsConfigurationInitialContent } from 'vs/workbench/contrib/extensions/common/extensionsFileTemplate';
import { ExtensionsLabel, IGalleryExtension, IExtensionGalleryService, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_INCOMPATIBLE, IGalleryExtensionVersion, ILocalExtension, INSTALL_ERROR_NOT_SUPPORTED } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IGalleryExtension, IExtensionGalleryService, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_INCOMPATIBLE, IGalleryExtensionVersion, ILocalExtension, INSTALL_ERROR_NOT_SUPPORTED } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IWorkbenchExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionTipsService, IExtensionRecommendation, IExtensionsConfigContent, IExtensionManagementServer } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { ExtensionType, ExtensionIdentifier, IExtensionDescription, IExtensionManifest, isLanguagePackExtension, ExtensionsPolicy, ExtensionsPolicyKey } from 'vs/platform/extensions/common/extensions'; // {{SQL CARBON EDIT}}
@@ -1960,7 +1960,7 @@ export class ConfigureRecommendedExtensionsCommandsContributor extends Disposabl
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: ConfigureWorkspaceRecommendedExtensionsAction.ID,
title: { value: `${ExtensionsLabel}: ${ConfigureWorkspaceRecommendedExtensionsAction.LABEL}`, original: 'Configure Recommended Extensions (Workspace)' },
title: { value: ConfigureWorkspaceRecommendedExtensionsAction.LABEL, original: 'Configure Recommended Extensions (Workspace)' },
category: localize('extensions', "Extensions")
},
when: this.workspaceContextKey
@@ -1972,7 +1972,7 @@ export class ConfigureRecommendedExtensionsCommandsContributor extends Disposabl
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: ConfigureWorkspaceFolderRecommendedExtensionsAction.ID,
title: { value: `${ExtensionsLabel}: ${ConfigureWorkspaceFolderRecommendedExtensionsAction.LABEL}`, original: 'Configure Recommended Extensions (Workspace Folder)' },
title: { value: ConfigureWorkspaceFolderRecommendedExtensionsAction.LABEL, original: 'Configure Recommended Extensions (Workspace Folder)' },
category: localize('extensions', "Extensions")
},
when: this.workspaceFolderContextKey
@@ -1986,7 +1986,7 @@ export class ConfigureRecommendedExtensionsCommandsContributor extends Disposabl
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: AddToWorkspaceRecommendationsAction.ADD_ID,
title: { value: `${ExtensionsLabel}: ${AddToWorkspaceRecommendationsAction.ADD_LABEL}`, original: 'Add to Recommended Extensions (Workspace)' },
title: { value: AddToWorkspaceRecommendationsAction.ADD_LABEL, original: 'Add to Recommended Extensions (Workspace)' },
category: localize('extensions', "Extensions")
},
when: this.addToWorkspaceRecommendationsContextKey
@@ -2000,7 +2000,7 @@ export class ConfigureRecommendedExtensionsCommandsContributor extends Disposabl
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: AddToWorkspaceFolderRecommendationsAction.ADD_ID,
title: { value: `${ExtensionsLabel}: ${AddToWorkspaceFolderRecommendationsAction.ADD_LABEL}`, original: 'Extensions: Add to Recommended Extensions (Workspace Folder)' },
title: { value: AddToWorkspaceFolderRecommendationsAction.ADD_LABEL, original: 'Extensions: Add to Recommended Extensions (Workspace Folder)' },
category: localize('extensions', "Extensions")
},
when: this.addToWorkspaceFolderRecommendationsContextKey
@@ -2014,7 +2014,7 @@ export class ConfigureRecommendedExtensionsCommandsContributor extends Disposabl
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: AddToWorkspaceRecommendationsAction.IGNORE_ID,
title: { value: `${ExtensionsLabel}: ${AddToWorkspaceRecommendationsAction.IGNORE_LABEL}`, original: 'Extensions: Ignore Recommended Extension (Workspace)' },
title: { value: AddToWorkspaceRecommendationsAction.IGNORE_LABEL, original: 'Extensions: Ignore Recommended Extension (Workspace)' },
category: localize('extensions', "Extensions")
},
when: this.addToWorkspaceRecommendationsContextKey
@@ -2028,7 +2028,7 @@ export class ConfigureRecommendedExtensionsCommandsContributor extends Disposabl
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: AddToWorkspaceFolderRecommendationsAction.IGNORE_ID,
title: { value: `${ExtensionsLabel}: ${AddToWorkspaceFolderRecommendationsAction.IGNORE_LABEL}`, original: 'Extensions: Ignore Recommended Extension (Workspace Folder)' },
title: { value: AddToWorkspaceFolderRecommendationsAction.IGNORE_LABEL, original: 'Extensions: Ignore Recommended Extension (Workspace Folder)' },
category: localize('extensions', "Extensions")
},
when: this.addToWorkspaceFolderRecommendationsContextKey

View File

@@ -12,6 +12,7 @@ import { VIEWLET_ID, IExtensionsViewPaneContainer } from 'vs/workbench/contrib/e
import { IExtensionGalleryService, IExtensionManagementService, IGalleryExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { ILogService } from 'vs/platform/log/common/log';
import { DisposableStore } from 'vs/base/common/lifecycle';
export class InstallExtensionQuickAccessProvider extends PickerQuickAccessProvider<IPickerQuickAccessItem> {
@@ -27,7 +28,7 @@ export class InstallExtensionQuickAccessProvider extends PickerQuickAccessProvid
super(InstallExtensionQuickAccessProvider.PREFIX);
}
protected getPicks(filter: string, token: CancellationToken): Array<IPickerQuickAccessItem | IQuickPickSeparator> | Promise<Array<IPickerQuickAccessItem | IQuickPickSeparator>> {
protected getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Array<IPickerQuickAccessItem | IQuickPickSeparator> | Promise<Array<IPickerQuickAccessItem | IQuickPickSeparator>> {
// Nothing typed
if (!filter) {

View File

@@ -64,24 +64,6 @@ export class ExplorerViewletViewsContribution extends Disposable implements IWor
}
private registerViews(): void {
const viewsRegistry = Registry.as<IViewsRegistry>(Extensions.ViewsRegistry);
this._register(viewsRegistry.registerViewWelcomeContent(EmptyView.ID, {
content: localize('noWorkspaceHelp', "You have not yet added a folder to the workspace.\n[Add Folder](command:{0})", AddRootFolderAction.ID),
when: WorkbenchStateContext.isEqualTo('workspace')
}));
const commandId = isMacintosh ? OpenFileFolderAction.ID : OpenFolderAction.ID;
this._register(viewsRegistry.registerViewWelcomeContent(EmptyView.ID, {
content: localize('remoteNoFolderHelp', "Connected to remote.\n[Open Folder](command:{0})", commandId),
when: ContextKeyExpr.and(WorkbenchStateContext.notEqualsTo('workspace'), RemoteNameContext.notEqualsTo(''), IsWebContext.toNegated())
}));
this._register(viewsRegistry.registerViewWelcomeContent(EmptyView.ID, {
content: localize('noFolderHelp', "You have not yet opened a folder.\n[Open Folder](command:{0})", commandId),
when: ContextKeyExpr.or(ContextKeyExpr.and(WorkbenchStateContext.notEqualsTo('workspace'), RemoteNameContext.isEqualTo('')), ContextKeyExpr.and(WorkbenchStateContext.notEqualsTo('workspace'), IsWebContext))
}));
const viewDescriptors = viewsRegistry.getViews(VIEW_CONTAINER);
let viewDescriptorsToRegister: IViewDescriptor[] = [];
@@ -275,3 +257,23 @@ export const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry
icon: 'codicon-files',
order: 10 // {{SQL CARBON EDIT}}
}, ViewContainerLocation.Sidebar);
const viewsRegistry = Registry.as<IViewsRegistry>(Extensions.ViewsRegistry);
viewsRegistry.registerViewWelcomeContent(EmptyView.ID, {
content: localize({ key: 'noWorkspaceHelp', comment: ['Please do not translate the word "commmand", it is part of our internal syntax which must not change'] },
"You have not yet added a folder to the workspace.\n[Add Folder](command:{0})", AddRootFolderAction.ID),
when: WorkbenchStateContext.isEqualTo('workspace')
});
const commandId = isMacintosh ? OpenFileFolderAction.ID : OpenFolderAction.ID;
viewsRegistry.registerViewWelcomeContent(EmptyView.ID, {
content: localize({ key: 'remoteNoFolderHelp', comment: ['Please do not translate the word "commmand", it is part of our internal syntax which must not change'] },
"Connected to remote.\n[Open Folder](command:{0})", commandId),
when: ContextKeyExpr.and(WorkbenchStateContext.notEqualsTo('workspace'), RemoteNameContext.notEqualsTo(''), IsWebContext.toNegated())
});
viewsRegistry.registerViewWelcomeContent(EmptyView.ID, {
content: localize({ key: 'noFolderHelp', comment: ['Please do not translate the word "commmand", it is part of our internal syntax which must not change'] },
"You have not yet opened a folder.\n[Open Folder](command:{0})", commandId),
when: ContextKeyExpr.or(ContextKeyExpr.and(WorkbenchStateContext.notEqualsTo('workspace'), RemoteNameContext.isEqualTo('')), ContextKeyExpr.and(WorkbenchStateContext.notEqualsTo('workspace'), IsWebContext))
});

View File

@@ -7,7 +7,7 @@ import * as assert from 'assert';
import { Event } from 'vs/base/common/event';
import { toResource } from 'vs/base/test/common/utils';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { TestFilesConfigurationService, TestEnvironmentService, workbenchInstantiationService, TestServiceAccessor } from 'vs/workbench/test/browser/workbenchTestServices';
import { TestFilesConfigurationService, workbenchInstantiationService, TestServiceAccessor } from 'vs/workbench/test/browser/workbenchTestServices';
import { IResolvedTextFileEditorModel, ITextFileEditorModel } from 'vs/workbench/services/textfile/common/textfiles';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
@@ -56,8 +56,7 @@ suite('EditorAutoSave', () => {
instantiationService.stub(IFilesConfigurationService, new TestFilesConfigurationService(
<IContextKeyService>instantiationService.createInstance(MockContextKeyService),
configurationService,
TestEnvironmentService
configurationService
));
const part = instantiationService.createInstance(EditorPart);

View File

@@ -6,7 +6,7 @@
import * as assert from 'assert';
import { toResource } from 'vs/base/test/common/utils';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { workbenchInstantiationService, TestServiceAccessor, TestFilesConfigurationService, TestEnvironmentService } from 'vs/workbench/test/browser/workbenchTestServices';
import { workbenchInstantiationService, TestServiceAccessor, TestFilesConfigurationService } from 'vs/workbench/test/browser/workbenchTestServices';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { IEditorRegistry, EditorDescriptor, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
@@ -56,8 +56,7 @@ suite('Files - TextFileEditor', () => {
instantiationService.stub(IFilesConfigurationService, new TestFilesConfigurationService(
<IContextKeyService>instantiationService.createInstance(MockContextKeyService),
configurationService,
TestEnvironmentService
configurationService
));
const part = instantiationService.createInstance(EditorPart);

View File

@@ -143,39 +143,26 @@ registerAction2(class extends Action2 {
registerAction2(class extends Action2 {
constructor() {
super({
id: `workbench.output.action.turnOffAutoScroll`,
title: nls.localize('outputScrollOff', "Turn Auto Scrolling Off"),
id: `workbench.output.action.toggleAutoScroll`,
title: { value: nls.localize('toggleAutoScroll', "Toggle Auto Scrolling"), original: 'Toggle Auto Scrolling' },
tooltip: { value: nls.localize('outputScrollOff', "Turn Auto Scrolling Off"), original: 'Turn Auto Scrolling Off' },
menu: {
id: MenuId.ViewTitle,
when: ContextKeyExpr.and(ContextKeyEqualsExpr.create('view', OUTPUT_VIEW_ID), CONTEXT_OUTPUT_SCROLL_LOCK.negate()),
when: ContextKeyExpr.and(ContextKeyEqualsExpr.create('view', OUTPUT_VIEW_ID)),
group: 'navigation',
order: 3,
},
icon: { id: 'codicon/unlock' }
icon: { id: 'codicon/unlock' },
toggled: {
condition: CONTEXT_OUTPUT_SCROLL_LOCK,
icon: { id: 'codicon/lock' },
tooltip: { value: nls.localize('outputScrollOn', "Turn Auto Scrolling On"), original: 'Turn Auto Scrolling On' }
}
});
}
async run(accessor: ServicesAccessor): Promise<void> {
const outputView = accessor.get(IViewsService).getActiveViewWithId<OutputViewPane>(OUTPUT_VIEW_ID)!;
outputView.scrollLock = true;
}
});
registerAction2(class extends Action2 {
constructor() {
super({
id: `workbench.output.action.turnOnAutoScroll`,
title: nls.localize('outputScrollOn', "Turn Auto Scrolling On"),
menu: {
id: MenuId.ViewTitle,
when: ContextKeyExpr.and(ContextKeyEqualsExpr.create('view', OUTPUT_VIEW_ID), CONTEXT_OUTPUT_SCROLL_LOCK),
group: 'navigation',
order: 3,
},
icon: { id: 'codicon/lock' },
});
}
async run(accessor: ServicesAccessor): Promise<void> {
const outputView = accessor.get(IViewsService).getActiveViewWithId<OutputViewPane>(OUTPUT_VIEW_ID)!;
outputView.scrollLock = false;
outputView.scrollLock = !outputView.scrollLock;
}
});
registerAction2(class extends Action2 {

View File

@@ -116,22 +116,6 @@ export class OutputViewPane extends ViewPane {
this.editor.layout({ height, width });
}
getActions(): IAction[] {
if (!this.actions) {
this.actions = [
// this._register(this.instantiationService.createInstance(SwitchOutputAction)),
// this._register(this.instantiationService.createInstance(ClearOutputAction, ClearOutputAction.ID, ClearOutputAction.LABEL)),
// this._register(this.instantiationService.createInstance(ToggleOrSetOutputScrollLockAction, ToggleOrSetOutputScrollLockAction.ID, ToggleOrSetOutputScrollLockAction.LABEL)),
// this._register(this.instantiationService.createInstance(OpenLogOutputFile))
];
}
return [...super.getActions(), ...this.actions];
}
getSecondaryActions(): IAction[] {
return [...super.getSecondaryActions(), ...this.editor.getSecondaryActions()];
}
getActionViewItem(action: IAction): IActionViewItem | undefined {
if (action.id === 'workbench.output.action.switchBetweenOutputs') {
return this.instantiationService.createInstance(SwitchOutputActionViewItem, action);

View File

@@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { ICommandQuickPick } from 'vs/platform/quickinput/browser/commandsQuickAccess';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IMenuService, MenuId, MenuItemAction, SubmenuItemAction } from 'vs/platform/actions/common/actions';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { CancellationToken } from 'vs/base/common/cancellation';
import { timeout } from 'vs/base/common/async';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { DisposableStore, toDisposable, dispose } from 'vs/base/common/lifecycle';
import { AbstractEditorCommandsQuickAccessProvider } from 'vs/editor/contrib/quickAccess/commandsQuickAccess';
import { IEditor } from 'vs/editor/common/editorCommon';
import { Language } from 'vs/base/common/platform';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { INotificationService } from 'vs/platform/notification/common/notification';
export class CommandsQuickAccessProvider extends AbstractEditorCommandsQuickAccessProvider {
// If extensions are not yet registered, we wait for a little moment to give them
// a chance to register so that the complete set of commands shows up as result
// We do not want to delay functionality beyond that time though to keep the commands
// functional.
private readonly extensionRegistrationRace = Promise.race([
timeout(800),
this.extensionService.whenInstalledExtensionsRegistered()
]);
get activeTextEditorControl(): IEditor | undefined { return this.editorService.activeTextEditorControl; }
constructor(
@IEditorService private readonly editorService: IEditorService,
@IMenuService private readonly menuService: IMenuService,
@IExtensionService private readonly extensionService: IExtensionService,
@IEnvironmentService environmentService: IEnvironmentService,
@IInstantiationService instantiationService: IInstantiationService,
@IKeybindingService keybindingService: IKeybindingService,
@ICommandService commandService: ICommandService,
@ITelemetryService telemetryService: ITelemetryService,
@INotificationService notificationService: INotificationService
) {
super({ showAlias: !Language.isDefaultVariant() }, instantiationService, keybindingService, commandService, telemetryService, notificationService);
}
protected async getCommandPicks(disposables: DisposableStore, token: CancellationToken): Promise<Array<ICommandQuickPick>> {
// wait for extensions registration or 800ms once
await this.extensionRegistrationRace;
if (token.isCancellationRequested) {
return [];
}
return [
...this.getCodeEditorCommandPicks(),
...this.getGlobalCommandPicks(disposables)
];
}
private getGlobalCommandPicks(disposables: DisposableStore): ICommandQuickPick[] {
const globalCommandPicks: ICommandQuickPick[] = [];
const globalCommandsMenu = this.editorService.invokeWithinEditorContext(accessor =>
this.menuService.createMenu(MenuId.CommandPalette, accessor.get(IContextKeyService))
);
const globalCommandsMenuActions = globalCommandsMenu.getActions()
.reduce((r, [, actions]) => [...r, ...actions], <Array<MenuItemAction | SubmenuItemAction | string>>[])
.filter(action => action instanceof MenuItemAction) as MenuItemAction[];
for (const action of globalCommandsMenuActions) {
// Label
let label = (typeof action.item.title === 'string' ? action.item.title : action.item.title.value) || action.item.id;
// Category
const category = typeof action.item.category === 'string' ? action.item.category : action.item.category?.value;
if (category) {
label = localize('commandWithCategory', "{0}: {1}", category, label);
}
// Alias
const aliasLabel = typeof action.item.title !== 'string' ? action.item.title.original : undefined;
const aliasCategory = (category && action.item.category && typeof action.item.category !== 'string') ? action.item.category.original : undefined;
const commandAlias = (aliasLabel && category) ?
aliasCategory ? `${aliasCategory}: ${aliasLabel}` : `${category}: ${aliasLabel}` :
aliasLabel;
globalCommandPicks.push({
commandId: action.item.id,
commandAlias,
label
});
}
// Cleanup
globalCommandsMenu.dispose();
disposables.add(toDisposable(() => dispose(globalCommandsMenuActions)));
return globalCommandPicks;
}
}

View File

@@ -8,8 +8,10 @@ import { IQuickAccessRegistry, Extensions } from 'vs/platform/quickinput/common/
import { Registry } from 'vs/platform/registry/common/platform';
import { HelpQuickAccessProvider } from 'vs/platform/quickinput/browser/helpQuickAccess';
import { ViewQuickAccessProvider } from 'vs/workbench/contrib/quickaccess/browser/viewQuickAccess';
import { QUICK_ACCESS_COMMAND_ID } from 'vs/workbench/contrib/quickaccess/browser/quickAccessCommands';
import { QUICK_ACCESS_COMMAND_ID, quickAccessCommand } from 'vs/workbench/contrib/quickaccess/browser/quickAccessCommands';
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { CommandsQuickAccessProvider } from 'vs/workbench/contrib/quickaccess/browser/commandsQuickAccess';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
const registry = Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess);
@@ -34,6 +36,13 @@ registry.registerQuickAccessProvider({
helpEntries: [{ description: localize('viewQuickAccess', "Open View"), needsEditor: false }]
});
registry.registerQuickAccessProvider({
ctor: CommandsQuickAccessProvider,
prefix: CommandsQuickAccessProvider.PREFIX,
placeholder: localize('commandsQuickAccessPlaceholder', "Type the name of a command to run."),
helpEntries: [{ description: localize('commandsQuickAccess', "Show and Run Commands"), needsEditor: false }]
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: QUICK_ACCESS_COMMAND_ID, title: {
@@ -42,3 +51,10 @@ MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
category: localize('quickAccess', "Quick Access")
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: QUICK_ACCESS_COMMAND_ID,
weight: KeybindingWeight.WorkbenchContrib,
when: undefined,
handler: quickAccessCommand.handler
});

View File

@@ -4,12 +4,12 @@
*--------------------------------------------------------------------------------------------*/
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { ICommand } from 'vs/platform/commands/common/commands';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
export const QUICK_ACCESS_COMMAND_ID = 'workbench.action.openQuickAccess';
CommandsRegistry.registerCommand({
export const quickAccessCommand: ICommand = {
id: QUICK_ACCESS_COMMAND_ID,
handler: async function (accessor: ServicesAccessor, prefix: string | null = null) {
const quickInputService = accessor.get(IQuickInputService);
@@ -25,4 +25,4 @@ CommandsRegistry.registerCommand({
}
}]
}
});
};

View File

@@ -213,7 +213,7 @@ class CommandPaletteEditorAction extends EditorAction {
super({
id: ShowAllCommandsAction.ID,
label: localize('showCommands.label', "Command Palette..."),
alias: 'Command Palette',
alias: 'Command Palette...',
precondition: EditorContextKeys.editorSimpleInput.toNegated(),
contextMenuOpts: {
group: 'z_commands',

View File

@@ -153,6 +153,10 @@
background-repeat: no-repeat;
}
.scm-viewlet .monaco-list-row .resource > .name > .monaco-icon-label > .actions .action-label.codicon {
height: 22px;
}
.scm-viewlet .scm-editor {
box-sizing: border-box;
padding: 5px 12px 5px 16px;

View File

@@ -207,7 +207,7 @@ registry.registerWorkbenchAction(
registry.registerWorkbenchAction(SyncActionDescriptor.create(RerunSearchEditorSearchAction, RerunSearchEditorSearchAction.ID, RerunSearchEditorSearchAction.LABEL,
{ mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_R } }, ContextKeyExpr.and(SearchEditorConstants.InSearchEditor)),
'Search Editor: Rerun', category);
'Search Editor: Search Again', category);
//#endregion

View File

@@ -12,6 +12,7 @@ import { ITaskService } from 'vs/workbench/contrib/tasks/common/taskService';
import { CustomTask, ContributedTask } from 'vs/workbench/contrib/tasks/common/tasks';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IStringDictionary } from 'vs/base/common/collections';
import { DisposableStore } from 'vs/base/common/lifecycle';
export class TasksQuickAccessProvider extends PickerQuickAccessProvider<IPickerQuickAccessItem> {
@@ -28,7 +29,7 @@ export class TasksQuickAccessProvider extends PickerQuickAccessProvider<IPickerQ
this.activationPromise = extensionService.activateByEvent('onCommand:workbench.action.tasks.runTask');
}
protected async getPicks(filter: string, token: CancellationToken): Promise<Array<IPickerQuickAccessItem | IQuickPickSeparator>> {
protected async getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Promise<Array<IPickerQuickAccessItem | IQuickPickSeparator>> {
// always await extensions
await this.activationPromise;

View File

@@ -30,7 +30,7 @@ export class UserDataSyncViewContribution implements IWorkbenchContribution {
@IUserDataSyncBackupStoreService private readonly userDataSyncBackupStoreService: IUserDataSyncBackupStoreService,
) {
const container = this.registerSyncViewContainer();
// Disable remote backup view until server is upgraded.
// Disable until server returns the correct timestamp
// this.registerBackupView(container, true);
this.registerBackupView(container, false);
}