This repository was archived by the owner on Feb 15, 2025. It is now read-only.
File tree 3 files changed +28
-4
lines changed
3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 39
39
"test" : " node ./out/test/runTest.js" ,
40
40
"deploy" : " vsce publish"
41
41
},
42
+ "dependencies" : {
43
+ "throttle-debounce" : " ^5.0.0"
44
+ },
42
45
"devDependencies" : {
43
46
"@types/mocha" : " ^10.0.6" ,
44
47
"@types/node" : " 20.x" ,
48
+ "@types/throttle-debounce" : " ^5.0.2" ,
45
49
"@types/vscode" : " ^1.78.0" ,
46
50
"@typescript-eslint/eslint-plugin" : " ^7.4.0" ,
47
51
"@typescript-eslint/parser" : " ^7.4.0" ,
52
56
"mocha" : " ^10.4.0" ,
53
57
"typescript" : " ^5.4.3"
54
58
}
55
- }
59
+ }
Original file line number Diff line number Diff line change 1
1
import * as vscode from "vscode" ;
2
2
import * as cp from "child_process" ;
3
+ import { throttle } from "throttle-debounce" ;
3
4
4
5
import {
5
6
parseGitBlamePorcelain ,
@@ -74,13 +75,14 @@ function showDecoration(e: { readonly textEditor: vscode.TextEditor }) {
74
75
75
76
export function activate ( context : vscode . ExtensionContext ) {
76
77
console . log ( 'Extension "git-line-blame" has activated.' ) ;
78
+ let showDecorationThrottled = throttle ( 100 , showDecoration ) ;
77
79
context . subscriptions . push (
78
- vscode . window . onDidChangeTextEditorSelection ( showDecoration ) ,
79
- vscode . window . onDidChangeTextEditorVisibleRanges ( showDecoration ) ,
80
+ vscode . window . onDidChangeTextEditorSelection ( showDecorationThrottled ) ,
81
+ vscode . window . onDidChangeTextEditorVisibleRanges ( showDecorationThrottled ) ,
80
82
vscode . workspace . onDidSaveTextDocument ( ( e ) => {
81
83
const editor = vscode . window . activeTextEditor ;
82
84
if ( editor !== undefined && e === editor . document ) {
83
- showDecoration ( { textEditor : editor } ) ;
85
+ showDecorationThrottled ( { textEditor : editor } ) ;
84
86
}
85
87
} )
86
88
) ;
You can’t perform that action at this time.
0 commit comments