Skip to content

Theia 18 hotfixes #528

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 4 commits into from
Oct 6, 2021
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
22 changes: 13 additions & 9 deletions arduino-ide-extension/src/browser/contributions/sketch-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
}
Expand Down
4 changes: 4 additions & 0 deletions arduino-ide-extension/src/browser/style/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
background-size: 13px;
background-image: var(--theia-icon-circle);
}

.monaco-list-row.show-file-icons.focused {
background-color: #d6ebff;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ testLines.forEach((t) =>
)
);

describe.only('Monitor Utils', () => {
describe('Monitor Utils', () => {
beforeEach(() => {
set(date);
});
Expand Down