mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Revert "Revert "Merge from vscode ada4bddb8edc69eea6ebaaa0e88c5f903cbd43d8 (#5529)" (#5553)" (#5562)
This reverts commit c9a4f8f664.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import { addClasses, createCSSRule, removeClasses } from 'vs/base/browser/dom';
|
||||
import { domEvent } from 'vs/base/browser/event';
|
||||
import { ActionItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { ActionViewItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { IdGenerator } from 'vs/base/common/idGenerator';
|
||||
@@ -114,16 +114,16 @@ export function fillInActions(groups: [string, Array<MenuItemAction | SubmenuIte
|
||||
}
|
||||
|
||||
|
||||
export function createActionItem(action: IAction, keybindingService: IKeybindingService, notificationService: INotificationService, contextMenuService: IContextMenuService): ActionItem | undefined {
|
||||
export function createActionViewItem(action: IAction, keybindingService: IKeybindingService, notificationService: INotificationService, contextMenuService: IContextMenuService): ActionViewItem | undefined {
|
||||
if (action instanceof MenuItemAction) {
|
||||
return new MenuItemActionItem(action, keybindingService, notificationService, contextMenuService);
|
||||
return new MenuEntryActionViewItem(action, keybindingService, notificationService, contextMenuService);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const ids = new IdGenerator('menu-item-action-item-icon-');
|
||||
|
||||
export class MenuItemActionItem extends ActionItem {
|
||||
export class MenuEntryActionViewItem extends ActionViewItem {
|
||||
|
||||
static readonly ICON_PATH_TO_CSS_RULES: Map<string /* path*/, string /* CSS rule */> = new Map<string, string>();
|
||||
|
||||
@@ -231,13 +231,13 @@ export class MenuItemActionItem extends ActionItem {
|
||||
|
||||
const iconPathMapKey = item.iconLocation.dark.toString();
|
||||
|
||||
if (MenuItemActionItem.ICON_PATH_TO_CSS_RULES.has(iconPathMapKey)) {
|
||||
iconClass = MenuItemActionItem.ICON_PATH_TO_CSS_RULES.get(iconPathMapKey)!;
|
||||
if (MenuEntryActionViewItem.ICON_PATH_TO_CSS_RULES.has(iconPathMapKey)) {
|
||||
iconClass = MenuEntryActionViewItem.ICON_PATH_TO_CSS_RULES.get(iconPathMapKey)!;
|
||||
} else {
|
||||
iconClass = ids.nextId();
|
||||
createCSSRule(`.icon.${iconClass}`, `background-image: url("${(item.iconLocation.light || item.iconLocation.dark).toString()}")`);
|
||||
createCSSRule(`.vs-dark .icon.${iconClass}, .hc-black .icon.${iconClass}`, `background-image: url("${item.iconLocation.dark.toString()}")`);
|
||||
MenuItemActionItem.ICON_PATH_TO_CSS_RULES.set(iconPathMapKey, iconClass);
|
||||
MenuEntryActionViewItem.ICON_PATH_TO_CSS_RULES.set(iconPathMapKey, iconClass);
|
||||
}
|
||||
|
||||
addClasses(this.label, 'icon', iconClass);
|
||||
@@ -255,10 +255,10 @@ export class MenuItemActionItem extends ActionItem {
|
||||
}
|
||||
}
|
||||
|
||||
// Need to subclass MenuItemActionItem in order to respect
|
||||
// Need to subclass MenuEntryActionViewItem in order to respect
|
||||
// the action context coming from any action bar, without breaking
|
||||
// existing users
|
||||
export class ContextAwareMenuItemActionItem extends MenuItemActionItem {
|
||||
export class ContextAwareMenuEntryActionViewItem extends MenuEntryActionViewItem {
|
||||
|
||||
onClick(event: MouseEvent): void {
|
||||
event.preventDefault();
|
||||
@@ -273,7 +273,7 @@ export class ContextAwareMenuItemActionItem extends MenuItemActionItem {
|
||||
// Always show label for action items, instead of whether they don't have
|
||||
// an icon/CSS class. Useful for some toolbar scenarios in particular with
|
||||
// contributed actions from other extensions
|
||||
export class LabeledMenuItemActionItem extends MenuItemActionItem {
|
||||
export class LabeledMenuItemActionItem extends MenuEntryActionViewItem {
|
||||
private _labeledItemClassDispose: IDisposable;
|
||||
|
||||
constructor(
|
||||
@@ -301,13 +301,13 @@ export class LabeledMenuItemActionItem extends MenuItemActionItem {
|
||||
|
||||
const iconPathMapKey = item.iconLocation.dark.toString();
|
||||
|
||||
if (MenuItemActionItem.ICON_PATH_TO_CSS_RULES.has(iconPathMapKey)) {
|
||||
iconClass = MenuItemActionItem.ICON_PATH_TO_CSS_RULES.get(iconPathMapKey);
|
||||
if (MenuEntryActionViewItem.ICON_PATH_TO_CSS_RULES.has(iconPathMapKey)) {
|
||||
iconClass = MenuEntryActionViewItem.ICON_PATH_TO_CSS_RULES.get(iconPathMapKey);
|
||||
} else {
|
||||
iconClass = ids.nextId();
|
||||
createCSSRule(`.icon.${iconClass}`, `background-image: url("${(item.iconLocation.light || item.iconLocation.dark).toString()}")`);
|
||||
createCSSRule(`.vs-dark .icon.${iconClass}, .hc-black .icon.${iconClass}`, `background-image: url("${item.iconLocation.dark.toString()}")`);
|
||||
MenuItemActionItem.ICON_PATH_TO_CSS_RULES.set(iconPathMapKey, iconClass);
|
||||
MenuEntryActionViewItem.ICON_PATH_TO_CSS_RULES.set(iconPathMapKey, iconClass);
|
||||
}
|
||||
|
||||
addClasses(this.label, 'icon', iconClass, this._defaultCSSClassToAdd);
|
||||
@@ -18,21 +18,18 @@ export interface ILocalizedString {
|
||||
original: string;
|
||||
}
|
||||
|
||||
export interface IBaseCommandAction {
|
||||
export interface ICommandAction {
|
||||
id: string;
|
||||
title: string | ILocalizedString;
|
||||
category?: string | ILocalizedString;
|
||||
}
|
||||
|
||||
export interface ICommandAction extends IBaseCommandAction {
|
||||
iconLocation?: { dark: URI; light?: URI; };
|
||||
precondition?: ContextKeyExpr;
|
||||
toggled?: ContextKeyExpr;
|
||||
}
|
||||
|
||||
export interface ISerializableCommandAction extends IBaseCommandAction {
|
||||
iconLocation?: { dark: UriComponents; light?: UriComponents; };
|
||||
}
|
||||
type Serialized<T> = { [K in keyof T]: T[K] extends URI ? UriComponents : Serialized<T[K]> };
|
||||
|
||||
export type ISerializableCommandAction = Serialized<ICommandAction>;
|
||||
|
||||
export interface IMenuItem {
|
||||
command: ICommandAction;
|
||||
|
||||
@@ -73,7 +73,7 @@ export class ContextMenuHandler {
|
||||
actionRunner.onDidBeforeRun(this.onActionRun, this, menuDisposables);
|
||||
actionRunner.onDidRun(this.onDidActionRun, this, menuDisposables);
|
||||
menu = new Menu(container, actions, {
|
||||
actionItemProvider: delegate.getActionItem,
|
||||
actionViewItemProvider: delegate.getActionViewItem,
|
||||
context: delegate.getActionsContext ? delegate.getActionsContext() : null,
|
||||
actionRunner,
|
||||
getKeyBinding: delegate.getKeyBinding ? delegate.getKeyBinding : action => this.keybindingService.lookupKeybinding(action.id)
|
||||
|
||||
@@ -186,8 +186,8 @@ class WindowDriver implements IWindowDriver {
|
||||
|
||||
const lines: string[] = [];
|
||||
|
||||
for (let i = 0; i < xterm._core.buffer.lines.length; i++) {
|
||||
lines.push(xterm._core.buffer.translateBufferLineToString(i, true));
|
||||
for (let i = 0; i < xterm.buffer.length; i++) {
|
||||
lines.push(xterm.buffer.getLine(i)!.translateToString(true));
|
||||
}
|
||||
|
||||
return lines;
|
||||
|
||||
@@ -63,7 +63,7 @@ export interface IBaseResourceInput {
|
||||
export interface IResourceInput extends IBaseResourceInput {
|
||||
|
||||
/**
|
||||
* The resource URL of the resource to open.
|
||||
* The resource URI of the resource to open.
|
||||
*/
|
||||
resource: URI;
|
||||
|
||||
@@ -71,6 +71,12 @@ export interface IResourceInput extends IBaseResourceInput {
|
||||
* The encoding of the text input if known.
|
||||
*/
|
||||
readonly encoding?: string;
|
||||
|
||||
/**
|
||||
* The identifier of the language mode of the text input
|
||||
* if known to use when displaying the contents.
|
||||
*/
|
||||
readonly mode?: string;
|
||||
}
|
||||
|
||||
export interface IEditorOptions {
|
||||
|
||||
@@ -69,7 +69,6 @@ export interface ParsedArgs {
|
||||
'driver'?: string;
|
||||
'driver-verbose'?: boolean;
|
||||
remote?: string;
|
||||
'nodeless'?: boolean; // TODO@ben revisit electron5 nodeless support
|
||||
// {{SQL CARBON EDIT}}
|
||||
aad?: boolean;
|
||||
database?: string;
|
||||
|
||||
@@ -95,8 +95,6 @@ export const options: Option[] = [
|
||||
{ id: 'trace-category-filter', type: 'string' },
|
||||
{ id: 'trace-options', type: 'string' },
|
||||
{ id: 'prof-code-loading', type: 'boolean' },
|
||||
{ id: 'nodeless', type: 'boolean' }, // TODO@ben revisit electron5 nodeless support
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
{ id: 'database', type: 'string', alias: 'D' },
|
||||
{ id: 'server', type: 'string', alias: 'S' },
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// See https://github.com/Microsoft/vscode/issues/30180
|
||||
const WIN32_MAX_FILE_SIZE = 300 * 1024 * 1024; // 300 MB
|
||||
const GENERAL_MAX_FILE_SIZE = 16 * 1024 * 1024 * 1024; // 16 GB
|
||||
|
||||
// See https://github.com/v8/v8/blob/5918a23a3d571b9625e5cce246bdd5b46ff7cd8b/src/heap/heap.cc#L149
|
||||
const WIN32_MAX_HEAP_SIZE = 700 * 1024 * 1024; // 700 MB
|
||||
const GENERAL_MAX_HEAP_SIZE = 700 * 2 * 1024 * 1024; // 1400 MB
|
||||
|
||||
export const MAX_FILE_SIZE = process.arch === 'ia32' ? WIN32_MAX_FILE_SIZE : GENERAL_MAX_FILE_SIZE;
|
||||
export const MAX_HEAP_SIZE = process.arch === 'ia32' ? WIN32_MAX_HEAP_SIZE : GENERAL_MAX_HEAP_SIZE;
|
||||
@@ -299,11 +299,11 @@ export class HistoryMainService implements IHistoryMainService {
|
||||
description = nls.localize('folderDesc', "{0} {1}", getBaseLabel(workspace), getPathLabel(dirname(workspace), this.environmentService));
|
||||
args = `--folder-uri "${workspace.toString()}"`;
|
||||
} else {
|
||||
description = nls.localize('codeWorkspace', "Code Workspace");
|
||||
description = nls.localize('workspaceDesc', "{0} {1}", getBaseLabel(workspace.configPath), getPathLabel(dirname(workspace.configPath), this.environmentService));
|
||||
args = `--file-uri "${workspace.configPath.toString()}"`;
|
||||
}
|
||||
|
||||
return <Electron.JumpListItem>{
|
||||
return {
|
||||
type: 'task',
|
||||
title,
|
||||
description,
|
||||
|
||||
@@ -125,7 +125,7 @@ function storeServiceDependency(id: Function, target: Function, index: number, o
|
||||
/**
|
||||
* A *only* valid way to create a {{ServiceIdentifier}}.
|
||||
*/
|
||||
export function createDecorator<T>(serviceId: string): { (...args: any[]): void; type: T; } {
|
||||
export function createDecorator<T>(serviceId: string): ServiceIdentifier<T> {
|
||||
|
||||
if (_util.serviceIds.has(serviceId)) {
|
||||
return _util.serviceIds.get(serviceId)!;
|
||||
|
||||
@@ -221,7 +221,7 @@ export class InstantiationService implements IInstantiationService {
|
||||
// Return a proxy object that's backed by an idle value. That
|
||||
// strategy is to instantiate services in our idle time or when actually
|
||||
// needed but not when injected into a consumer
|
||||
const idle = new IdleValue(() => this._createInstance(ctor, args, _trace));
|
||||
const idle = new IdleValue(() => this._createInstance<T>(ctor, args, _trace));
|
||||
return <T>new Proxy(Object.create(null), {
|
||||
get(_target: T, prop: PropertyKey): any {
|
||||
return idle.getValue()[prop];
|
||||
|
||||
@@ -17,7 +17,6 @@ import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKe
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
|
||||
interface CurrentChord {
|
||||
keypress: string;
|
||||
@@ -96,11 +95,11 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
|
||||
}
|
||||
|
||||
public lookupKeybinding(commandId: string): ResolvedKeybinding | undefined {
|
||||
let result = this._getResolver().lookupPrimaryKeybinding(commandId);
|
||||
const result = this._getResolver().lookupPrimaryKeybinding(commandId);
|
||||
if (!result) {
|
||||
return undefined;
|
||||
}
|
||||
return withNullAsUndefined(result.resolvedKeybinding);
|
||||
return result.resolvedKeybinding;
|
||||
}
|
||||
|
||||
public dispatchEvent(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
export class ResolvedKeybindingItem {
|
||||
_resolvedKeybindingItemBrand: void;
|
||||
|
||||
public readonly resolvedKeybinding: ResolvedKeybinding | null;
|
||||
public readonly resolvedKeybinding: ResolvedKeybinding | undefined;
|
||||
public readonly keypressParts: string[];
|
||||
public readonly bubble: boolean;
|
||||
public readonly command: string | null;
|
||||
@@ -18,7 +18,7 @@ export class ResolvedKeybindingItem {
|
||||
public readonly when: ContextKeyExpr | undefined;
|
||||
public readonly isDefault: boolean;
|
||||
|
||||
constructor(resolvedKeybinding: ResolvedKeybinding | null, command: string | null, commandArgs: any, when: ContextKeyExpr | undefined, isDefault: boolean) {
|
||||
constructor(resolvedKeybinding: ResolvedKeybinding | undefined, command: string | null, commandArgs: any, when: ContextKeyExpr | undefined, isDefault: boolean) {
|
||||
this.resolvedKeybinding = resolvedKeybinding;
|
||||
this.keypressParts = resolvedKeybinding ? removeElementsAfterNulls(resolvedKeybinding.getDispatchParts()) : [];
|
||||
this.bubble = (command ? command.charCodeAt(0) === CharCode.Caret : false);
|
||||
|
||||
@@ -180,7 +180,7 @@ suite('AbstractKeybindingService', () => {
|
||||
});
|
||||
|
||||
function kbItem(keybinding: number, command: string, when?: ContextKeyExpr): ResolvedKeybindingItem {
|
||||
const resolvedKeybinding = (keybinding !== 0 ? new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS)!, OS) : null);
|
||||
const resolvedKeybinding = (keybinding !== 0 ? new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS)!, OS) : undefined);
|
||||
return new ResolvedKeybindingItem(
|
||||
resolvedKeybinding,
|
||||
command,
|
||||
|
||||
@@ -21,7 +21,7 @@ function createContext(ctx: any) {
|
||||
suite('KeybindingResolver', () => {
|
||||
|
||||
function kbItem(keybinding: number, command: string, commandArgs: any, when: ContextKeyExpr, isDefault: boolean): ResolvedKeybindingItem {
|
||||
const resolvedKeybinding = (keybinding !== 0 ? new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS)!, OS) : null);
|
||||
const resolvedKeybinding = (keybinding !== 0 ? new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS)!, OS) : undefined);
|
||||
return new ResolvedKeybindingItem(
|
||||
resolvedKeybinding,
|
||||
command,
|
||||
|
||||
@@ -266,7 +266,7 @@ export class WorkbenchList<T> extends List<T> {
|
||||
...computeStyles(themeService.getTheme(), defaultListStyles),
|
||||
...workbenchListOptions,
|
||||
horizontalScrolling
|
||||
} as IListOptions<T>
|
||||
}
|
||||
);
|
||||
|
||||
this.disposables.push(workbenchListOptionsDisposable);
|
||||
@@ -348,7 +348,7 @@ export class WorkbenchPagedList<T> extends PagedList<T> {
|
||||
...computeStyles(themeService.getTheme(), defaultListStyles),
|
||||
...workbenchListOptions,
|
||||
horizontalScrolling
|
||||
} as IListOptions<T>
|
||||
}
|
||||
);
|
||||
|
||||
this.disposables = [workbenchListOptionsDisposable];
|
||||
@@ -689,7 +689,7 @@ export class TreeResourceNavigator2<T, TFilterData> extends Disposable {
|
||||
super();
|
||||
|
||||
this.options = {
|
||||
...<IResourceResultsNavigationOptions2>{
|
||||
...{
|
||||
openOnSelection: true
|
||||
},
|
||||
...(options || {})
|
||||
|
||||
@@ -54,4 +54,4 @@ class RegistryImpl implements IRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
export const Registry = <IRegistry>new RegistryImpl();
|
||||
export const Registry: IRegistry = new RegistryImpl();
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle'
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { FileChangeType, FileDeleteOptions, FileOverwriteOptions, FileSystemProviderCapabilities, FileType, FileWriteOptions, IFileChange, IFileSystemProvider, IStat, IWatchOptions } from 'vs/platform/files/common/files';
|
||||
import { FileChangeType, FileDeleteOptions, FileOverwriteOptions, FileSystemProviderCapabilities, FileType, IFileChange, IFileSystemProvider, IStat, IWatchOptions, FileOpenOptions } from 'vs/platform/files/common/files';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { IRemoteAgentEnvironment } from 'vs/platform/remote/common/remoteAgentEnvironment';
|
||||
import { OperatingSystem } from 'vs/base/common/platform';
|
||||
@@ -50,7 +50,7 @@ export class RemoteExtensionsFileSystemProvider extends Disposable implements IF
|
||||
|
||||
setCaseSensitive(isCaseSensitive: boolean) {
|
||||
let capabilities = (
|
||||
FileSystemProviderCapabilities.FileReadWrite
|
||||
FileSystemProviderCapabilities.FileOpenReadWriteClose
|
||||
| FileSystemProviderCapabilities.FileFolderCopy
|
||||
);
|
||||
|
||||
@@ -68,14 +68,28 @@ export class RemoteExtensionsFileSystemProvider extends Disposable implements IF
|
||||
return this.channel.call('stat', [resource]);
|
||||
}
|
||||
|
||||
async readFile(resource: URI): Promise<Uint8Array> {
|
||||
const buff = <VSBuffer>await this.channel.call('readFile', [resource]);
|
||||
|
||||
return buff.buffer;
|
||||
open(resource: URI, opts: FileOpenOptions): Promise<number> {
|
||||
return this.channel.call('open', [resource, opts]);
|
||||
}
|
||||
|
||||
writeFile(resource: URI, content: Uint8Array, opts: FileWriteOptions): Promise<void> {
|
||||
return this.channel.call('writeFile', [resource, VSBuffer.wrap(content), opts]);
|
||||
close(fd: number): Promise<void> {
|
||||
return this.channel.call('close', [fd]);
|
||||
}
|
||||
|
||||
async read(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number> {
|
||||
const [bytes, bytesRead]: [VSBuffer, number] = await this.channel.call('read', [fd, pos, length]);
|
||||
|
||||
// copy back the data that was written into the buffer on the remote
|
||||
// side. we need to do this because buffers are not referenced by
|
||||
// pointer, but only by value and as such cannot be directly written
|
||||
// to from the other process.
|
||||
data.set(bytes.buffer.slice(0, bytesRead), offset);
|
||||
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
write(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number> {
|
||||
return this.channel.call('write', [fd, pos, VSBuffer.wrap(data), offset, length]);
|
||||
}
|
||||
|
||||
delete(resource: URI, opts: FileDeleteOptions): Promise<void> {
|
||||
|
||||
@@ -27,7 +27,8 @@ export class RemoteAuthorityResolverError extends Error {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
return this.isTemporarilyNotAvailable(err);
|
||||
}
|
||||
|
||||
public static isTemporarilyNotAvailable(err: any): boolean {
|
||||
|
||||
@@ -40,8 +40,10 @@ export class RemoteAuthorityResolverService implements IRemoteAuthorityResolverS
|
||||
}
|
||||
|
||||
clearResolvedAuthority(authority: string): void {
|
||||
this._resolveAuthorityRequests[authority].reject(errors.canceled());
|
||||
delete this._resolveAuthorityRequests[authority];
|
||||
if (this._resolveAuthorityRequests[authority]) {
|
||||
this._resolveAuthorityRequests[authority].reject(errors.canceled());
|
||||
delete this._resolveAuthorityRequests[authority];
|
||||
}
|
||||
}
|
||||
|
||||
setResolvedAuthority(resolvedAuthority: ResolvedAuthority) {
|
||||
|
||||
Reference in New Issue
Block a user