Add color decorator limit to 500 (#11862)

This commit is contained in:
Martin Aeschlimann
2016-09-13 12:24:49 +02:00
parent 5a5d58ed9a
commit d8f6f74520

View File

@@ -6,6 +6,8 @@
import {window, workspace, DecorationOptions, DecorationRenderOptions, Disposable, Range, TextDocument, TextEditor} from 'vscode';
const MAX_DECORATORS = 500;
let decorationType: DecorationRenderOptions = {
before: {
contentText: ' ',
@@ -76,7 +78,7 @@ export function activateColorDecorations(decoratorProvider: (uri: string) => The
let document = editor.document;
if (supportedLanguages[document.languageId]) {
decoratorProvider(document.uri.toString()).then(ranges => {
let decorations = ranges.map(range => {
let decorations = ranges.slice(0, MAX_DECORATORS).map(range => {
let color = document.getText(range);
return <DecorationOptions>{
range: range,