11import { CompositeDisposable , DisplayMarker , TextEditor } from "atom"
2- import { debounce } from "lodash"
2+ import { debounce , DebouncedFunc } from "lodash"
33import { DocumentHighlightsItem } from "typescript/lib/protocol"
44import { GetClientFunction } from "../../../client"
55import { handlePromise } from "../../../utils"
@@ -11,13 +11,16 @@ export class OccurenceController {
1111 private disposed = false
1212
1313 constructor ( private getClient : GetClientFunction , private editor : TextEditor ) {
14- const debouncedUpdate = debounce ( ( ) => {
15- handlePromise ( this . update ( ) )
16- } , 100 )
14+ let debouncedUpdate : DebouncedFunc < ( ) => void >
1715 this . disposables . add (
18- editor . onDidChangeCursorPosition ( debouncedUpdate ) ,
19- editor . onDidChangePath ( debouncedUpdate ) ,
20- editor . onDidChangeGrammar ( debouncedUpdate ) ,
16+ atom . config . observe ( "atom-typescript.ocurrenceHighlightDebounceTimeout" , ( val ) => {
17+ debouncedUpdate = debounce ( ( ) => {
18+ handlePromise ( this . update ( ) )
19+ } , val )
20+ } ) ,
21+ editor . onDidChangeCursorPosition ( ( ) => debouncedUpdate ( ) ) ,
22+ editor . onDidChangePath ( ( ) => debouncedUpdate ( ) ) ,
23+ editor . onDidChangeGrammar ( ( ) => debouncedUpdate ( ) ) ,
2124 )
2225 }
2326
0 commit comments