ATL-222: Moved the language feature to a VS Code extension.

Updated to next Theia: 1.6.0-next.b43a1623.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta
2020-09-08 13:15:55 +02:00
committed by Akos Kitta
parent fbebfc7cca
commit f26dae185b
30 changed files with 1368 additions and 3575 deletions

View File

@@ -1,5 +1,5 @@
import { injectable, inject } from 'inversify';
import { FileSystem } from '@theia/filesystem/lib/common/filesystem';
import { FileService } from '@theia/filesystem/lib/browser/file-service';
import { CommandService } from '@theia/core/lib/common/command';
import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
import { FrontendApplication as TheiaFrontendApplication } from '@theia/core/lib/browser/frontend-application';
@@ -8,8 +8,8 @@ import { ArduinoCommands } from '../../arduino-commands';
@injectable()
export class FrontendApplication extends TheiaFrontendApplication {
@inject(FileSystem)
protected readonly fileSystem: FileSystem;
@inject(FileService)
protected readonly fileService: FileService;
@inject(WorkspaceService)
protected readonly workspaceService: WorkspaceService;
@@ -21,9 +21,9 @@ export class FrontendApplication extends TheiaFrontendApplication {
await super.initializeLayout();
const roots = await this.workspaceService.roots;
for (const root of roots) {
const exists = await this.fileSystem.exists(root.uri);
const exists = await this.fileService.exists(root.resource);
if (exists) {
await this.commandService.executeCommand(ArduinoCommands.OPEN_SKETCH_FILES.id, root.uri);
await this.commandService.executeCommand(ArduinoCommands.OPEN_SKETCH_FILES.id, root.resource);
}
}
}

View File

@@ -1,11 +1,11 @@
import { inject, injectable, postConstruct } from 'inversify';
import URI from '@theia/core/lib/common/uri';
import { Title, Widget } from '@phosphor/widgets';
import { ILogger } from '@theia/core';
import { ILogger } from '@theia/core/lib/common/logger';
import { EditorWidget } from '@theia/editor/lib/browser';
import { WidgetDecoration } from '@theia/core/lib/browser/widget-decoration';
import { TabBarDecoratorService as TheiaTabBarDecoratorService } from '@theia/core/lib/browser/shell/tab-bar-decorator';
import { ConfigService } from '../../../common/protocol/config-service';
import { EditorWidget } from '@theia/editor/lib/browser';
@injectable()
export class TabBarDecoratorService extends TheiaTabBarDecoratorService {
@@ -20,7 +20,6 @@ export class TabBarDecoratorService extends TheiaTabBarDecoratorService {
@postConstruct()
protected init(): void {
super.init();
this.configService.getConfiguration()
.then(({ dataDirUri }) => this.dataDirUri = new URI(dataDirUri))
.catch(err => this.logger.error(`Failed to determine the data directory: ${err}`));

View File

@@ -0,0 +1,29 @@
import { injectable } from 'inversify';
import { Resource } from '@theia/core/lib/common/resource';
import { MaybePromise } from '@theia/core/lib/common/types';
import { Log, Loggable } from '@theia/core/lib/common/logger';
import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
import { MonacoTextModelService as TheiaMonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service';
@injectable()
export class MonacoTextModelService extends TheiaMonacoTextModelService {
protected createModel(resource: Resource): MaybePromise<MonacoEditorModel> {
const factory = this.factories.getContributions().find(({ scheme }) => resource.uri.scheme === scheme);
return factory ? factory.createModel(resource) : new SilentMonacoEditorModel(resource, this.m2p, this.p2m, this.logger);
}
}
// https://github.com/eclipse-theia/theia/pull/8491
export class SilentMonacoEditorModel extends MonacoEditorModel {
protected trace(loggable: Loggable): void {
if (this.logger) {
this.logger.trace((log: Log) =>
loggable((message, ...params) => log(message, ...params, this.resource.uri.toString(true)))
);
}
}
}

View File

@@ -1,7 +1,7 @@
import { inject, injectable } from 'inversify';
import URI from '@theia/core/lib/common/uri';
import { open } from '@theia/core/lib/browser/opener-service';
import { FileStat } from '@theia/filesystem/lib/common';
import { FileStat } from '@theia/filesystem/lib/common/files';
import { CommandRegistry, CommandService } from '@theia/core/lib/common/command';
import { WorkspaceCommandContribution as TheiaWorkspaceCommandContribution, WorkspaceCommands } from '@theia/workspace/lib/browser/workspace-commands';
import { Sketch } from '../../../common/protocol';
@@ -40,7 +40,7 @@ export class WorkspaceCommandContribution extends TheiaWorkspaceCommandContribut
return;
}
const parentUri = new URI(parent.uri);
const parentUri = parent.resource;
const dialog = new WorkspaceInputDialog({
title: 'Name for new file',
parentUri,
@@ -51,7 +51,7 @@ export class WorkspaceCommandContribution extends TheiaWorkspaceCommandContribut
const nameWithExt = this.maybeAppendInoExt(name);
if (nameWithExt) {
const fileUri = parentUri.resolve(nameWithExt);
await this.fileSystem.createFile(fileUri.toString());
await this.fileService.createFile(fileUri);
this.fireCreateNewFile({ parent: parentUri, uri: fileUri });
open(this.openerService, fileUri);
}
@@ -132,7 +132,7 @@ export class WorkspaceCommandContribution extends TheiaWorkspaceCommandContribut
if (newNameWithExt) {
const oldUri = uri;
const newUri = uri.parent.resolve(newNameWithExt);
this.fileSystem.move(oldUri.toString(), newUri.toString());
this.fileService.move(oldUri, newUri);
}
}

View File

@@ -25,7 +25,7 @@ export class WorkspaceDeleteHandler extends TheiaWorkspaceDeleteHandler {
});
if (response === 1) { // OK
await Promise.all([...sketch.additionalFileUris, ...sketch.otherSketchFileUris, sketch.mainFileUri].map(uri => this.closeWithoutSaving(new URI(uri))));
await this.fileSystem.delete(sketch.uri);
await this.fileService.delete(new URI(sketch.uri));
window.close();
}
return;

View File

@@ -74,7 +74,7 @@ export class WorkspaceService extends TheiaWorkspaceService {
}
private async isValid(uri: string): Promise<boolean> {
const exists = await this.fileSystem.exists(uri);
const exists = await this.fileService.exists(new URI(uri));
if (!exists) {
return false;
}
@@ -104,8 +104,7 @@ export class WorkspaceService extends TheiaWorkspaceService {
protected get workspaceTitle(): string | undefined {
if (this.workspace) {
const uri = new URI(this.workspace.uri);
return this.labelProvider.getName(uri);
return this.labelProvider.getName(this.workspace.resource);
}
}