mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-12 19:59:27 +00:00
chore: updated to Theia 1.37.0
- Updated `@theia/*` to `1.37.0`. - Fixed all `yarn audit` security vulnerabilities. - Updated to `electron@23.2.4`: - `contextIsolation` is `true`, - `nodeIntegration` is `false`, and the - `webpack` target is moved from `electron-renderer` to `web`. - Updated to `typescript@4.9.3`. - Updated the `eslint` plugins. - Added the new `Light High Contrast` theme to the IDE2. - High contrast themes use Theia APIs for style adjustments. - Support for ESM modules: `"moduleResolution": "node16"`. - Node.js >= 16.14 is required. - VISX langage packs were bumped to `1.70.0`. - Removed undesired editor context menu items. (Closes #1394) Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { ResourceSaveOptions } from '@theia/core/lib/common/resource';
|
||||
import { Readable } from '@theia/core/lib/common/stream';
|
||||
import URI from '@theia/core/lib/common/uri';
|
||||
import { injectable } from '@theia/core/shared/inversify';
|
||||
import {
|
||||
@@ -11,14 +9,13 @@ import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
||||
import {
|
||||
FileOperationError,
|
||||
FileOperationResult,
|
||||
FileStat,
|
||||
} from '@theia/filesystem/lib/common/files';
|
||||
import * as PQueue from 'p-queue';
|
||||
import PQueue from 'p-queue';
|
||||
|
||||
@injectable()
|
||||
export class FileResourceResolver extends TheiaFileResourceResolver {
|
||||
override async resolve(uri: URI): Promise<WriteQueuedFileResource> {
|
||||
let stat: FileStat | undefined;
|
||||
let stat;
|
||||
try {
|
||||
stat = await this.fileService.resolve(uri);
|
||||
} catch (e) {
|
||||
@@ -37,6 +34,7 @@ export class FileResourceResolver extends TheiaFileResourceResolver {
|
||||
);
|
||||
}
|
||||
return new WriteQueuedFileResource(uri, this.fileService, {
|
||||
isReadonly: stat?.isReadonly ?? false,
|
||||
shouldOverwrite: () => this.shouldOverwrite(uri),
|
||||
shouldOpenAsText: (error) => this.shouldOpenAsText(uri, error),
|
||||
});
|
||||
@@ -52,23 +50,32 @@ class WriteQueuedFileResource extends FileResource {
|
||||
options: FileResourceOptions
|
||||
) {
|
||||
super(uri, fileService, options);
|
||||
const originalDoWrite = this['doWrite'];
|
||||
this['doWrite'] = (content, options) =>
|
||||
this.writeQueue.add(() => originalDoWrite.bind(this)(content, options));
|
||||
const originalSaveStream = this['saveStream'];
|
||||
if (originalSaveStream) {
|
||||
this['saveStream'] = (content, options) =>
|
||||
this.writeQueue.add(() =>
|
||||
originalSaveStream.bind(this)(content, options)
|
||||
);
|
||||
}
|
||||
const originalSaveContents = this['saveContents'];
|
||||
if (originalSaveContents) {
|
||||
this['saveContents'] = (content, options) =>
|
||||
this.writeQueue.add(() =>
|
||||
originalSaveContents.bind(this)(content, options)
|
||||
);
|
||||
}
|
||||
const originalSaveContentChanges = this['saveContentChanges'];
|
||||
if (originalSaveContentChanges) {
|
||||
this['saveContentChanges'] = (changes, options) => {
|
||||
return this.writeQueue.add(() =>
|
||||
this['saveContentChanges'] = (changes, options) =>
|
||||
this.writeQueue.add(() =>
|
||||
originalSaveContentChanges.bind(this)(changes, options)
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
protected override async doWrite(
|
||||
content: string | Readable<string>,
|
||||
options?: ResourceSaveOptions
|
||||
): Promise<void> {
|
||||
return this.writeQueue.add(() => super.doWrite(content, options));
|
||||
}
|
||||
|
||||
protected override async isInSync(): Promise<boolean> {
|
||||
// Let all the write operations finish to update the version (mtime) before checking whether the resource is in sync.
|
||||
// https://github.com/eclipse-theia/theia/issues/12327
|
||||
|
||||
Reference in New Issue
Block a user