mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-11 05:30:03 -05:00
Use the fast variant of TextEditor.setDecorations
This commit is contained in:
@@ -188,9 +188,9 @@ export default class MergeDecorator implements vscode.Disposable {
|
||||
|
||||
// Store decorations keyed by the type of decoration, set decoration wants a "style"
|
||||
// to go with it, which will match this key (see constructor);
|
||||
let matchDecorations: { [key: string]: vscode.DecorationOptions[] } = {};
|
||||
let matchDecorations: { [key: string]: vscode.Range[] } = {};
|
||||
|
||||
let pushDecoration = (key: string, d: vscode.DecorationOptions) => {
|
||||
let pushDecoration = (key: string, d: vscode.Range) => {
|
||||
matchDecorations[key] = matchDecorations[key] || [];
|
||||
matchDecorations[key].push(d);
|
||||
};
|
||||
@@ -198,25 +198,25 @@ export default class MergeDecorator implements vscode.Disposable {
|
||||
conflicts.forEach(conflict => {
|
||||
// TODO, this could be more effective, just call getMatchPositions once with a map of decoration to position
|
||||
if (!conflict.current.decoratorContent.isEmpty) {
|
||||
pushDecoration('current.content', { range: conflict.current.decoratorContent });
|
||||
pushDecoration('current.content', conflict.current.decoratorContent);
|
||||
}
|
||||
if (!conflict.incoming.decoratorContent.isEmpty) {
|
||||
pushDecoration('incoming.content', { range: conflict.incoming.decoratorContent });
|
||||
pushDecoration('incoming.content', conflict.incoming.decoratorContent);
|
||||
}
|
||||
|
||||
conflict.commonAncestors.forEach(commonAncestorsRegion => {
|
||||
if (!commonAncestorsRegion.decoratorContent.isEmpty) {
|
||||
pushDecoration('commonAncestors.content', { range: commonAncestorsRegion.decoratorContent });
|
||||
pushDecoration('commonAncestors.content', commonAncestorsRegion.decoratorContent);
|
||||
}
|
||||
});
|
||||
|
||||
if (this.config!.enableDecorations) {
|
||||
pushDecoration('current.header', { range: conflict.current.header });
|
||||
pushDecoration('splitter', { range: conflict.splitter });
|
||||
pushDecoration('incoming.header', { range: conflict.incoming.header });
|
||||
pushDecoration('current.header', conflict.current.header);
|
||||
pushDecoration('splitter', conflict.splitter);
|
||||
pushDecoration('incoming.header', conflict.incoming.header);
|
||||
|
||||
conflict.commonAncestors.forEach(commonAncestorsRegion => {
|
||||
pushDecoration('commonAncestors.header', { range: commonAncestorsRegion.header });
|
||||
pushDecoration('commonAncestors.header', commonAncestorsRegion.header);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user