mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-13 15:35:20 +01:00
debt: move or remove NullXYZServices (#165397)
We have a few NullXYZServices. Those are useful for testing but we should move them to separate files so that we don't end up shipping them with the product
This commit is contained in:
@@ -6,8 +6,3 @@
|
||||
version "16.11.33"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.33.tgz#566713b1b626f781c5c58fe3531307283e00720c"
|
||||
integrity sha512-0PJ0vg+JyU0MIan58IOIFRtSvsb7Ri+7Wltx2qAg94eMOrpg4+uuP3aUHCpxXc1i0jCXiC+zIamSZh3l9AbcQA==
|
||||
|
||||
vscode-nls@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.2.0.tgz#3cb6893dd9bd695244d8a024bdf746eea665cc3f"
|
||||
integrity sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng==
|
||||
|
||||
@@ -12,7 +12,7 @@ import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition } from 'vs/editor/b
|
||||
import { ConfigurationChangedEvent, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { ILanguageService } from 'vs/editor/common/languages/language';
|
||||
import { HoverOperation, HoverStartMode, IHoverComputer } from 'vs/editor/contrib/hover/browser/hoverOperation';
|
||||
import { IOpenerService, NullOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { HoverWidget } from 'vs/base/browser/ui/hover/hoverWidget';
|
||||
|
||||
const $ = dom.$;
|
||||
@@ -39,7 +39,7 @@ export class MarginHoverWidget extends Disposable implements IOverlayWidget {
|
||||
constructor(
|
||||
editor: ICodeEditor,
|
||||
languageService: ILanguageService,
|
||||
openerService: IOpenerService = NullOpenerService,
|
||||
openerService: IOpenerService,
|
||||
) {
|
||||
super();
|
||||
this._editor = editor;
|
||||
|
||||
@@ -7,7 +7,8 @@ import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { OpenerService } from 'vs/editor/browser/services/openerService';
|
||||
import { TestCodeEditorService } from 'vs/editor/test/browser/editorTestServices';
|
||||
import { CommandsRegistry, ICommandService, NullCommandService } from 'vs/platform/commands/common/commands';
|
||||
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { NullCommandService } from 'vs/platform/commands/test/common/nullCommandService';
|
||||
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { matchesScheme, matchesSomeScheme } from 'vs/platform/opener/common/opener';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
|
||||
@@ -47,7 +47,8 @@ import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKe
|
||||
import { ILogService, NullLogService } from 'vs/platform/log/common/log';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { IOpenerService, NullOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { NullOpenerService } from 'vs/platform/opener/test/common/nullOpenerService';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { NullTelemetryServiceShape } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
|
||||
@@ -8,7 +8,7 @@ import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { isIMenuItem, MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
import { MenuService } from 'vs/platform/actions/common/menuService';
|
||||
import { NullCommandService } from 'vs/platform/commands/common/commands';
|
||||
import { NullCommandService } from 'vs/platform/commands/test/common/nullCommandService';
|
||||
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
|
||||
import { InMemoryStorageService } from 'vs/platform/storage/common/storage';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { Iterable } from 'vs/base/common/iterator';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { LinkedList } from 'vs/base/common/linkedList';
|
||||
import { TypeConstraint, validateConstraints } from 'vs/base/common/types';
|
||||
import { createDecorator, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -140,13 +140,4 @@ export const CommandsRegistry: ICommandRegistry = new class implements ICommandR
|
||||
}
|
||||
};
|
||||
|
||||
export const NullCommandService: ICommandService = {
|
||||
_serviceBrand: undefined,
|
||||
onWillExecuteCommand: () => Disposable.None,
|
||||
onDidExecuteCommand: () => Disposable.None,
|
||||
executeCommand() {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
};
|
||||
|
||||
CommandsRegistry.registerCommand('noop', () => { });
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
|
||||
export const NullCommandService: ICommandService = {
|
||||
_serviceBrand: undefined,
|
||||
onWillExecuteCommand: () => Disposable.None,
|
||||
onDidExecuteCommand: () => Disposable.None,
|
||||
executeCommand() {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
};
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { equalsIgnoreCase, startsWithIgnoreCase } from 'vs/base/common/strings';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IEditorOptions, ITextEditorSelection } from 'vs/platform/editor/common/editor';
|
||||
@@ -117,17 +117,6 @@ export interface IOpenerService {
|
||||
resolveExternalUri(resource: URI, options?: ResolveExternalUriOptions): Promise<IResolvedExternalUri>;
|
||||
}
|
||||
|
||||
export const NullOpenerService = Object.freeze({
|
||||
_serviceBrand: undefined,
|
||||
registerOpener() { return Disposable.None; },
|
||||
registerValidator() { return Disposable.None; },
|
||||
registerExternalUriResolver() { return Disposable.None; },
|
||||
setDefaultExternalOpener() { },
|
||||
registerExternalOpener() { return Disposable.None; },
|
||||
async open() { return false; },
|
||||
async resolveExternalUri(uri: URI) { return { resolved: uri, dispose() { } }; },
|
||||
} as IOpenerService);
|
||||
|
||||
export function matchesScheme(target: URI | string, scheme: string): boolean {
|
||||
if (URI.isUri(target)) {
|
||||
return equalsIgnoreCase(target.scheme, scheme);
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IOpenerService } from '../../common/opener';
|
||||
|
||||
export const NullOpenerService = Object.freeze({
|
||||
_serviceBrand: undefined,
|
||||
registerOpener() { return Disposable.None; },
|
||||
registerValidator() { return Disposable.None; },
|
||||
registerExternalUriResolver() { return Disposable.None; },
|
||||
setDefaultExternalOpener() { },
|
||||
registerExternalOpener() { return Disposable.None; },
|
||||
async open() { return false; },
|
||||
async resolveExternalUri(uri: URI) { return { resolved: uri, dispose() { } }; },
|
||||
} as IOpenerService);
|
||||
@@ -262,20 +262,3 @@ export interface ILifecycleService {
|
||||
*/
|
||||
shutdown(): Promise<void>;
|
||||
}
|
||||
|
||||
export const NullLifecycleService: ILifecycleService = {
|
||||
|
||||
_serviceBrand: undefined,
|
||||
|
||||
onBeforeShutdown: Event.None,
|
||||
onBeforeShutdownError: Event.None,
|
||||
onShutdownVeto: Event.None,
|
||||
onWillShutdown: Event.None,
|
||||
onDidShutdown: Event.None,
|
||||
|
||||
phase: LifecyclePhase.Restored,
|
||||
startupKind: StartupKind.NewWindow,
|
||||
|
||||
async when() { },
|
||||
async shutdown() { }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user