feat: use new debug -I -P CLI output

- Can pick a programmer if missing,
 - Can auto-select a programmer on app start,
 - Can edit the `launch.json`,
 - Adjust board discovery to new gRPC API. From now on, it's a client
 read stream, not a duplex.
 - Allow `.cxx` and `.cc` file extensions. (Closes #2265)
 - Drop `debuggingSupported` from `BoardDetails`.
 - Dedicated service endpoint for checking the debugger.

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
Akos Kitta
2023-11-08 12:04:44 +01:00
committed by Akos Kitta
parent 42bf1a0e99
commit 73b6dc4774
48 changed files with 4697 additions and 3041 deletions

View File

@@ -1,17 +1,20 @@
import { inject, injectable } from '@theia/core/shared/inversify';
import URI from '@theia/core/lib/common/uri';
import { LOCKED_CLASS, lock } from '@theia/core/lib/browser/widgets/widget';
import {
Disposable,
DisposableCollection,
} from '@theia/core/lib/common/disposable';
import URI from '@theia/core/lib/common/uri';
import { Title, Widget } from '@theia/core/shared/@phosphor/widgets';
import { inject, injectable } from '@theia/core/shared/inversify';
import { EditorWidget } from '@theia/editor/lib/browser/editor-widget';
import * as monaco from '@theia/monaco-editor-core';
import type { ReferencesModel } from '@theia/monaco-editor-core/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel';
import {
EditorServiceOverrides,
MonacoEditor,
} from '@theia/monaco/lib/browser/monaco-editor';
import { MonacoEditorProvider as TheiaMonacoEditorProvider } from '@theia/monaco/lib/browser/monaco-editor-provider';
import { SketchesServiceClientImpl } from '../../sketches-service-client-impl';
import * as monaco from '@theia/monaco-editor-core';
import type { ReferencesModel } from '@theia/monaco-editor-core/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel';
type CancelablePromise = Promise<ReferencesModel> & {
cancel: () => void;
@@ -101,3 +104,30 @@ export class MonacoEditorProvider extends TheiaMonacoEditorProvider {
editor.updateOptions({ readOnly });
}
}
// Theia cannot dynamically set an editor to writable once it was readonly.
export function maybeUpdateReadOnlyState(
widget: EditorWidget,
isReadOnly: (uri: string | URI | monaco.Uri) => boolean
): void {
const editor = widget.editor;
if (!(editor instanceof MonacoEditor)) {
return;
}
const model = editor.document;
const oldReadOnly = model.readOnly;
const resource = model['resource'];
const newReadOnly = Boolean(resource.isReadonly) || isReadOnly(resource.uri);
if (oldReadOnly !== newReadOnly) {
editor.getControl().updateOptions({ readOnly: newReadOnly });
if (newReadOnly) {
lock(widget.title);
} else {
unlock(widget.title);
}
}
}
function unlock(title: Title<Widget>): void {
title.className = title.className.replace(LOCKED_CLASS, '').trim();
}

View File

@@ -77,7 +77,7 @@ class MaybeReadonlyMonacoEditorModel extends SilentMonacoEditorModel {
}
this._dirty = dirty;
if (dirty === false) {
(this as any).updateSavedVersionId();
this['updateSavedVersionId']();
}
this.onDirtyChangedEmitter.fire(undefined);
}