mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
This reverts commit d15a3fcc98.
This commit is contained in:
@@ -6,23 +6,24 @@
|
||||
import 'vs/css!./iPadShowKeyboard';
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition, OverlayWidgetPositionPreference } from 'vs/editor/browser/editorBrowser';
|
||||
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
|
||||
import { IEditorContribution } from 'vs/editor/common/editorCommon';
|
||||
|
||||
export class IPadShowKeyboard extends Disposable implements IEditorContribution {
|
||||
export class IPadShowKeyboard implements IEditorContribution {
|
||||
|
||||
private static readonly ID = 'editor.contrib.iPadShowKeyboard';
|
||||
|
||||
private readonly editor: ICodeEditor;
|
||||
private widget: ShowKeyboardWidget | null;
|
||||
private toDispose: IDisposable[];
|
||||
|
||||
constructor(editor: ICodeEditor) {
|
||||
super();
|
||||
this.editor = editor;
|
||||
this.toDispose = [];
|
||||
if (browser.isIPad) {
|
||||
this._register(editor.onDidChangeConfiguration(() => this.update()));
|
||||
this.toDispose.push(editor.onDidChangeConfiguration(() => this.update()));
|
||||
this.update();
|
||||
}
|
||||
}
|
||||
@@ -47,7 +48,7 @@ export class IPadShowKeyboard extends Disposable implements IEditorContribution
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
super.dispose();
|
||||
this.toDispose = dispose(this.toDispose);
|
||||
if (this.widget) {
|
||||
this.widget.dispose();
|
||||
this.widget = null;
|
||||
@@ -55,24 +56,25 @@ export class IPadShowKeyboard extends Disposable implements IEditorContribution
|
||||
}
|
||||
}
|
||||
|
||||
class ShowKeyboardWidget extends Disposable implements IOverlayWidget {
|
||||
class ShowKeyboardWidget implements IOverlayWidget {
|
||||
|
||||
private static readonly ID = 'editor.contrib.ShowKeyboardWidget';
|
||||
|
||||
private readonly editor: ICodeEditor;
|
||||
|
||||
private readonly _domNode: HTMLElement;
|
||||
private _toDispose: IDisposable[];
|
||||
|
||||
constructor(editor: ICodeEditor) {
|
||||
super();
|
||||
this.editor = editor;
|
||||
this._domNode = document.createElement('textarea');
|
||||
this._domNode.className = 'iPadShowKeyboard';
|
||||
|
||||
this._register(dom.addDisposableListener(this._domNode, 'touchstart', (e) => {
|
||||
this._toDispose = [];
|
||||
this._toDispose.push(dom.addDisposableListener(this._domNode, 'touchstart', (e) => {
|
||||
this.editor.focus();
|
||||
}));
|
||||
this._register(dom.addDisposableListener(this._domNode, 'focus', (e) => {
|
||||
this._toDispose.push(dom.addDisposableListener(this._domNode, 'focus', (e) => {
|
||||
this.editor.focus();
|
||||
}));
|
||||
|
||||
@@ -81,7 +83,7 @@ class ShowKeyboardWidget extends Disposable implements IOverlayWidget {
|
||||
|
||||
public dispose(): void {
|
||||
this.editor.removeOverlayWidget(this);
|
||||
super.dispose();
|
||||
this._toDispose = dispose(this._toDispose);
|
||||
}
|
||||
|
||||
// ----- IOverlayWidget API
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as dom from 'vs/base/browser/dom';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { Keybinding, ResolvedKeybinding, SimpleKeybinding, createKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { IDisposable, IReference, ImmortalReference, toDisposable, DisposableStore, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, IReference, ImmortalReference, combinedDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { OS, isLinux, isMacintosh } from 'vs/base/common/platform';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
@@ -25,7 +25,7 @@ import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IResolvedTextEditorModel, ITextModelContentProvider, ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { ITextResourceConfigurationService, ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { CommandsRegistry, ICommand, ICommandEvent, ICommandHandler, ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IConfigurationChangeEvent, IConfigurationData, IConfigurationOverrides, IConfigurationService, IConfigurationModel } from 'vs/platform/configuration/common/configuration';
|
||||
import { IConfigurationChangeEvent, IConfigurationData, IConfigurationOverrides, IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { Configuration, ConfigurationModel, DefaultConfigurationModel } from 'vs/platform/configuration/common/configurationModels';
|
||||
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IConfirmation, IConfirmationResult, IDialogOptions, IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
@@ -37,8 +37,8 @@ import { IKeybindingItem, KeybindingsRegistry } from 'vs/platform/keybinding/com
|
||||
import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem';
|
||||
import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayoutResolvedKeybinding';
|
||||
import { ILabelService, ResourceLabelFormatter } from 'vs/platform/label/common/label';
|
||||
import { INotification, INotificationHandle, INotificationService, IPromptChoice, IPromptOptions, NoOpNotification, IStatusMessageOptions } from 'vs/platform/notification/common/notification';
|
||||
import { IProgressRunner, ILocalProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { INotification, INotificationHandle, INotificationService, IPromptChoice, IPromptOptions, NoOpNotification } from 'vs/platform/notification/common/notification';
|
||||
import { IProgressRunner, IProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { ITelemetryInfo, ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWorkspace, IWorkspaceContextService, IWorkspaceFolder, IWorkspaceFoldersChangeEvent, WorkbenchState, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
@@ -136,7 +136,7 @@ export class SimpleEditorModelResolverService implements ITextModelService {
|
||||
}
|
||||
}
|
||||
|
||||
export class SimpleLocalProgressService implements ILocalProgressService {
|
||||
export class SimpleProgressService implements IProgressService {
|
||||
_serviceBrand: any;
|
||||
|
||||
private static NULL_PROGRESS_RUNNER: IProgressRunner = {
|
||||
@@ -148,7 +148,7 @@ export class SimpleLocalProgressService implements ILocalProgressService {
|
||||
show(infinite: true, delay?: number): IProgressRunner;
|
||||
show(total: number, delay?: number): IProgressRunner;
|
||||
show(): IProgressRunner {
|
||||
return SimpleLocalProgressService.NULL_PROGRESS_RUNNER;
|
||||
return SimpleProgressService.NULL_PROGRESS_RUNNER;
|
||||
}
|
||||
|
||||
showWhile(promise: Promise<any>, delay?: number): Promise<void> {
|
||||
@@ -220,10 +220,6 @@ export class SimpleNotificationService implements INotificationService {
|
||||
public prompt(severity: Severity, message: string, choices: IPromptChoice[], options?: IPromptOptions): INotificationHandle {
|
||||
return SimpleNotificationService.NO_OP;
|
||||
}
|
||||
|
||||
public status(message: string | Error, options?: IStatusMessageOptions): IDisposable {
|
||||
return Disposable.None;
|
||||
}
|
||||
}
|
||||
|
||||
export class StandaloneCommandService implements ICommandService {
|
||||
@@ -295,7 +291,7 @@ export class StandaloneKeybindingService extends AbstractKeybindingService {
|
||||
throw new Error(`Invalid keybinding`);
|
||||
}
|
||||
|
||||
const toDispose = new DisposableStore();
|
||||
let toDispose: IDisposable[] = [];
|
||||
|
||||
this._dynamicKeybindings.push({
|
||||
keybinding: keybinding,
|
||||
@@ -305,7 +301,7 @@ export class StandaloneKeybindingService extends AbstractKeybindingService {
|
||||
weight2: 0
|
||||
});
|
||||
|
||||
toDispose.add(toDisposable(() => {
|
||||
toDispose.push(toDisposable(() => {
|
||||
for (let i = 0; i < this._dynamicKeybindings.length; i++) {
|
||||
let kb = this._dynamicKeybindings[i];
|
||||
if (kb.command === commandId) {
|
||||
@@ -318,7 +314,7 @@ export class StandaloneKeybindingService extends AbstractKeybindingService {
|
||||
|
||||
let commandService = this._commandService;
|
||||
if (commandService instanceof StandaloneCommandService) {
|
||||
toDispose.add(commandService.addCommand({
|
||||
toDispose.push(commandService.addCommand({
|
||||
id: commandId,
|
||||
handler: handler
|
||||
}));
|
||||
@@ -327,7 +323,7 @@ export class StandaloneKeybindingService extends AbstractKeybindingService {
|
||||
}
|
||||
this.updateResolver({ source: KeybindingSource.Default });
|
||||
|
||||
return toDispose;
|
||||
return combinedDisposable(toDispose);
|
||||
}
|
||||
|
||||
private updateResolver(event: IKeybindingEvent): void {
|
||||
@@ -450,17 +446,7 @@ export class SimpleConfigurationService implements IConfigurationService {
|
||||
}
|
||||
|
||||
public getConfigurationData(): IConfigurationData | null {
|
||||
const emptyModel: IConfigurationModel = {
|
||||
contents: {},
|
||||
keys: [],
|
||||
overrides: []
|
||||
};
|
||||
return {
|
||||
defaults: emptyModel,
|
||||
user: emptyModel,
|
||||
workspace: emptyModel,
|
||||
folders: {}
|
||||
};
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
import * as aria from 'vs/base/browser/ui/aria/aria';
|
||||
import { Disposable, IDisposable, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { Disposable, IDisposable, combinedDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
|
||||
@@ -227,13 +227,13 @@ export class StandaloneCodeEditor extends CodeEditorWidget implements IStandalon
|
||||
};
|
||||
|
||||
|
||||
const toDispose = new DisposableStore();
|
||||
let toDispose: IDisposable[] = [];
|
||||
|
||||
// Generate a unique id to allow the same descriptor.id across multiple editor instances
|
||||
const uniqueId = this.getId() + ':' + id;
|
||||
|
||||
// Register the command
|
||||
toDispose.add(CommandsRegistry.registerCommand(uniqueId, run));
|
||||
toDispose.push(CommandsRegistry.registerCommand(uniqueId, run));
|
||||
|
||||
// Register the context menu item
|
||||
if (contextMenuGroupId) {
|
||||
@@ -246,14 +246,16 @@ export class StandaloneCodeEditor extends CodeEditorWidget implements IStandalon
|
||||
group: contextMenuGroupId,
|
||||
order: contextMenuOrder
|
||||
};
|
||||
toDispose.add(MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem));
|
||||
toDispose.push(MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem));
|
||||
}
|
||||
|
||||
// Register the keybindings
|
||||
if (Array.isArray(keybindings)) {
|
||||
for (const kb of keybindings) {
|
||||
toDispose.add(this._standaloneKeybindingService.addDynamicKeybinding(uniqueId, kb, run, keybindingsWhen));
|
||||
}
|
||||
toDispose = toDispose.concat(
|
||||
keybindings.map((kb) => {
|
||||
return this._standaloneKeybindingService.addDynamicKeybinding(uniqueId, kb, run, keybindingsWhen);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// Finally, register an internal editor action
|
||||
@@ -268,11 +270,11 @@ export class StandaloneCodeEditor extends CodeEditorWidget implements IStandalon
|
||||
|
||||
// Store it under the original id, such that trigger with the original id will work
|
||||
this._actions[id] = internalAction;
|
||||
toDispose.add(toDisposable(() => {
|
||||
toDispose.push(toDisposable(() => {
|
||||
delete this._actions[id];
|
||||
}));
|
||||
|
||||
return toDispose;
|
||||
return combinedDisposable(toDispose);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ export interface IEncodedLineTokens {
|
||||
* - f = foreground ColorId (9 bits)
|
||||
* - b = background ColorId (9 bits)
|
||||
* - The color value for each colorId is defined in IStandaloneThemeData.customTokenColors:
|
||||
* e.g. colorId = 1 is stored in IStandaloneThemeData.customTokenColors[1]. Color id = 0 means no color,
|
||||
* e.g colorId = 1 is stored in IStandaloneThemeData.customTokenColors[1]. Color id = 0 means no color,
|
||||
* id = 1 is for the default foreground color, id = 2 for the default background.
|
||||
*/
|
||||
tokens: Uint32Array;
|
||||
@@ -427,7 +427,7 @@ export function registerCodeLensProvider(languageId: string, provider: modes.Cod
|
||||
*/
|
||||
export function registerCodeActionProvider(languageId: string, provider: CodeActionProvider): IDisposable {
|
||||
return modes.CodeActionProviderRegistry.register(languageId, {
|
||||
provideCodeActions: (model: model.ITextModel, range: Range, context: modes.CodeActionContext, token: CancellationToken): modes.CodeActionList | Promise<modes.CodeActionList> => {
|
||||
provideCodeActions: (model: model.ITextModel, range: Range, context: modes.CodeActionContext, token: CancellationToken): (modes.Command | modes.CodeAction)[] | Promise<(modes.Command | modes.CodeAction)[]> => {
|
||||
let markers = StaticServices.markerService.get().read({ resource: model.uri }).filter(m => {
|
||||
return Range.areIntersectingOrTouching(m, range);
|
||||
});
|
||||
@@ -510,7 +510,7 @@ export interface CodeActionProvider {
|
||||
/**
|
||||
* Provide commands for the given document and range.
|
||||
*/
|
||||
provideCodeActions(model: model.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): modes.CodeActionList | Promise<modes.CodeActionList>;
|
||||
provideCodeActions(model: model.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): (modes.Command | modes.CodeAction)[] | Promise<(modes.Command | modes.CodeAction)[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@ import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { ITextResourceConfigurationService, ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { SimpleBulkEditService, SimpleConfigurationService, SimpleDialogService, SimpleNotificationService, SimpleLocalProgressService, SimpleResourceConfigurationService, SimpleResourcePropertiesService, SimpleUriLabelService, SimpleWorkspaceContextService, StandaloneCommandService, StandaloneKeybindingService, StandaloneTelemetryService, SimpleLayoutService } from 'vs/editor/standalone/browser/simpleServices';
|
||||
import { SimpleBulkEditService, SimpleConfigurationService, SimpleDialogService, SimpleNotificationService, SimpleProgressService, SimpleResourceConfigurationService, SimpleResourcePropertiesService, SimpleUriLabelService, SimpleWorkspaceContextService, StandaloneCommandService, StandaloneKeybindingService, StandaloneTelemetryService, SimpleLayoutService } from 'vs/editor/standalone/browser/simpleServices';
|
||||
import { StandaloneCodeEditorServiceImpl } from 'vs/editor/standalone/browser/standaloneCodeServiceImpl';
|
||||
import { StandaloneThemeServiceImpl } from 'vs/editor/standalone/browser/standaloneThemeServiceImpl';
|
||||
import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
|
||||
@@ -36,7 +36,7 @@ import { ILogService, NullLogService } from 'vs/platform/log/common/log';
|
||||
import { MarkerService } from 'vs/platform/markers/common/markerService';
|
||||
import { IMarkerService } from 'vs/platform/markers/common/markers';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { ILocalProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { IStorageService, InMemoryStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
@@ -150,7 +150,7 @@ export module StaticServices {
|
||||
|
||||
export const codeEditorService = define(ICodeEditorService, (o) => new StandaloneCodeEditorServiceImpl(standaloneThemeService.get(o)));
|
||||
|
||||
export const localProgressService = define(ILocalProgressService, () => new SimpleLocalProgressService());
|
||||
export const progressService = define(IProgressService, () => new SimpleProgressService());
|
||||
|
||||
export const storageService = define(IStorageService, () => new InMemoryStorageService());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user