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

chore(deps): update to theia@1.41.0 #2211

Merged
merged 5 commits into from
Sep 29, 2023
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
40 changes: 20 additions & 20 deletions arduino-ide-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@
},
"dependencies": {
"@grpc/grpc-js": "^1.8.14",
"@theia/application-package": "1.39.0",
"@theia/core": "1.39.0",
"@theia/debug": "1.39.0",
"@theia/editor": "1.39.0",
"@theia/electron": "1.39.0",
"@theia/filesystem": "1.39.0",
"@theia/keymaps": "1.39.0",
"@theia/markers": "1.39.0",
"@theia/messages": "1.39.0",
"@theia/monaco": "1.39.0",
"@theia/application-package": "1.41.0",
"@theia/core": "1.41.0",
"@theia/debug": "1.41.0",
"@theia/editor": "1.41.0",
"@theia/electron": "1.41.0",
"@theia/filesystem": "1.41.0",
"@theia/keymaps": "1.41.0",
"@theia/markers": "1.41.0",
"@theia/messages": "1.41.0",
"@theia/monaco": "1.41.0",
"@theia/monaco-editor-core": "1.72.3",
"@theia/navigator": "1.39.0",
"@theia/outline-view": "1.39.0",
"@theia/output": "1.39.0",
"@theia/plugin-ext": "1.39.0",
"@theia/preferences": "1.39.0",
"@theia/scm": "1.39.0",
"@theia/search-in-workspace": "1.39.0",
"@theia/terminal": "1.39.0",
"@theia/typehierarchy": "1.39.0",
"@theia/workspace": "1.39.0",
"@theia/navigator": "1.41.0",
"@theia/outline-view": "1.41.0",
"@theia/output": "1.41.0",
"@theia/plugin-ext": "1.41.0",
"@theia/preferences": "1.41.0",
"@theia/scm": "1.41.0",
"@theia/search-in-workspace": "1.41.0",
"@theia/terminal": "1.41.0",
"@theia/typehierarchy": "1.41.0",
"@theia/workspace": "1.41.0",
"@tippyjs/react": "^4.2.5",
"@types/auth0-js": "^9.14.0",
"@types/btoa": "^1.2.3",
Expand Down
14 changes: 13 additions & 1 deletion arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ import { MonacoEditorMenuContribution as TheiaMonacoEditorMenuContribution } fro
import { UpdateArduinoState } from './contributions/update-arduino-state';
import { TerminalFrontendContribution } from './theia/terminal/terminal-frontend-contribution';
import { TerminalFrontendContribution as TheiaTerminalFrontendContribution } from '@theia/terminal/lib/browser/terminal-frontend-contribution';
import { SelectionService } from '@theia/core/lib/common/selection-service';
import { CommandService } from '@theia/core/lib/common/command';
import { CorePreferences } from '@theia/core/lib/browser/core-preferences';

// Hack to fix copy/cut/paste issue after electron version update in Theia.
// https://github.com/eclipse-theia/theia/issues/12487
Expand Down Expand Up @@ -796,10 +799,19 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
);
const iconThemeService =
context.container.get<IconThemeService>(IconThemeService);
const selectionService =
context.container.get<SelectionService>(SelectionService);
const commandService =
context.container.get<CommandService>(CommandService);
const corePreferences =
context.container.get<CorePreferences>(CorePreferences);
return new TabBarRenderer(
contextMenuRenderer,
decoratorService,
iconThemeService
iconThemeService,
selectionService,
commandService,
corePreferences
);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { injectable } from '@theia/core/shared/inversify';
import { MenuModelRegistry } from '@theia/core/lib/common/menu';
import {
CommonFrontendContribution as TheiaCommonFrontendContribution,
CommonCommands,
CommonFrontendContribution as TheiaCommonFrontendContribution,
} from '@theia/core/lib/browser/common-frontend-contribution';
import { CommandRegistry } from '@theia/core/lib/common/command';
import type { OnWillStopAction } from '@theia/core/lib/browser/frontend-application';
import { KeybindingRegistry } from '@theia/core/lib/browser';
import { isOSX } from '@theia/core';
import type { KeybindingRegistry } from '@theia/core/lib/browser/keybinding';
import type { CommandRegistry } from '@theia/core/lib/common/command';
import type { MenuModelRegistry } from '@theia/core/lib/common/menu';
import { isOSX } from '@theia/core/lib/common/os';
import { injectable } from '@theia/core/shared/inversify';

