Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Inversify to latest #14435

Merged
merged 4 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion dependency-check-baseline.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"npm/npmjs/-/advanced-mark.js/2.6.0": "Manually approved"
"npm/npmjs/-/advanced-mark.js/2.6.0": "Manually approved",
"npm/npmjs/-/inversify/6.1.3": "Manually approved",
"npm/npmjs/@inversifyjs/common/1.3.2": "Manually approved",
"npm/npmjs/@inversifyjs/core/1.3.3": "Manually approved",
"npm/npmjs/@inversifyjs/reflect-metadata-utils/0.2.2": "Manually approved"
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export function rebindOVSXClientFactory(rebind: interfaces.Rebind): void {
// rebind the OVSX client factory so that we can replace patterns like "${self}" in the configs:
rebind(OVSXUrlResolver)
.toDynamicValue(ctx => {
const appInfo = ctx.container.get(SampleAppInfo);
const appInfo = ctx.container.get<SampleAppInfo>(SampleAppInfo);
const selfOrigin = appInfo.getSelfOrigin();
return async url => url.replace('${self}', await selfOrigin);
return async (url: string) => url.replace('${self}', await selfOrigin);
})
.inSingletonScope();
}
16 changes: 8 additions & 8 deletions packages/ai-chat/src/common/chat-agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
MessageActor,
} from '@theia/ai-core/lib/common';
import { CancellationToken, CancellationTokenSource, ContributionProvider, ILogger, isArray } from '@theia/core';
import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify';
import { inject, injectable, named, postConstruct, unmanaged } from '@theia/core/shared/inversify';
import { ChatAgentService } from './chat-agent-service';
import {
ChatModel,
Expand Down Expand Up @@ -133,13 +133,13 @@ export abstract class AbstractChatAgent {
protected defaultContentFactory: DefaultResponseContentFactory;

constructor(
public id: string,
public languageModelRequirements: LanguageModelRequirement[],
protected defaultLanguageModelPurpose: string,
public iconClass: string = 'codicon codicon-copilot',
public locations: ChatAgentLocation[] = ChatAgentLocation.ALL,
public tags: string[] = ['Chat'],
public defaultLogging: boolean = true) {
@unmanaged() public id: string,
@unmanaged() public languageModelRequirements: LanguageModelRequirement[],
@unmanaged() protected defaultLanguageModelPurpose: string,
@unmanaged() public iconClass: string = 'codicon codicon-copilot',
@unmanaged() public locations: ChatAgentLocation[] = ChatAgentLocation.ALL,
@unmanaged() public tags: string[] = ['Chat'],
@unmanaged() public defaultLogging: boolean = true) {
}

@postConstruct()
Expand Down
13 changes: 10 additions & 3 deletions packages/bulk-edit/src/browser/bulk-edit-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************

import { injectable, inject, optional } from '@theia/core/shared/inversify';
import { injectable, inject, optional, postConstruct } from '@theia/core/shared/inversify';
import { Widget } from '@theia/core/lib/browser/widgets/widget';
import { CommandRegistry } from '@theia/core/lib/common';
import { AbstractViewContribution } from '@theia/core/lib/browser/shell/view-contribution';
Expand All @@ -28,19 +28,26 @@ import { ResourceEdit } from '@theia/monaco-editor-core/esm/vs/editor/browser/se

@injectable()
export class BulkEditContribution extends AbstractViewContribution<BulkEditTreeWidget> implements TabBarToolbarContribution {
private edits: ResourceEdit[];
protected edits: ResourceEdit[];

@inject(QuickViewService) @optional()
protected override readonly quickView: QuickViewService;

constructor(private readonly bulkEditService: MonacoBulkEditService) {
@inject(MonacoBulkEditService)
protected readonly bulkEditService: MonacoBulkEditService;

constructor() {
super({
widgetId: BULK_EDIT_TREE_WIDGET_ID,
widgetName: BULK_EDIT_WIDGET_NAME,
defaultWidgetOptions: {
area: 'bottom'
}
});
}

@postConstruct()
protected init(): void {
this.bulkEditService.setPreviewHandler((edits: ResourceEdit[]) => this.previewEdit(edits));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import * as Y from 'yjs';
import { Disposable, Emitter, Event, URI } from '@theia/core';
import { injectable } from '@theia/core/shared/inversify';
import {
FileChange, FileDeleteOptions,
FileOverwriteOptions, FileSystemProviderCapabilities, FileType, Stat, WatchOptions, FileSystemProviderWithFileReadWriteCapability, FileWriteOptions
Expand All @@ -32,7 +31,6 @@ export namespace CollaborationURI {
}
}

@injectable()
export class CollaborationFileSystemProvider implements FileSystemProviderWithFileReadWriteCapability {

capabilities = FileSystemProviderCapabilities.FileReadWrite;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class SomeClass {
- `@theia/request/lib/node-request-service` (from [`@theia/[email protected]`](https://www.npmjs.com/package/@theia/request/v/1.55.0))
- `fs-extra` (from [`fs-extra@^4.0.2`](https://www.npmjs.com/package/fs-extra))
- `fuzzy` (from [`fuzzy@^0.1.3`](https://www.npmjs.com/package/fuzzy))
- `inversify` (from [`inversify@^6.0.1`](https://www.npmjs.com/package/inversify))
- `inversify` (from [`inversify@^6.1.3`](https://www.npmjs.com/package/inversify))
- `react-dom` (from [`react-dom@^18.2.0`](https://www.npmjs.com/package/react-dom))
- `react-dom/client` (from [`react-dom@^18.2.0`](https://www.npmjs.com/package/react-dom))
- `react-virtuoso` (from [`react-virtuoso@^2.17.0`](https://www.npmjs.com/package/react-virtuoso))
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.0",
"iconv-lite": "^0.6.0",
"inversify": "^6.0.1",
sdirix marked this conversation as resolved.
Show resolved Hide resolved
"inversify": "^6.1.3",
"jschardet": "^2.1.1",
"keytar": "7.2.0",
"lodash.debounce": "^4.0.8",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/browser/dialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************

import { injectable, inject } from 'inversify';
import { injectable, inject, unmanaged } from 'inversify';
import { Disposable, MaybePromise, CancellationTokenSource, nls } from '../common';
import { Key } from './keyboard/keys';
import { Widget, BaseWidget, Message, addKeyListener, codiconArray } from './widgets/widget';
Expand Down Expand Up @@ -151,8 +151,8 @@ export abstract class AbstractDialog<T> extends BaseWidget {
protected activeElement: HTMLElement | undefined;

constructor(
protected readonly props: DialogProps,
options?: Widget.IOptions
@unmanaged() protected readonly props: DialogProps,
@unmanaged() options?: Widget.IOptions
) {
super(options);
this.id = 'theia-dialog-shell';
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/browser/shell/view-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************

import { injectable, inject, interfaces, optional } from 'inversify';
import { injectable, inject, interfaces, optional, unmanaged } from 'inversify';
import { Widget } from '@phosphor/widgets';
import {
MenuModelRegistry, Command, CommandContribution,
Expand Down Expand Up @@ -64,7 +64,7 @@ export abstract class AbstractViewContribution<T extends Widget> implements Comm
readonly toggleCommand?: Command;

constructor(
protected readonly options: ViewContributionOptions
@unmanaged() protected readonly options: ViewContributionOptions
) {
if (options.toggleCommandId) {
this.toggleCommand = {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/browser/tree/tree-decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************

import { injectable } from 'inversify';
import { injectable, unmanaged } from 'inversify';
import { Tree, TreeNode } from './tree';
import { Event, Emitter, Disposable, DisposableCollection, MaybePromise } from '../../common';
import { WidgetDecoration } from '../widget-decoration';
Expand Down Expand Up @@ -170,7 +170,7 @@ export abstract class AbstractTreeDecoratorService implements TreeDecoratorServi

protected readonly toDispose = new DisposableCollection();

constructor(protected readonly decorators: ReadonlyArray<TreeDecorator>) {
constructor(@unmanaged() protected readonly decorators: ReadonlyArray<TreeDecorator>) {
this.toDispose.push(this.onDidChangeDecorationsEmitter);
this.toDispose.pushAll(this.decorators.map(decorator =>
decorator.onDidChangeDecorations(data =>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/browser/widgets/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class BaseWidget extends Widget implements PreviewableWidget {
protected scrollBar?: PerfectScrollbar;
protected scrollOptions?: PerfectScrollbar.Options;

constructor(options?: Widget.IOptions) {
constructor(@unmanaged() options?: Widget.IOptions) {
super(options);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/common/performance/stopwatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

/* eslint-disable @typescript-eslint/no-explicit-any */

import { inject, injectable } from 'inversify';
import { inject, injectable, unmanaged } from 'inversify';
import { ILogger, LogLevel } from '../logger';
import { MaybePromise } from '../types';
import { Measurement, MeasurementOptions, MeasurementResult } from './measurement';
Expand Down Expand Up @@ -58,7 +58,7 @@ export abstract class Stopwatch {
return this.onDidAddMeasurementResultEmitter.event;
}

constructor(protected readonly defaultLogOptions: LogOptions) {
constructor(@unmanaged() protected readonly defaultLogOptions: LogOptions) {
if (!defaultLogOptions.defaultLogLevel) {
defaultLogOptions.defaultLogLevel = DEFAULT_LOG_LEVEL;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/git/src/browser/blame/blame-decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************

import { inject, injectable } from '@theia/core/shared/inversify';
import { inject, injectable, unmanaged } from '@theia/core/shared/inversify';
import { EditorManager, TextEditor, EditorDecoration, EditorDecorationOptions, Range, Position, EditorDecorationStyle } from '@theia/editor/lib/browser';
import { GitFileBlame } from '../../common';
import { Disposable, DisposableCollection, nls } from '@theia/core';
Expand All @@ -28,7 +28,7 @@ import { LanguageSelector } from '@theia/monaco-editor-core/esm/vs/editor/common
export class BlameDecorator implements monaco.languages.HoverProvider {

constructor(
protected blameDecorationsStyleSheet: CSSStyleSheet = DecorationStyle.createStyleSheet('gitBlameDecorationsStyle')
@unmanaged() protected blameDecorationsStyleSheet: CSSStyleSheet = DecorationStyle.createStyleSheet('gitBlameDecorationsStyle')
) {
DecorationStyle.getOrCreateStyleRule(`.${BlameDecorator.GIT_BLAME_HIGHLIGHT}`,
this.blameDecorationsStyleSheet).style.backgroundColor = 'var(--theia-gitlens-lineHighlightBackgroundColor)';
Expand Down
6 changes: 3 additions & 3 deletions packages/markers/src/browser/marker-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************

import { injectable } from '@theia/core/shared/inversify';
import { injectable, unmanaged } from '@theia/core/shared/inversify';
import { TreeImpl, CompositeTreeNode, TreeNode, SelectableTreeNode, ExpandableTreeNode } from '@theia/core/lib/browser';
import { MarkerManager } from './marker-manager';
import { Marker } from '../common/marker';
Expand All @@ -32,8 +32,8 @@ export interface MarkerOptions {
export abstract class MarkerTree<T extends object> extends TreeImpl {

constructor(
protected readonly markerManager: MarkerManager<T>,
protected readonly markerOptions: MarkerOptions
@unmanaged() protected readonly markerManager: MarkerManager<T>,
@unmanaged() protected readonly markerOptions: MarkerOptions
) {
super();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ export default new ContainerModule(bind => {
RegisterTableWidget,
RegisterWidgetOptions,
options,
).get(MemoryWidget),
).get<RegisterWidget>(MemoryWidget),
}));
});
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class MemoryWidget<
options?: MemoryWidgetOptions,
): MemoryWidget<Options, Table> {
const child = MemoryWidget.createContainer(parent, optionsWidget, tableWidget, optionSymbol, options);
return child.get(MemoryWidget);
return child.get<MemoryWidget<Options, Table>>(MemoryWidget);
}

static createContainer(
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/hosted/common/hosted-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

import debounce = require('@theia/core/shared/lodash.debounce');
import { injectable, inject, interfaces, named, postConstruct } from '@theia/core/shared/inversify';
import { injectable, inject, interfaces, named, postConstruct, unmanaged } from '@theia/core/shared/inversify';
import { PluginMetadata, HostedPluginServer, DeployedPlugin, PluginServer, PluginIdentifiers } from '../../common/plugin-protocol';
import { AbstractPluginManagerExt, ConfigStorage } from '../../common/plugin-api-rpc';
import {
Expand Down Expand Up @@ -103,7 +103,7 @@ export abstract class AbstractHostedPluginSupport<PM extends AbstractPluginManag
return this.deferredDidStart.promise;
}

constructor(protected readonly clientId: string) { }
constructor(@unmanaged() protected readonly clientId: string) { }

@postConstruct()
protected init(): void {
Expand Down
7 changes: 5 additions & 2 deletions packages/plugin-ext/src/hosted/node/scanners/scanner-theia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

/* eslint-disable @theia/localization-check */

import { inject, injectable } from '@theia/core/shared/inversify';
import { inject, injectable, unmanaged } from '@theia/core/shared/inversify';
import {
AutoClosingPair,
AutoClosingPairConditional,
Expand Down Expand Up @@ -100,7 +100,10 @@ export abstract class AbstractPluginScanner implements PluginScanner {
@inject(PluginUriFactory)
protected readonly pluginUriFactory: PluginUriFactory;

constructor(private readonly _apiType: PluginEngine, private readonly _backendInitPath?: string) { }
constructor(
@unmanaged() private readonly _apiType: PluginEngine,
@unmanaged() private readonly _backendInitPath?: string) {
}

get apiType(): PluginEngine {
return this._apiType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
import { injectable } from '@theia/core/shared/inversify';
import { injectable, unmanaged } from '@theia/core/shared/inversify';
import { PluginDeployerEntry, PluginDeployerEntryType, PluginType } from '../../common/plugin-protocol';
import { PluginDeployerEntryImpl } from './plugin-deployer-entry-impl';

Expand All @@ -25,7 +25,10 @@ export class ProxyPluginDeployerEntry<T> implements PluginDeployerEntry {

private readonly deployerName: string;

constructor(readonly deployer: T, readonly delegate: PluginDeployerEntryImpl) {
constructor(
@unmanaged() readonly deployer: T,
@unmanaged() readonly delegate: PluginDeployerEntryImpl
) {
this.deployerName = (this.deployer as {}).constructor.name;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/process/src/node/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ export abstract class Process implements ManagedProcess {
abstract readonly inputStream: Writable;

constructor(
protected readonly processManager: ManagedProcessManager,
protected readonly logger: ILogger,
@unmanaged() protected readonly processManager: ManagedProcessManager,
@unmanaged() protected readonly logger: ILogger,
@unmanaged() protected readonly type: ProcessType,
protected readonly options: ProcessOptions | ForkOptions
@unmanaged() protected readonly options: ProcessOptions | ForkOptions
) {
this.id = this.processManager.register(this);
this.initialCwd = options && options.options && 'cwd' in options.options && options.options['cwd'].toString() || __dirname;
Expand Down
8 changes: 4 additions & 4 deletions packages/task/src/node/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************

import { injectable } from '@theia/core/shared/inversify';
import { injectable, unmanaged } from '@theia/core/shared/inversify';
import { ILogger, Disposable, DisposableCollection, Emitter, Event, MaybePromise } from '@theia/core/lib/common/';
import { TaskInfo, TaskExitedEvent, TaskConfiguration, TaskOutputEvent, ManagedTask, ManagedTaskManager } from '../common/task-protocol';
/**
Expand Down Expand Up @@ -43,9 +43,9 @@ export abstract class Task implements Disposable, ManagedTask {
readonly outputEmitter: Emitter<TaskOutputEvent>;

constructor(
protected readonly taskManager: ManagedTaskManager<Task>,
protected readonly logger: ILogger,
protected readonly options: TaskOptions
@unmanaged() protected readonly taskManager: ManagedTaskManager<Task>,
@unmanaged() protected readonly logger: ILogger,
@unmanaged() protected readonly options: TaskOptions
) {
this.taskId = this.taskManager.register(this, this.options.context);
this.exitEmitter = new Emitter<TaskExitedEvent>();
Expand Down
4 changes: 2 additions & 2 deletions packages/terminal/src/browser/terminal-profile-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// *****************************************************************************

import { Emitter, Event } from '@theia/core';
import { injectable } from '@theia/core/shared/inversify';
import { injectable, unmanaged } from '@theia/core/shared/inversify';
import { TerminalWidget } from './base/terminal-widget';
import { ShellTerminalProfile } from './shell-terminal-profile';

Expand Down Expand Up @@ -95,7 +95,7 @@ export class DefaultTerminalProfileService implements TerminalProfileService {
onRemoved: Event<string> = this.onRemovedEmitter.event;
onDidChangeDefaultShell: Event<string> = this.onDidChangeDefaultShellEmitter.event;

constructor(...stores: TerminalProfileStore[]) {
constructor(@unmanaged() ...stores: TerminalProfileStore[]) {
this.stores = stores;
for (const store of this.stores) {
store.onAdded(e => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import { RateLimiter } from 'limiter';

export default new ContainerModule(bind => {
bind(OVSXUrlResolver)
.toFunction(url => url);
.toFunction((url: string) => url);
bind(OVSXClientProvider)
.toDynamicValue(ctx => {
const vsxEnvironment = ctx.container.get<VSXEnvironment>(VSXEnvironment);
const requestService = ctx.container.get<RequestService>(RequestService);
const urlResolver = ctx.container.get(OVSXUrlResolver);
const urlResolver = ctx.container.get<OVSXUrlResolver>(OVSXUrlResolver);
const clientPromise = Promise
.all([
vsxEnvironment.getRegistryApiUri(),
Expand Down
Loading
Loading