diff --git a/packages/debug/src/browser/editor/debug-breakpoint-widget.tsx b/packages/debug/src/browser/editor/debug-breakpoint-widget.tsx index e7e535047dae6..9b3c2968319a8 100644 --- a/packages/debug/src/browser/editor/debug-breakpoint-widget.tsx +++ b/packages/debug/src/browser/editor/debug-breakpoint-widget.tsx @@ -25,6 +25,7 @@ import { MonacoEditorZoneWidget } from '@theia/monaco/lib/browser/monaco-editor- import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor'; import { DebugEditor } from './debug-editor'; import { DebugSourceBreakpoint } from '../model/debug-source-breakpoint'; +import { Dimension } from '@theia/editor/lib/browser'; export type ShowDebugBreakpointOptions = DebugSourceBreakpoint | { position: monaco.Position, @@ -69,6 +70,16 @@ export class DebugBreakpointWidget implements Disposable { get input(): MonacoEditor | undefined { return this._input; } + // eslint-disable-next-line no-null/no-null + set inputSize(dimension: Dimension | null) { + if (this._input) { + if (dimension) { + this._input.setSize(dimension); + } else { + this._input.resizeToFit(); + } + } + } @postConstruct() protected async init(): Promise { diff --git a/packages/debug/src/browser/editor/debug-editor-model.ts b/packages/debug/src/browser/editor/debug-editor-model.ts index 39c7fdc9490b0..032d6f0f51534 100644 --- a/packages/debug/src/browser/editor/debug-editor-model.ts +++ b/packages/debug/src/browser/editor/debug-editor-model.ts @@ -105,6 +105,7 @@ export class DebugEditorModel implements Disposable { this.editor.getControl().onKeyDown(() => this.hover.hide({ immediate: false })), this.editor.getControl().onDidChangeModelContent(() => this.update()), this.editor.getControl().getModel()!.onDidChangeDecorations(() => this.updateBreakpoints()), + this.editor.onDidResize(e => this.breakpointWidget.inputSize = e), this.sessions.onDidChange(() => this.update()), this.toDisposeOnUpdate ]); diff --git a/packages/monaco/src/browser/monaco-editor.ts b/packages/monaco/src/browser/monaco-editor.ts index 0da85e5d4e71c..0499900857db8 100644 --- a/packages/monaco/src/browser/monaco-editor.ts +++ b/packages/monaco/src/browser/monaco-editor.ts @@ -84,6 +84,9 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor { readonly onLanguageChanged = this.onLanguageChangedEmitter.event; protected readonly onScrollChangedEmitter = new Emitter(); readonly onEncodingChanged = this.document.onDidChangeEncoding; + // eslint-disable-next-line no-null/no-null + protected readonly onResizeEmitter = new Emitter(); + readonly onDidResize = this.onResizeEmitter.event; readonly documents = new Set(); @@ -340,10 +343,13 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor { resizeToFit(): void { this.autoresize(); + // eslint-disable-next-line no-null/no-null + this.onResizeEmitter.fire(null); } setSize(dimension: Dimension): void { this.resize(dimension); + this.onResizeEmitter.fire(dimension); } protected autoresize(): void {