diff --git a/data/schema.json b/data/schema.json index 52b99173515..b667fa2ea21 100644 --- a/data/schema.json +++ b/data/schema.json @@ -537,7 +537,7 @@ }, "coc.preferences.currentFunctionSymbolDebounceTime": { "type": "number", - "scope": "language-overridable", + "scope": "application", "description": "Set debounce timer for the update of b:coc_current_function on CursorMove event", "default": 300 }, diff --git a/doc/coc-config.txt b/doc/coc-config.txt index 53ace94fbed..fe12d6c4335 100644 --- a/doc/coc-config.txt +++ b/doc/coc-config.txt @@ -1530,7 +1530,7 @@ Preferences~ Set debounce timer for the update of b:coc_current_function on CursorMove event - Scope: `language-overridable`, default: `300` + Scope: `application`, default: `300` "coc.preferences.enableLinkedEditing" *coc-preferences-enableLinkedEditing* diff --git a/src/handler/symbols/index.ts b/src/handler/symbols/index.ts index 462a8b9e2e2..f81f0f2605f 100644 --- a/src/handler/symbols/index.ts +++ b/src/handler/symbols/index.ts @@ -37,6 +37,7 @@ export default class Symbols { return buf }) this.outline = new Outline(nvim, this.buffers, handler) + const debounceTime = workspace.initialConfiguration.get('coc.preferences.currentFunctionSymbolDebounceTime', 300) let debounced = debounce(async (bufnr: number, cursor: [number, number]) => { if (!this.buffers.getItem(bufnr) || !this.autoUpdate(bufnr)) return let doc = workspace.getDocument(bufnr) @@ -46,7 +47,7 @@ export default class Symbols { let buffer = nvim.createBuffer(bufnr) buffer.setVar('coc_current_function', func ?? '', true) this.nvim.call('coc#util#do_autocmd', ['CocStatusChange'], true) - }, this.debounceTime()) + }, getConditionValue(debounceTime, 0)) events.on('CursorMoved', debounced, this, this.disposables) this.disposables.push(Disposable.create(() => { debounced.clear() @@ -63,11 +64,6 @@ export default class Symbols { return config.get('currentFunctionSymbolAutoUpdate', false) } - public debounceTime(): number { - let config = workspace.getConfiguration('coc.preferences') - return getConditionValue(config.get('currentFunctionSymbolDebounceTime', 300), 0) - } - public get labels(): { [key: string]: string } { return workspace.getConfiguration('suggest').get('completionItemKindLabels', {}) }