@injectable()
export class CommonFrontendContribution extends TheiaCommonFrontendContribution {
Expand All @@ -25,6 +25,7 @@ export class CommonFrontendContribution extends TheiaCommonFrontendContribution
CommonCommands.PIN_TAB,
CommonCommands.UNPIN_TAB,
CommonCommands.NEW_UNTITLED_FILE,
CommonCommands.NEW_UNTITLED_TEXT_FILE,
]) {
commandRegistry.unregisterCommand(command);
}
Expand All @@ -48,6 +49,7 @@ export class CommonFrontendContribution extends TheiaCommonFrontendContribution
CommonCommands.ABOUT_COMMAND,
CommonCommands.SAVE_WITHOUT_FORMATTING, // Patched for https://github.com/eclipse-theia/theia/pull/8877,
CommonCommands.NEW_UNTITLED_FILE,
CommonCommands.NEW_UNTITLED_TEXT_FILE,
]) {
registry.unregisterMenuAction(command);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export class MonacoTextModelService extends TheiaMonacoTextModelService {
const factory = this.factories
.getContributions()
.find(({ scheme }) => resource.uri.scheme === scheme);
const readOnly = this.sketchesServiceClient.isReadOnly(resource.uri);
const readOnly =
Boolean(resource.isReadonly) ||
this.sketchesServiceClient.isReadOnly(resource.uri);
return factory
? factory.createModel(resource)
: new MaybeReadonlyMonacoEditorModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function createServer(
}

export async function startServer(server: http.Server): Promise<string> {
let portTimer: NodeJS.Timer;
let portTimer: NodeJS.Timeout;

function cancelPortTimer() {
clearTimeout(portTimer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import { HostedPluginReader as TheiaHostedPluginReader } from '@theia/plugin-ext

@injectable()
export class HostedPluginReader extends TheiaHostedPluginReader {
override readContribution(
override async readContribution(
plugin: PluginPackage
): PluginContribution | undefined {
): Promise<PluginContribution | undefined> {
const scanner = this.scanner.getScanner(plugin);
const contributions = scanner.getContribution(plugin);
const contributions = await scanner.getContribution(plugin);
return this.filterContribution(plugin.name, contributions);
}

private filterContribution(
pluginName: string,
contributions: PluginContribution | undefined
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { promises as fs, constants } from 'node:fs';
import { injectable, inject } from '@theia/core/shared/inversify';
import { FileUri } from '@theia/core/lib/node';
import { inject, injectable } from '@theia/core/shared/inversify';
import { DefaultWorkspaceServer as TheiaDefaultWorkspaceServer } from '@theia/workspace/lib/node/default-workspace-server';
import { SketchesService } from '../../../common/protocol';
import { FileUri } from '@theia/core/lib/node';
import { IsTempSketch } from '../../is-temp-sketch';

@injectable()
Expand All @@ -21,26 +20,6 @@ export class DefaultWorkspaceServer extends TheiaDefaultWorkspaceServer {
return uri;
}

/**
* This is the async re-implementation of the default Theia behavior.
*/
override async getRecentWorkspaces(): Promise<string[]> {
const listUri: string[] = [];
const data = await this.readRecentWorkspacePathsFromUserHome();
if (data && data.recentRoots) {
await Promise.all(
data.recentRoots
.filter((element) => Boolean(element))
.map(async (element) => {
if (await this.exists(element)) {
listUri.push(element);
}
})
);
}
return listUri;
}

protected override async writeToUserHome(
data: RecentWorkspacePathsData
): Promise<void> {
Expand Down Expand Up @@ -69,15 +48,6 @@ export class DefaultWorkspaceServer extends TheiaDefaultWorkspaceServer {
recentRoots,
};
}

private async exists(uri: string): Promise<boolean> {
try {
await fs.access(FileUri.fsPath(uri), constants.R_OK | constants.W_OK);
return true;
} catch {
return false;
}
}
}

// Remove after https://github.com/eclipse-theia/theia/pull/11603
Expand Down
56 changes: 28 additions & 28 deletions electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
"license": "AGPL-3.0-or-later",
"main": "./src-gen/backend/electron-main.js",
"dependencies": {
"@theia/core": "1.39.0",
"@theia/debug": "1.39.0",
"@theia/editor": "1.39.0",
"@theia/electron": "1.39.0",
"@theia/filesystem": "1.39.0",
"@theia/keymaps": "1.39.0",
"@theia/messages": "1.39.0",
"@theia/monaco": "1.39.0",
"@theia/navigator": "1.39.0",
"@theia/plugin-ext": "1.39.0",
"@theia/plugin-ext-vscode": "1.39.0",
"@theia/preferences": "1.39.0",
"@theia/terminal": "1.39.0",
"@theia/workspace": "1.39.0",
"@theia/core": "1.41.0",
"@theia/debug": "1.41.0",
"@theia/editor": "1.41.0",
"@theia/electron": "1.41.0",
"@theia/filesystem": "1.41.0",
"@theia/keymaps": "1.41.0",
"@theia/messages": "1.41.0",
"@theia/monaco": "1.41.0",
"@theia/navigator": "1.41.0",
"@theia/plugin-ext": "1.41.0",
"@theia/plugin-ext-vscode": "1.41.0",
"@theia/preferences": "1.41.0",
"@theia/terminal": "1.41.0",
"@theia/workspace": "1.41.0",
"arduino-ide-extension": "2.2.2"
},
"devDependencies": {
"@theia/cli": "1.39.0",
"@theia/cli": "1.41.0",
"7zip-min": "^1.4.4",
"chmodr": "^1.2.0",
"compression-webpack-plugin": "^9.0.0",
Expand Down Expand Up @@ -201,22 +201,22 @@
"vscode-builtin-json-language-features": "https://open-vsx.org/api/vscode/json-language-features/1.46.1/file/vscode.json-language-features-1.46.1.vsix",
"cortex-debug": "https://downloads.arduino.cc/marus25.cortex-debug/marus25.cortex-debug-1.5.1.vsix",
"vscode-language-pack-bg": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-bg/1.48.3/file/MS-CEINTL.vscode-language-pack-bg-1.48.3.vsix",
"vscode-language-pack-cs": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-cs/1.78.0/file/MS-CEINTL.vscode-language-pack-cs-1.78.0.vsix",
"vscode-language-pack-de": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-de/1.78.0/file/MS-CEINTL.vscode-language-pack-de-1.78.0.vsix",
"vscode-language-pack-es": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-es/1.78.0/file/MS-CEINTL.vscode-language-pack-es-1.78.0.vsix",
"vscode-language-pack-fr": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-fr/1.78.0/file/MS-CEINTL.vscode-language-pack-fr-1.78.0.vsix",
"vscode-language-pack-cs": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-cs/1.80.0/file/MS-CEINTL.vscode-language-pack-cs-1.80.0.vsix",
"vscode-language-pack-de": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-de/1.80.0/file/MS-CEINTL.vscode-language-pack-de-1.80.0.vsix",
"vscode-language-pack-es": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-es/1.80.0/file/MS-CEINTL.vscode-language-pack-es-1.80.0.vsix",
"vscode-language-pack-fr": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-fr/1.80.0/file/MS-CEINTL.vscode-language-pack-fr-1.80.0.vsix",
"vscode-language-pack-hu": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-hu/1.48.3/file/MS-CEINTL.vscode-language-pack-hu-1.48.3.vsix",
"vscode-language-pack-it": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-it/1.78.0/file/MS-CEINTL.vscode-language-pack-it-1.78.0.vsix",
"vscode-language-pack-ja": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-ja/1.78.0/file/MS-CEINTL.vscode-language-pack-ja-1.78.0.vsix",
"vscode-language-pack-ko": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-ko/1.78.0/file/MS-CEINTL.vscode-language-pack-ko-1.78.0.vsix",
"vscode-language-pack-it": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-it/1.80.0/file/MS-CEINTL.vscode-language-pack-it-1.80.0.vsix",
"vscode-language-pack-ja": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-ja/1.80.0/file/MS-CEINTL.vscode-language-pack-ja-1.80.0.vsix",
"vscode-language-pack-ko": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-ko/1.80.0/file/MS-CEINTL.vscode-language-pack-ko-1.80.0.vsix",
"vscode-language-pack-nl": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-nl/1.48.3/file/MS-CEINTL.vscode-language-pack-nl-1.48.3.vsix",
"vscode-language-pack-pl": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-pl/1.78.0/file/MS-CEINTL.vscode-language-pack-pl-1.78.0.vsix",
"vscode-language-pack-pt-BR": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-pt-BR/1.78.0/file/MS-CEINTL.vscode-language-pack-pt-BR-1.78.0.vsix",
"vscode-language-pack-ru": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-ru/1.78.0/file/MS-CEINTL.vscode-language-pack-ru-1.78.0.vsix",
"vscode-language-pack-tr": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-tr/1.78.0/file/MS-CEINTL.vscode-language-pack-tr-1.78.0.vsix",
"vscode-language-pack-pl": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-pl/1.80.0/file/MS-CEINTL.vscode-language-pack-pl-1.80.0.vsix",
"vscode-language-pack-pt-BR": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-pt-BR/1.80.0/file/MS-CEINTL.vscode-language-pack-pt-BR-1.80.0.vsix",
"vscode-language-pack-ru": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-ru/1.80.0/file/MS-CEINTL.vscode-language-pack-ru-1.80.0.vsix",
"vscode-language-pack-tr": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-tr/1.80.0/file/MS-CEINTL.vscode-language-pack-tr-1.80.0.vsix",
"vscode-language-pack-uk": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-uk/1.48.3/file/MS-CEINTL.vscode-language-pack-uk-1.48.3.vsix",
"vscode-language-pack-zh-hans": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-zh-hans/1.78.0/file/MS-CEINTL.vscode-language-pack-zh-hans-1.78.0.vsix",
"vscode-language-pack-zh-hant": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-zh-hant/1.78.0/file/MS-CEINTL.vscode-language-pack-zh-hant-1.78.0.vsix"
"vscode-language-pack-zh-hans": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-zh-hans/1.80.0/file/MS-CEINTL.vscode-language-pack-zh-hans-1.80.0.vsix",
"vscode-language-pack-zh-hant": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-zh-hant/1.80.0/file/MS-CEINTL.vscode-language-pack-zh-hant-1.80.0.vsix"
},
"mocha": {
"reporter": "spec",
Expand Down
56 changes: 9 additions & 47 deletions electron-app/webpack.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
const chmodr = require('chmodr');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('node:path');
const fs = require('node:fs/promises');

const isWindows = process.platform === 'win32';
const isMacOS = process.platform === 'darwin';

/**
* @param {string} target the name of the `npm` package to resolve.
*/
function resolvePackagePath(target, baseDir = __dirname) {
const resolvePackageJsonPath = require('resolve-package-path');
const packageJsonPath = resolvePackageJsonPath(target, baseDir);
Expand All @@ -23,9 +22,11 @@ function resolvePackagePath(target, baseDir = __dirname) {
// restore file permissions after webpack copy
// https://github.com/webpack-contrib/copy-webpack-plugin/issues/35#issuecomment-1407280257
class PermissionsPlugin {
constructor(targetPath, patchTheia12780 = false) {
/**
* @param {string} targetPath
*/
constructor(targetPath) {
this.targetPath = targetPath;
this.patchTheia12780 = patchTheia12780;
}

/**
Expand All @@ -34,20 +35,6 @@ class PermissionsPlugin {
apply(compiler) {
compiler.hooks.afterEmit.tap('PermissionsPlugin', () => {
return new Promise(async (resolve, reject) => {
if (this.patchTheia12780) {
let trashBinaryFilename = undefined;
if (isWindows) {
trashBinaryFilename = 'windows-trash.exe';
} else if (isMacOS) {
trashBinaryFilename = 'macos-trash';
}
if (trashBinaryFilename) {
await fs.chmod(
path.join(__dirname, 'lib', 'backend', trashBinaryFilename),
0o755
);
}
}
chmodr(this.targetPath, 0o755, (err) =>
err ? reject(err) : resolve(undefined)
);
Expand All @@ -59,18 +46,9 @@ class PermissionsPlugin {
/**
* Creates webpack plugins to copy all required resources (binaries, plotter app, translation files, etc.) to the appropriate location.
* @param {string} targetPath where to copy the resources
* @param {boolean|undefined} [patchTheia12780=true] to apply patch for https://github.com/eclipse-theia/theia/issues/12780. Only required in the production app.
* @param {string|undefined} [baseDir=__dirname] to calculate the modules from. Defaults to `__dirname`
*/
function createCopyArduinoResourcesPlugins(
targetPath,
patchTheia12780 = false,
baseDir = __dirname
) {
const trashBinariesPath = path.join(
resolvePackagePath('trash', baseDir),
'lib'
);
function createCopyArduinoResourcesPlugins(targetPath, baseDir = __dirname) {
const copyOptions = {
patterns: [
// binaries
Expand All @@ -96,25 +74,9 @@ function createCopyArduinoResourcesPlugins(
},
],
};

if (patchTheia12780) {
// workaround for https://github.com/eclipse-theia/theia/issues/12780
// copy the Windows (`windows-trash.exe`) and macOS (`macos-trash`) executables for `trash`
if (isWindows) {
copyOptions.patterns.push({
from: path.join(trashBinariesPath, 'windows-trash.exe'),
to: path.resolve(__dirname, 'lib', 'backend'),
});
} else if (isMacOS) {
copyOptions.patterns.push({
from: path.join(trashBinariesPath, 'macos-trash'),
to: path.resolve(__dirname, 'lib', 'backend'),
});
}
}
return [
new CopyWebpackPlugin(copyOptions),
new PermissionsPlugin(targetPath, patchTheia12780),
new PermissionsPlugin(targetPath),
];
}

Expand Down
Loading
Loading