mirror of
https://github.com/Microsoft/vscode
synced 2024-08-26 20:39:37 +00:00
Remove unused events
This commit is contained in:
parent
72ef0f3977
commit
a9002ffa96
|
@ -1153,13 +1153,6 @@ export interface ITextModel {
|
|||
* @event
|
||||
*/
|
||||
readonly onDidChangeContentOrInjectedText: Event<ModelRawContentChangedEvent | ModelInjectedTextChangedEvent>;
|
||||
/**
|
||||
* @deprecated Please use `onDidChangeContent` instead.
|
||||
* An event emitted when the contents of the model have changed.
|
||||
* @internal
|
||||
* @event
|
||||
*/
|
||||
readonly onDidChangeRawContent: Event<ModelRawContentChangedEvent>;
|
||||
/**
|
||||
* An event emitted when the contents of the model have changed.
|
||||
* @event
|
||||
|
|
|
@ -245,12 +245,6 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
|
|||
private readonly _onDidChangeInjectedText: Emitter<ModelInjectedTextChangedEvent> = this._register(new Emitter<ModelInjectedTextChangedEvent>());
|
||||
|
||||
private readonly _eventEmitter: DidChangeContentEmitter = this._register(new DidChangeContentEmitter());
|
||||
public onDidChangeRawContent(listener: (e: ModelRawContentChangedEvent) => void): IDisposable {
|
||||
return this._eventEmitter.slowEvent((e: InternalModelContentChangeEvent) => listener(e.rawContentChangedEvent));
|
||||
}
|
||||
public onDidChangeContentFast(listener: (e: IModelContentChangedEvent) => void): IDisposable {
|
||||
return this._eventEmitter.fastEvent((e: InternalModelContentChangeEvent) => listener(e.contentChangedEvent));
|
||||
}
|
||||
public onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable {
|
||||
return this._eventEmitter.slowEvent((e: InternalModelContentChangeEvent) => listener(e.contentChangedEvent));
|
||||
}
|
||||
|
|
|
@ -993,7 +993,7 @@ suite('EditorModel - EditableTextModel.applyEdits', () => {
|
|||
|
||||
}, (model) => {
|
||||
let isFirstTime = true;
|
||||
model.onDidChangeRawContent(() => {
|
||||
model.onDidChangeContent(() => {
|
||||
if (!isFirstTime) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import { EditOperation } from 'vs/editor/common/core/editOperation';
|
|||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { ModelRawContentChangedEvent, ModelRawFlush, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted } from 'vs/editor/common/textModelEvents';
|
||||
import { ModelInjectedTextChangedEvent, ModelRawContentChangedEvent, ModelRawFlush, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted } from 'vs/editor/common/textModelEvents';
|
||||
import { EncodedTokenizationResult, IState, MetadataConsts, TokenizationRegistry } from 'vs/editor/common/languages';
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/languages/languageConfigurationRegistry';
|
||||
import { NullState } from 'vs/editor/common/languages/nullTokenize';
|
||||
|
@ -96,15 +96,15 @@ suite('Editor Model - Model', () => {
|
|||
// --------- insert text eventing
|
||||
|
||||
test('model insert empty text does not trigger eventing', () => {
|
||||
thisModel.onDidChangeRawContent((e) => {
|
||||
thisModel.onDidChangeContentOrInjectedText((e) => {
|
||||
assert.ok(false, 'was not expecting event');
|
||||
});
|
||||
thisModel.applyEdits([EditOperation.insert(new Position(1, 1), '')]);
|
||||
});
|
||||
|
||||
test('model insert text without newline eventing', () => {
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
|
||||
thisModel.onDidChangeContentOrInjectedText((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ suite('Editor Model - Model', () => {
|
|||
});
|
||||
|
||||
test('model insert text with one newline eventing', () => {
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
|
||||
thisModel.onDidChangeContentOrInjectedText((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
|
@ -192,15 +192,15 @@ suite('Editor Model - Model', () => {
|
|||
// --------- delete text eventing
|
||||
|
||||
test('model delete empty text does not trigger eventing', () => {
|
||||
thisModel.onDidChangeRawContent((e) => {
|
||||
thisModel.onDidChangeContentOrInjectedText((e) => {
|
||||
assert.ok(false, 'was not expecting event');
|
||||
});
|
||||
thisModel.applyEdits([EditOperation.delete(new Range(1, 1, 1, 1))]);
|
||||
});
|
||||
|
||||
test('model delete text from one line eventing', () => {
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
|
||||
thisModel.onDidChangeContentOrInjectedText((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
|
@ -218,8 +218,8 @@ suite('Editor Model - Model', () => {
|
|||
});
|
||||
|
||||
test('model delete all text from a line eventing', () => {
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
|
||||
thisModel.onDidChangeContentOrInjectedText((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
|
@ -237,8 +237,8 @@ suite('Editor Model - Model', () => {
|
|||
});
|
||||
|
||||
test('model delete text from two lines eventing', () => {
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
|
||||
thisModel.onDidChangeContentOrInjectedText((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
|
@ -257,8 +257,8 @@ suite('Editor Model - Model', () => {
|
|||
});
|
||||
|
||||
test('model delete text from many lines eventing', () => {
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
|
||||
thisModel.onDidChangeContentOrInjectedText((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
|
@ -308,8 +308,8 @@ suite('Editor Model - Model', () => {
|
|||
|
||||
// --------- setValue
|
||||
test('setValue eventing', () => {
|
||||
let e: ModelRawContentChangedEvent | null = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
|
||||
thisModel.onDidChangeContentOrInjectedText((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue