From c4d9a290354265d82d6be4605f2cc55a530eec3a Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 30 May 2018 11:55:47 +0200 Subject: [PATCH] don't show outline when there are more then 7500 symbols, #50575 --- .../parts/outline/electron-browser/outlinePanel.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts b/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts index ca5c89ebda3a9..4dc8a59f2c335 100644 --- a/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts +++ b/src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts @@ -375,7 +375,6 @@ export class OutlinePanel extends ViewsViewletPanel { return this._showMessage(localize('no-editor', "There are no editors open that can provide outline information.")); } - dom.removeClass(this._domNode, 'message'); let textModel = editor.getModel(); let model = await asDisposablePromise(OutlineModel.create(textModel), undefined, this._editorDisposables).promise; @@ -383,12 +382,18 @@ export class OutlinePanel extends ViewsViewletPanel { return; } + let newSize = TreeElement.size(model); + if (newSize > 7500) { + // this is a workaround for performance issues with the tree: https://github.com/Microsoft/vscode/issues/18180 + return this._showMessage(localize('too-many-symbols', "We are sorry, but this file is too large for showing an outline.")); + } + + dom.removeClass(this._domNode, 'message'); let oldModel = this._tree.getInput(); if (event && oldModel) { // heuristic: when the symbols-to-lines ratio changes by 50% between edits // wait a little (and hope that the next change isn't as drastic). - let newSize = TreeElement.size(model); let newLength = textModel.getValueLength(); let newRatio = newSize / newLength; let oldSize = TreeElement.size(oldModel);