Skip to content

feat: use [email protected] #2654

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

Merged
merged 18 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
chore: use [email protected]
  • Loading branch information
giacomocusinato committed Mar 28, 2025
commit b0a32df0998a8ec7015a68bf433b53ffe954eaba
46 changes: 23 additions & 23 deletions arduino-ide-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,29 @@
},
"dependencies": {
"@grpc/grpc-js": "^1.8.14",
"@theia/application-package": "1.54.0",
"@theia/core": "1.54.0",
"@theia/debug": "1.54.0",
"@theia/editor": "1.54.0",
"@theia/electron": "1.54.0",
"@theia/filesystem": "1.54.0",
"@theia/keymaps": "1.54.0",
"@theia/markers": "1.54.0",
"@theia/messages": "1.54.0",
"@theia/monaco": "1.54.0",
"@theia/application-package": "1.55.1",
"@theia/core": "1.55.1",
"@theia/debug": "1.55.1",
"@theia/editor": "1.55.1",
"@theia/electron": "1.55.1",
"@theia/filesystem": "1.55.1",
"@theia/keymaps": "1.55.1",
"@theia/markers": "1.55.1",
"@theia/messages": "1.55.1",
"@theia/monaco": "1.55.1",
"@theia/monaco-editor-core": "1.83.101",
"@theia/navigator": "1.54.0",
"@theia/outline-view": "1.54.0",
"@theia/output": "1.54.0",
"@theia/plugin-ext": "1.54.0",
"@theia/plugin-ext-vscode": "1.54.0",
"@theia/preferences": "1.54.0",
"@theia/scm": "1.54.0",
"@theia/search-in-workspace": "1.54.0",
"@theia/terminal": "1.54.0",
"@theia/test": "1.54.0",
"@theia/typehierarchy": "1.54.0",
"@theia/workspace": "1.54.0",
"@theia/navigator": "1.55.1",
"@theia/outline-view": "1.55.1",
"@theia/output": "1.55.1",
"@theia/plugin-ext": "1.55.1",
"@theia/plugin-ext-vscode": "1.55.1",
"@theia/preferences": "1.55.1",
"@theia/scm": "1.55.1",
"@theia/search-in-workspace": "1.55.1",
"@theia/terminal": "1.55.1",
"@theia/test": "1.55.1",
"@theia/typehierarchy": "1.55.1",
"@theia/workspace": "1.55.1",
"@tippyjs/react": "^4.2.5",
"@types/auth0-js": "^9.21.3",
"@types/btoa": "^1.2.3",
Expand Down Expand Up @@ -126,7 +126,7 @@
"mockdate": "^3.0.5",
"moment": "^2.24.0",
"ncp": "^2.0.0",
"rimraf": "^2.6.1"
"rimraf": "^5.0.0"
},
"optionalDependencies": {
"@pingghost/protoc": "^1.0.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { injectable } from '@theia/core/shared/inversify';
import { TextEditor } from '@theia/editor/lib/browser';
import { EditorContribution as TheiaEditorContribution } from '@theia/editor/lib/browser/editor-contribution';

@injectable()
export class EditorContribution extends TheiaEditorContribution {
protected override updateLanguageStatus(
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
editor: TextEditor | undefined
// eslint-disable-next-line @typescript-eslint/no-unused-vars
..._: Parameters<TheiaEditorContribution['updateLanguageStatus']>
): void {
// NOOP
}

protected override updateEncodingStatus(
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
editor: TextEditor | undefined
// eslint-disable-next-line @typescript-eslint/no-unused-vars
..._: Parameters<TheiaEditorContribution['updateEncodingStatus']>
): void {
// https://github.com/arduino/arduino-ide/issues/1393
// NOOP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,33 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
this.preferencesService.onPreferenceChanged(
debounce((e) => {
if (e.preferenceName === 'window.menuBarVisibility') {
this.setMenuBar();
this.doSetMenuBar();
}
if (this._menu) {
for (const cmd of this._toggledCommands) {
const menuItem = this.findMenuById(this._menu, cmd);
if (this.menu) {
for (const cmd of this.toggledCommands) {
const menuItem = this.findMenuById(this.menu, cmd);
if (menuItem) {
menuItem.checked = this.commandRegistry.isToggled(cmd);
}
}
window.electronArduino.setMenu(this._menu); // calls the IDE2-specific implementation
window.electronArduino.setMenu(this.menu); // calls the IDE2-specific implementation
}
}, 10)
);
this.keybindingRegistry.onKeybindingsChanged(() => {
this.setMenuBar();
this.doSetMenuBar();
});
// #endregion Theia `postConstruct`
this.appStateService.reachedState('ready').then(() => {
this.appReady = true;
if (this.updateWhenReady) {
this.setMenuBar();
this.doSetMenuBar();
}
});
}

override createElectronMenuBar(): MenuDto[] {
this._toggledCommands.clear(); // https://github.com/eclipse-theia/theia/issues/8977
this.toggledCommands.clear(); // https://github.com/eclipse-theia/theia/issues/8977
const menuModel = this.menuProvider.getMenu(MAIN_MENU_BAR);
const menu = this.fillMenuTemplate([], menuModel, [], {
rootMenuPath: MAIN_MENU_BAR,
Expand All @@ -73,11 +73,12 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
menu.unshift(this.createOSXMenu());
}
const escapedMenu = this.escapeAmpersand(menu);
this._menu = escapedMenu;
this.menu = escapedMenu;
return escapedMenu;
}

override async setMenuBar(): Promise<void> {
// CHECK ME
override async doSetMenuBar(): Promise<void> {
// Avoid updating menu items when the app is not ready.
// Getting the current electron window is not free and synchronous.
// Here, we defer all menu update requests, and fire one when the app is ready.
Expand Down Expand Up @@ -124,17 +125,17 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
...args
);
if (
this._menu &&
this.menu &&
this.menuCommandExecutor.isVisible(menuPath, commandId, ...args)
) {
const item = this.findMenuById(this._menu, commandId);
const item = this.findMenuById(this.menu, commandId);
if (item) {
item.checked = this.menuCommandExecutor.isToggled(
menuPath,
commandId,
...args
);
window.electronArduino.setMenu(this._menu); // overridden to call the IDE2-specific implementation.
window.electronArduino.setMenu(this.menu); // overridden to call the IDE2-specific implementation.
}
}
}
Expand Down Expand Up @@ -342,7 +343,7 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
parentItems.push(menuItem);

if (this.commandRegistry.getToggledHandler(commandId, ...args)) {
this._toggledCommands.add(commandId);
this.toggledCommands.add(commandId);
}
}
return parentItems;
Expand Down
4 changes: 2 additions & 2 deletions arduino-ide-extension/src/node/arduino-ide-backend-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ import { FormatterPath } from '../common/protocol/formatter';
import { HostedPluginLocalizationService } from './theia/plugin-ext/hosted-plugin-localization-service';
import { HostedPluginLocalizationService as TheiaHostedPluginLocalizationService } from '@theia/plugin-ext/lib/hosted/node/hosted-plugin-localization-service';
import { IsTempSketch } from './is-temp-sketch';
import { rebindNsfwFileSystemWatcher } from './theia/filesystem/nsfw-bindings';
import { WebsocketEndpoint } from './theia/core/websocket-endpoint';
import { MessagingService } from '@theia/core/lib/node/messaging/messaging-service';
import { HostedPluginReader } from './theia/plugin-ext/plugin-reader';
Expand All @@ -121,6 +120,7 @@ import {
} from './theia/plugin-ext/plugin-deployer';
import { SettingsReader } from './settings-reader';
import { VsCodePluginScanner } from './theia/plugin-ext-vscode/scanner-vscode';
import { rebindParcelFileSystemWatcher } from './theia/filesystem/parcel-bindings';

export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(BackendApplication).toSelf().inSingletonScope();
Expand Down Expand Up @@ -300,7 +300,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
)
)
.inSingletonScope();
rebindNsfwFileSystemWatcher(rebind);
rebindParcelFileSystemWatcher(rebind);

// Output service per connection.
bind(ConnectionContainerModule).toConstantValue(
Expand Down
42 changes: 0 additions & 42 deletions arduino-ide-extension/src/node/theia/filesystem/nsfw-bindings.ts

This file was deleted.

42 changes: 42 additions & 0 deletions arduino-ide-extension/src/node/theia/filesystem/parcel-bindings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { join } from 'node:path';
import { interfaces } from '@theia/core/shared/inversify';
import {
FileSystemWatcherServiceProcessOptions,
WATCHER_SINGLE_THREADED,
spawnParcelFileSystemWatcherServiceProcess,
} from '@theia/filesystem/lib/node/filesystem-backend-module';
import { FileSystemWatcherService } from '@theia/filesystem/lib/common/filesystem-watcher-protocol';
import { ParcelFileSystemWatcherServerOptions } from '@theia/filesystem/lib/node/parcel-watcher/parcel-filesystem-service';
import { FileSystemWatcherServiceDispatcher } from '@theia/filesystem/lib/node/filesystem-watcher-dispatcher';
import { NoDelayDisposalTimeoutParcelFileSystemWatcherService } from './parcel-watcher/parcel-filesystem-service';

export function rebindParcelFileSystemWatcher(rebind: interfaces.Rebind): void {
rebind<FileSystemWatcherServiceProcessOptions>(
FileSystemWatcherServiceProcessOptions
).toConstantValue({
entryPoint: join(__dirname, 'parcel-watcher'),
});
rebind<FileSystemWatcherService>(FileSystemWatcherService)
.toDynamicValue((context) =>
WATCHER_SINGLE_THREADED
? createParcelFileSystemWatcherService(context)
: spawnParcelFileSystemWatcherServiceProcess(context)
)
.inSingletonScope();
}

function createParcelFileSystemWatcherService({
container,
}: interfaces.Context): FileSystemWatcherService {
const options = container.get<ParcelFileSystemWatcherServerOptions>(
ParcelFileSystemWatcherServerOptions
);
const dispatcher = container.get<FileSystemWatcherServiceDispatcher>(
FileSystemWatcherServiceDispatcher
);
const server = new NoDelayDisposalTimeoutParcelFileSystemWatcherService(
options
);
server.setClient(dispatcher);
return server;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as yargs from '@theia/core/shared/yargs';
import { JsonRpcProxyFactory } from '@theia/core/lib/common/messaging/proxy-factory';
import { NoDelayDisposalTimeoutNsfwFileSystemWatcherService } from './nsfw-filesystem-service';
import { NoDelayDisposalTimeoutParcelFileSystemWatcherService } from './parcel-filesystem-service';
import type { IPCEntryPoint } from '@theia/core/lib/node/messaging/ipc-protocol';
import type { FileSystemWatcherServiceClient } from '@theia/filesystem/lib/common/filesystem-watcher-protocol';

Expand All @@ -20,7 +20,7 @@ const options: {
}).argv as any;

export default <IPCEntryPoint>((connection) => {
const server = new NoDelayDisposalTimeoutNsfwFileSystemWatcherService(
const server = new NoDelayDisposalTimeoutParcelFileSystemWatcherService(
options
);
const factory = new JsonRpcProxyFactory<FileSystemWatcherServiceClient>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { Minimatch } from 'minimatch';
import type { WatchOptions } from '@theia/filesystem/lib/common/filesystem-watcher-protocol';
import {
NsfwFileSystemWatcherService,
NsfwWatcher,
} from '@theia/filesystem/lib/node/nsfw-watcher/nsfw-filesystem-service';
ParcelFileSystemWatcherService,
ParcelWatcher,
} from '@theia/filesystem/lib/node/parcel-watcher/parcel-filesystem-service';

// Dispose the watcher immediately when the last reference is removed. By default, Theia waits 10 sec.
// https://github.com/eclipse-theia/theia/issues/11639#issuecomment-1238980708
const NoDelay = 0;

export class NoDelayDisposalTimeoutNsfwFileSystemWatcherService extends NsfwFileSystemWatcherService {
export class NoDelayDisposalTimeoutParcelFileSystemWatcherService extends ParcelFileSystemWatcherService {
protected override createWatcher(
clientId: number,
fsPath: string,
options: WatchOptions
): NsfwWatcher {
): ParcelWatcher {
const watcherOptions = {
ignored: options.ignored.map(
(pattern) => new Minimatch(pattern, { dot: true })
),
};
return new NsfwWatcher(
return new ParcelWatcher(
clientId,
fsPath,
watcherOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { expect } from 'chai';
import { dump, load } from 'js-yaml';
import { promises as fs } from 'node:fs';
import { join } from 'node:path';
import { sync as deleteSync } from 'rimraf';
import { rimrafSync } from 'rimraf';
import {
BoardsService,
CoreService,
Expand Down Expand Up @@ -65,7 +65,7 @@ describe('core-client-provider', () => {
it("should recover when the 'directories.data' folder is missing", async function () {
this.timeout(timeout);
const configDirPath = await prepareTestConfigDir();
deleteSync(join(configDirPath, 'data'));
rimrafSync(join(configDirPath, 'data'));

const container = await startCli(configDirPath, toDispose);
await assertFunctionalCli(container, ({ coreClientProvider }) => {
Expand All @@ -84,7 +84,7 @@ describe('core-client-provider', () => {
'Arduino15',
'package_index.json'
);
deleteSync(primaryPackageIndexPath);
rimrafSync(primaryPackageIndexPath);

const container = await startCli(configDirPath, toDispose);
await assertFunctionalCli(container, ({ coreClientProvider }) => {
Expand Down Expand Up @@ -118,7 +118,7 @@ describe('core-client-provider', () => {
'tools',
tool
);
deleteSync(builtinToolsPath);
rimrafSync(builtinToolsPath);

const container = await startCli(configDirPath, toDispose);
await assertFunctionalCli(container, ({ coreClientProvider }) => {
Expand All @@ -140,7 +140,7 @@ describe('core-client-provider', () => {
'Arduino15',
'library_index.json'
);
deleteSync(libraryPackageIndexPath);
rimrafSync(libraryPackageIndexPath);

const container = await startCli(configDirPath, toDispose);
await assertFunctionalCli(container, ({ coreClientProvider }) => {
Expand Down Expand Up @@ -176,7 +176,7 @@ describe('core-client-provider', () => {
'Arduino15',
'package_teensy_index.json'
);
deleteSync(thirdPartyPackageIndexPath);
rimrafSync(thirdPartyPackageIndexPath);

const container = await startCli(configDirPath, toDispose);
await assertFunctionalCli(
Expand All @@ -193,7 +193,7 @@ describe('core-client-provider', () => {
it("should recover when invalid 3rd package URL is defined in the CLI config and the 'directories.data' folder is missing", async function () {
this.timeout(timeout);
const configDirPath = await prepareTestConfigDir();
deleteSync(join(configDirPath, 'data'));
rimrafSync(join(configDirPath, 'data'));

// set an invalid URL so the CLI will try to download it
const cliConfigPath = join(configDirPath, 'arduino-cli.yaml');
Expand Down
Loading