提交 a46554c8 编写于 作者: A Alex Dima

Use the fast variant of TextEditor.setDecorations

上级 f22940a2
......@@ -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);
});
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册