mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-15 21:29:27 +00:00
[ATL-1599] [ATL-1416] Upgrade Theia to 1.18.0 (#489)
Co-authored-by: Alberto Iannaccone <a.iannaccone@arduino.cc>
This commit is contained in:
committed by
Francesco Stasi
parent
54a67fc67c
commit
fc0f67493b
@@ -9,6 +9,7 @@ import {
|
||||
} from '@theia/core/lib/browser/connection-status-service';
|
||||
import {
|
||||
ApplicationShell as TheiaApplicationShell,
|
||||
Panel,
|
||||
Widget,
|
||||
} from '@theia/core/lib/browser';
|
||||
import { Sketch } from '../../../common/protocol';
|
||||
@@ -72,6 +73,13 @@ export class ApplicationShell extends TheiaApplicationShell {
|
||||
return super.addWidget(widget, { ...options, ref });
|
||||
}
|
||||
|
||||
// Avoid hiding top panel as we use it for arduino toolbar
|
||||
protected createTopPanel(): Panel {
|
||||
const topPanel = super.createTopPanel();
|
||||
topPanel.show();
|
||||
return topPanel;
|
||||
}
|
||||
|
||||
async saveAll(): Promise<void> {
|
||||
if (
|
||||
this.connectionStatusService.currentStatus === ConnectionStatus.OFFLINE
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
FileOperationError,
|
||||
FileOperationResult,
|
||||
} from '@theia/filesystem/lib/common/files';
|
||||
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
||||
|
||||
@injectable()
|
||||
export class DebugConfigurationManager extends TheiaDebugConfigurationManager {
|
||||
@@ -25,6 +26,9 @@ export class DebugConfigurationManager extends TheiaDebugConfigurationManager {
|
||||
@inject(FrontendApplicationStateService)
|
||||
protected readonly appStateService: FrontendApplicationStateService;
|
||||
|
||||
@inject(FileService)
|
||||
protected readonly fileService: FileService;
|
||||
|
||||
protected onTempContentDidChangeEmitter =
|
||||
new Emitter<TheiaDebugConfigurationModel.JsonContent>();
|
||||
get onTempContentDidChange(): Event<TheiaDebugConfigurationModel.JsonContent> {
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
import debounce from 'p-debounce';
|
||||
import {
|
||||
inject,
|
||||
injectable,
|
||||
postConstruct,
|
||||
interfaces,
|
||||
Container,
|
||||
} from 'inversify';
|
||||
import URI from '@theia/core/lib/common/uri';
|
||||
import {
|
||||
Disposable,
|
||||
DisposableCollection,
|
||||
} from '@theia/core/lib/common/disposable';
|
||||
import { MonacoConfigurationService } from '@theia/monaco/lib/browser/monaco-frontend-module';
|
||||
import { INLINE_VALUE_DECORATION_KEY } from '@theia/debug/lib/browser/editor//debug-inline-value-decorator';
|
||||
import { DebugEditor } from '@theia/debug/lib/browser/editor/debug-editor';
|
||||
import { DebugExceptionWidget } from '@theia/debug/lib/browser/editor/debug-exception-widget';
|
||||
import { DebugBreakpointWidget } from '@theia/debug/lib/browser/editor/debug-breakpoint-widget';
|
||||
import { DebugEditorModel as TheiaDebugEditorModel } from '@theia/debug/lib/browser/editor/debug-editor-model';
|
||||
import { createDebugHoverWidgetContainer } from './debug-hover-widget';
|
||||
|
||||
// TODO: Remove after https://github.com/eclipse-theia/theia/pull/9256/
|
||||
@injectable()
|
||||
export class DebugEditorModel extends TheiaDebugEditorModel {
|
||||
static createContainer(
|
||||
parent: interfaces.Container,
|
||||
editor: DebugEditor
|
||||
): Container {
|
||||
const child = createDebugHoverWidgetContainer(parent, editor);
|
||||
child.bind(DebugEditorModel).toSelf();
|
||||
child.bind(DebugBreakpointWidget).toSelf();
|
||||
child.bind(DebugExceptionWidget).toSelf();
|
||||
return child;
|
||||
}
|
||||
|
||||
static createModel(
|
||||
parent: interfaces.Container,
|
||||
editor: DebugEditor
|
||||
): DebugEditorModel {
|
||||
return DebugEditorModel.createContainer(parent, editor).get(
|
||||
DebugEditorModel
|
||||
);
|
||||
}
|
||||
|
||||
@inject(MonacoConfigurationService)
|
||||
readonly configurationService: monaco.services.IConfigurationService;
|
||||
|
||||
protected readonly toDisposeOnRenderFrames = new DisposableCollection();
|
||||
|
||||
@postConstruct()
|
||||
protected init(): void {
|
||||
this.toDispose.push(this.toDisposeOnRenderFrames);
|
||||
super.init();
|
||||
}
|
||||
|
||||
protected async updateEditorHover(): Promise<void> {
|
||||
if (this.isCurrentEditorFrame(this.uri)) {
|
||||
const codeEditor = this.editor.getControl();
|
||||
codeEditor.updateOptions({ hover: { enabled: false } });
|
||||
this.toDisposeOnRenderFrames.push(
|
||||
Disposable.create(() => {
|
||||
const model = codeEditor.getModel()!;
|
||||
const overrides = {
|
||||
resource: model.uri,
|
||||
overrideIdentifier: (model as any).getLanguageIdentifier().language,
|
||||
};
|
||||
const { enabled, delay, sticky } =
|
||||
this.configurationService._configuration.getValue(
|
||||
'editor.hover',
|
||||
overrides,
|
||||
undefined
|
||||
);
|
||||
codeEditor.updateOptions({
|
||||
hover: {
|
||||
enabled,
|
||||
delay,
|
||||
sticky,
|
||||
},
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private isCurrentEditorFrame(uri: URI): boolean {
|
||||
return (
|
||||
this.sessions.currentFrame?.source?.uri.toString() === uri.toString()
|
||||
);
|
||||
}
|
||||
|
||||
protected readonly renderFrames = debounce(async () => {
|
||||
if (this.toDispose.disposed) {
|
||||
return;
|
||||
}
|
||||
this.toDisposeOnRenderFrames.dispose();
|
||||
|
||||
this.toggleExceptionWidget();
|
||||
const [newFrameDecorations, inlineValueDecorations] = await Promise.all([
|
||||
this.createFrameDecorations(),
|
||||
this.createInlineValueDecorations(),
|
||||
]);
|
||||
const codeEditor = this.editor.getControl();
|
||||
codeEditor.removeDecorations(INLINE_VALUE_DECORATION_KEY);
|
||||
codeEditor.setDecorations(
|
||||
INLINE_VALUE_DECORATION_KEY,
|
||||
inlineValueDecorations
|
||||
);
|
||||
this.frameDecorations = this.deltaDecorations(
|
||||
this.frameDecorations,
|
||||
newFrameDecorations
|
||||
);
|
||||
this.updateEditorHover();
|
||||
}, 100);
|
||||
}
|
||||
17
arduino-ide-extension/src/browser/theia/dialogs/dialogs.ts
Normal file
17
arduino-ide-extension/src/browser/theia/dialogs/dialogs.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { injectable, inject } from 'inversify';
|
||||
|
||||
import {
|
||||
AbstractDialog as TheiaAbstractDialog,
|
||||
codiconArray,
|
||||
DialogProps,
|
||||
} from '@theia/core/lib/browser';
|
||||
|
||||
@injectable()
|
||||
export abstract class AbstractDialog<T> extends TheiaAbstractDialog<T> {
|
||||
constructor(@inject(DialogProps) protected readonly props: DialogProps) {
|
||||
super(props);
|
||||
|
||||
this.closeCrossNode.classList.remove(...codiconArray('close'));
|
||||
this.closeCrossNode.classList.add('fa', 'fa-close');
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,21 @@
|
||||
import { injectable } from 'inversify';
|
||||
import { EditorContribution as TheiaEditorContribution } from '@theia/editor/lib/browser/editor-contribution';
|
||||
import { EditorPreviewContribution as TheiaEditorPreviewContribution } from '@theia/editor-preview/lib/browser/editor-preview-contribution';
|
||||
import { TextEditor } from '@theia/editor/lib/browser';
|
||||
import { StatusBarAlignment } from '@theia/core/lib/browser';
|
||||
|
||||
@injectable()
|
||||
export class EditorContribution extends TheiaEditorContribution {
|
||||
export class EditorPreviewContribution extends TheiaEditorPreviewContribution {
|
||||
protected updateLanguageStatus(editor: TextEditor | undefined): void {}
|
||||
|
||||
protected setCursorPositionStatus(editor: TextEditor | undefined): void {
|
||||
if (!editor) {
|
||||
this.statusBar.removeElement('editor-status-cursor-position');
|
||||
return;
|
||||
}
|
||||
const { cursor } = editor;
|
||||
this.statusBar.setElement('editor-status-cursor-position', {
|
||||
text: `${cursor.line + 1}`,
|
||||
alignment: StatusBarAlignment.LEFT,
|
||||
priority: 100,
|
||||
});
|
||||
}
|
||||
// protected setCursorPositionStatus(editor: TextEditor | undefined): void {
|
||||
// if (!editor) {
|
||||
// this.statusBar.removeElement('editor-status-cursor-position');
|
||||
// return;
|
||||
// }
|
||||
// const { cursor } = editor;
|
||||
// this.statusBar.setElement('editor-status-cursor-position', {
|
||||
// text: `${cursor.line + 1}`,
|
||||
// alignment: StatusBarAlignment.LEFT,
|
||||
// priority: 100,
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { injectable } from 'inversify';
|
||||
import URI from '@theia/core/lib/common/uri';
|
||||
import { MEMORY_TEXT } from '@theia/search-in-workspace/lib/browser/in-memory-text-resource';
|
||||
import {
|
||||
SearchInWorkspaceFileNode,
|
||||
SearchInWorkspaceResultTreeWidget as TheiaSearchInWorkspaceResultTreeWidget,
|
||||
} from '@theia/search-in-workspace/lib/browser/search-in-workspace-result-tree-widget';
|
||||
import { MEMORY_TEXT } from '@theia/core/lib/common/resource';
|
||||
|
||||
/**
|
||||
* Workaround for https://github.com/eclipse-theia/theia/pull/9192/.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { injectable } from 'inversify';
|
||||
import { injectable, postConstruct } from 'inversify';
|
||||
import * as React from 'react';
|
||||
import { Key, KeyCode } from '@theia/core/lib/browser';
|
||||
import { SearchInWorkspaceWidget as TheiaSearchInWorkspaceWidget } from '@theia/search-in-workspace/lib/browser/search-in-workspace-widget';
|
||||
@@ -8,6 +8,12 @@ import { SearchInWorkspaceWidget as TheiaSearchInWorkspaceWidget } from '@theia/
|
||||
*/
|
||||
@injectable()
|
||||
export class SearchInWorkspaceWidget extends TheiaSearchInWorkspaceWidget {
|
||||
@postConstruct()
|
||||
protected init(): void {
|
||||
super.init();
|
||||
this.title.iconClass = 'fa fa-arduino-search';
|
||||
}
|
||||
|
||||
protected renderGlobField(kind: 'include' | 'exclude'): React.ReactNode {
|
||||
const currentValue = this.searchInWorkspaceOptions[kind];
|
||||
const value = (currentValue && currentValue.join(', ')) || '';
|
||||
|
||||
Reference in New Issue
Block a user