mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
Merge pull request #124996 from microsoft/hediet/isUndoRedo
Forwards the isUndoing/isRedoing flags to the extension host.
This commit is contained in:
@@ -1239,6 +1239,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
TextEditorLineNumbersStyle: extHostTypes.TextEditorLineNumbersStyle,
|
||||
TextEditorRevealType: extHostTypes.TextEditorRevealType,
|
||||
TextEditorSelectionChangeKind: extHostTypes.TextEditorSelectionChangeKind,
|
||||
TextDocumentChangeReason: extHostTypes.TextDocumentChangeReason,
|
||||
ThemeColor: extHostTypes.ThemeColor,
|
||||
ThemeIcon: extHostTypes.ThemeIcon,
|
||||
TreeItem: extHostTypes.TreeItem,
|
||||
|
||||
@@ -14,6 +14,7 @@ import * as TypeConverters from 'vs/workbench/api/common/extHostTypeConverters';
|
||||
import type * as vscode from 'vscode';
|
||||
import { assertIsDefined } from 'vs/base/common/types';
|
||||
import { deepFreeze } from 'vs/base/common/objects';
|
||||
import { TextDocumentChangeReason } from 'vs/workbench/api/common/extHostTypes';
|
||||
|
||||
export class ExtHostDocuments implements ExtHostDocumentsShape {
|
||||
|
||||
@@ -134,7 +135,8 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
|
||||
data._acceptIsDirty(isDirty);
|
||||
this._onDidChangeDocument.fire({
|
||||
document: data.document,
|
||||
contentChanges: []
|
||||
contentChanges: [],
|
||||
reason: undefined
|
||||
});
|
||||
}
|
||||
|
||||
@@ -146,6 +148,14 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
|
||||
}
|
||||
data._acceptIsDirty(isDirty);
|
||||
data.onEvents(events);
|
||||
|
||||
let reason: vscode.TextDocumentChangeReason | undefined = undefined;
|
||||
if (events.isUndoing) {
|
||||
reason = TextDocumentChangeReason.Undo;
|
||||
} else if (events.isRedoing) {
|
||||
reason = TextDocumentChangeReason.Redo;
|
||||
}
|
||||
|
||||
this._onDidChangeDocument.fire(deepFreeze({
|
||||
document: data.document,
|
||||
contentChanges: events.changes.map((change) => {
|
||||
@@ -155,7 +165,8 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
|
||||
rangeLength: change.rangeLength,
|
||||
text: change.text
|
||||
};
|
||||
})
|
||||
}),
|
||||
reason
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -1590,6 +1590,11 @@ export enum TextEditorSelectionChangeKind {
|
||||
Command = 3
|
||||
}
|
||||
|
||||
export enum TextDocumentChangeReason {
|
||||
Undo = 1,
|
||||
Redo = 2,
|
||||
}
|
||||
|
||||
/**
|
||||
* These values match very carefully the values of `TrackedRangeStickiness`
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user