Skip to content

Commit a592b87

Browse files
author
Jackson Kearl
committed
Properly implement onDidChangeContent (may be overridden by further refactorings, but simple enough so implementing here for now.) Fixes microsoft#89265.
1 parent 5a762cf commit a592b87

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/vs/workbench/contrib/search/browser/searchEditorInput.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { assertIsDefined } from 'vs/base/common/types';
2828
import { extractSearchQuery, serializeSearchConfiguration } from 'vs/workbench/contrib/search/browser/searchEditorSerialization';
2929
import type { ICodeEditorViewState } from 'vs/editor/common/editorCommon';
3030
import { IFilesConfigurationService, AutoSaveMode } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
31+
import { Emitter, Event } from 'vs/base/common/event';
3132

3233
export type SearchConfiguration = {
3334
query: string,
@@ -54,6 +55,9 @@ export class SearchEditorInput extends EditorInput {
5455
private readonly model: Promise<ITextModel>;
5556
private query: Partial<SearchConfiguration> | undefined;
5657

58+
private readonly _onDidChangeContent = new Emitter<void>();
59+
readonly onDidChangeContent: Event<void> = this._onDidChangeContent.event;
60+
5761
viewState: SearchEditorViewState = { focused: 'input' };
5862

5963
constructor(
@@ -72,15 +76,19 @@ export class SearchEditorInput extends EditorInput {
7276
) {
7377
super();
7478

75-
this.model = getModel();
79+
this.model = getModel()
80+
.then(model => {
81+
this._register(model.onDidChangeContent(() => this._onDidChangeContent.fire()));
82+
return model;
83+
});
7684

7785
const input = this;
7886
const workingCopyAdapter = new class implements IWorkingCopy {
7987
readonly resource = input.getResource();
8088
get name() { return input.getName(); }
8189
readonly capabilities = input.isUntitled() ? WorkingCopyCapabilities.Untitled : 0;
8290
readonly onDidChangeDirty = input.onDidChangeDirty;
83-
readonly onDidChangeContent = input.onDidChangeDirty;
91+
readonly onDidChangeContent = input.onDidChangeContent;
8492
isDirty(): boolean { return input.isDirty(); }
8593
backup(): Promise<IWorkingCopyBackup> { return input.backup(); }
8694
save(options?: ISaveOptions): Promise<boolean> { return input.save(0, options).then(editor => !!editor); }

0 commit comments

Comments
 (0)