File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,15 @@ export async function consumeOutlineProvider(provider: OutlineProvider) {
7171// disposables returned inside onEditorChangedDisposable
7272let onEditorChangedDisposable : CompositeDisposable | undefined = undefined
7373
74+ /**
75+ * How long to wait for the new changes before updating the outline. A high number will increase the responsiveness of
76+ * the text editor in large files.
77+ */
78+ function getDebounceTime ( editor : TextEditor ) {
79+ const largeness = editorLargeness ( editor )
80+ return Math . max ( largeness / 4 , 300 ) // 1/4 of the line count
81+ }
82+
7483async function editorChanged ( editor ?: TextEditor ) {
7584 if ( editor === undefined ) {
7685 return
@@ -85,10 +94,7 @@ async function editorChanged(editor?: TextEditor) {
8594 // the following updates rely on the visibility
8695 await getOutline ( editor )
8796
88- const largeness = editorLargeness ( editor as TextEditor )
89- // How long to wait for the new changes before updating the outline.
90- // A high number will increase the responsiveness of the text editor in large files.
91- const updateDebounceTime = Math . max ( largeness / 4 , 300 ) // 1/4 of the line count
97+ const updateDebounceTime = getDebounceTime ( editor )
9298
9399 const doubouncedGetOutline = debounce (
94100 getOutlintIfVisible as ( textEditor : TextEditor ) => Promise < void > ,
You can’t perform that action at this time.
0 commit comments