Skip to content

Commit a46554c

Browse files
committed
Use the fast variant of TextEditor.setDecorations
1 parent f22940a commit a46554c

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

extensions/merge-conflict/src/mergeDecorator.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,35 +188,35 @@ export default class MergeDecorator implements vscode.Disposable {
188188

189189
// Store decorations keyed by the type of decoration, set decoration wants a "style"
190190
// to go with it, which will match this key (see constructor);
191-
let matchDecorations: { [key: string]: vscode.DecorationOptions[] } = {};
191+
let matchDecorations: { [key: string]: vscode.Range[] } = {};
192192

193-
let pushDecoration = (key: string, d: vscode.DecorationOptions) => {
193+
let pushDecoration = (key: string, d: vscode.Range) => {
194194
matchDecorations[key] = matchDecorations[key] || [];
195195
matchDecorations[key].push(d);
196196
};
197197

198198
conflicts.forEach(conflict => {
199199
// TODO, this could be more effective, just call getMatchPositions once with a map of decoration to position
200200
if (!conflict.current.decoratorContent.isEmpty) {
201-
pushDecoration('current.content', { range: conflict.current.decoratorContent });
201+
pushDecoration('current.content', conflict.current.decoratorContent);
202202
}
203203
if (!conflict.incoming.decoratorContent.isEmpty) {
204-
pushDecoration('incoming.content', { range: conflict.incoming.decoratorContent });
204+
pushDecoration('incoming.content', conflict.incoming.decoratorContent);
205205
}
206206

207207
conflict.commonAncestors.forEach(commonAncestorsRegion => {
208208
if (!commonAncestorsRegion.decoratorContent.isEmpty) {
209-
pushDecoration('commonAncestors.content', { range: commonAncestorsRegion.decoratorContent });
209+
pushDecoration('commonAncestors.content', commonAncestorsRegion.decoratorContent);
210210
}
211211
});
212212

213213
if (this.config!.enableDecorations) {
214-
pushDecoration('current.header', { range: conflict.current.header });
215-
pushDecoration('splitter', { range: conflict.splitter });
216-
pushDecoration('incoming.header', { range: conflict.incoming.header });
214+
pushDecoration('current.header', conflict.current.header);
215+
pushDecoration('splitter', conflict.splitter);
216+
pushDecoration('incoming.header', conflict.incoming.header);
217217

218218
conflict.commonAncestors.forEach(commonAncestorsRegion => {
219-
pushDecoration('commonAncestors.header', { range: commonAncestorsRegion.header });
219+
pushDecoration('commonAncestors.header', commonAncestorsRegion.header);
220220
});
221221
}
222222
});

0 commit comments

Comments
 (0)