mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-10 04:46:33 +00:00
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:
parent
fc0f67493b
commit
846c22cb03
@ -87,7 +87,7 @@ export class SketchControl extends SketchContribution {
|
|||||||
currentSketch &&
|
currentSketch &&
|
||||||
parentsketch &&
|
parentsketch &&
|
||||||
parentsketch.uri === currentSketch.uri &&
|
parentsketch.uri === currentSketch.uri &&
|
||||||
(await this.allowRename(parentsketch.uri))
|
this.allowRename(parentsketch.uri)
|
||||||
) {
|
) {
|
||||||
this.menuRegistry.registerMenuAction(
|
this.menuRegistry.registerMenuAction(
|
||||||
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
||||||
@ -124,7 +124,7 @@ export class SketchControl extends SketchContribution {
|
|||||||
currentSketch &&
|
currentSketch &&
|
||||||
parentsketch &&
|
parentsketch &&
|
||||||
parentsketch.uri === currentSketch.uri &&
|
parentsketch.uri === currentSketch.uri &&
|
||||||
(await this.allowDelete(parentsketch.uri))
|
this.allowDelete(parentsketch.uri)
|
||||||
) {
|
) {
|
||||||
this.menuRegistry.registerMenuAction(
|
this.menuRegistry.registerMenuAction(
|
||||||
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP,
|
||||||
@ -249,20 +249,24 @@ export class SketchControl extends SketchContribution {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async isCloudSketch(uri: string) {
|
protected isCloudSketch(uri: string): boolean {
|
||||||
const cloudCacheLocation = this.localCacheFsProvider.from(new URI(uri));
|
try {
|
||||||
|
const cloudCacheLocation = this.localCacheFsProvider.from(new URI(uri));
|
||||||
|
|
||||||
if (cloudCacheLocation) {
|
if (cloudCacheLocation) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async allowRename(uri: string) {
|
protected allowRename(uri: string): boolean {
|
||||||
return !this.isCloudSketch(uri);
|
return !this.isCloudSketch(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async allowDelete(uri: string) {
|
protected allowDelete(uri: string): boolean {
|
||||||
return !this.isCloudSketch(uri);
|
return !this.isCloudSketch(uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,3 +4,7 @@
|
|||||||
background-size: 13px;
|
background-size: 13px;
|
||||||
background-image: var(--theia-icon-circle);
|
background-image: var(--theia-icon-circle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.monaco-list-row.show-file-icons.focused {
|
||||||
|
background-color: #d6ebff;
|
||||||
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ testLines.forEach((t) =>
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
describe.only('Monitor Utils', () => {
|
describe('Monitor Utils', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
set(date);
|
set(date);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user