Theia 18 hotfixes (#528)

* Restore monaco suggestion highlights

* remove duplicated tabs on startup

* fix rename and delete sketch

* remove '.only(...)' in tests

Co-authored-by: Alberto Iannaccone <a.iannaccone@arduino.cc>
This commit is contained in:
Francesco Stasi 2021-10-06 17:50:02 +02:00 committed by GitHub
parent fc0f67493b
commit 846c22cb03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 10 deletions

View File

@ -87,7 +87,7 @@ export class SketchControl extends SketchContribution {
currentSketch &&
parentsketch &&
parentsketch.uri === currentSketch.uri &&
(await this.allowRename(parentsketch.uri))
this.allowRename(parentsketch.uri)
) {
this.menuRegistry.registerMenuAction(
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
@ -124,7 +124,7 @@ export class SketchControl extends SketchContribution {
currentSketch &&
parentsketch &&
parentsketch.uri === currentSketch.uri &&
(await this.allowDelete(parentsketch.uri))
this.allowDelete(parentsketch.uri)
) {
this.menuRegistry.registerMenuAction(
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
@ -249,20 +249,24 @@ export class SketchControl extends SketchContribution {
});
}
protected async isCloudSketch(uri: string) {
const cloudCacheLocation = this.localCacheFsProvider.from(new URI(uri));
protected isCloudSketch(uri: string): boolean {
try {
const cloudCacheLocation = this.localCacheFsProvider.from(new URI(uri));
if (cloudCacheLocation) {
return true;
if (cloudCacheLocation) {
return true;
}
return false;
} catch {
return false;
}
return false;
}
protected async allowRename(uri: string) {
protected allowRename(uri: string): boolean {
return !this.isCloudSketch(uri);
}
protected async allowDelete(uri: string) {
protected allowDelete(uri: string): boolean {
return !this.isCloudSketch(uri);
}
}

View File

@ -4,3 +4,7 @@
background-size: 13px;
background-image: var(--theia-icon-circle);
}
.monaco-list-row.show-file-icons.focused {
background-color: #d6ebff;
}

View File

@ -22,4 +22,30 @@ export class ShellLayoutRestorer extends TheiaShellLayoutRestorer {
}
}
}
async restoreLayout(app: FrontendApplication): Promise<boolean> {
this.logger.info('>>> Restoring the layout state...');
const serializedLayoutData = await this.storageService.getData<string>(
this.storageKey
);
if (serializedLayoutData === undefined) {
this.logger.info('<<< Nothing to restore.');
return false;
}
const layoutData = await this.inflate(serializedLayoutData);
// workaround to remove duplicated tabs
if ((layoutData as any)?.mainPanel?.main?.widgets) {
(layoutData as any).mainPanel.main.widgets = (
layoutData as any
).mainPanel.main.widgets.filter(
(widget: any) =>
widget.constructionOptions.factoryId !== 'code-editor-opener'
);
}
await app.shell.setLayoutData(layoutData);
this.logger.info('<<< The layout has been successfully restored.');
return true;
}
}

View File

@ -125,7 +125,7 @@ testLines.forEach((t) =>
)
);
describe.only('Monitor Utils', () => {
describe('Monitor Utils', () => {
beforeEach(() => {
set(date);
});