This repository was archived by the owner on Feb 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed
Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 3939 "test" : " node ./out/test/runTest.js" ,
4040 "deploy" : " vsce publish"
4141 },
42+ "dependencies" : {
43+ "throttle-debounce" : " ^5.0.0"
44+ },
4245 "devDependencies" : {
4346 "@types/mocha" : " ^10.0.6" ,
4447 "@types/node" : " 20.x" ,
48+ "@types/throttle-debounce" : " ^5.0.2" ,
4549 "@types/vscode" : " ^1.78.0" ,
4650 "@typescript-eslint/eslint-plugin" : " ^7.4.0" ,
4751 "@typescript-eslint/parser" : " ^7.4.0" ,
5256 "mocha" : " ^10.4.0" ,
5357 "typescript" : " ^5.4.3"
5458 }
55- }
59+ }
Original file line number Diff line number Diff line change 11import * as vscode from "vscode" ;
22import * as cp from "child_process" ;
3+ import { throttle } from "throttle-debounce" ;
34
45import {
56 parseGitBlamePorcelain ,
@@ -74,13 +75,14 @@ function showDecoration(e: { readonly textEditor: vscode.TextEditor }) {
7475
7576export function activate ( context : vscode . ExtensionContext ) {
7677 console . log ( 'Extension "git-line-blame" has activated.' ) ;
78+ let showDecorationThrottled = throttle ( 100 , showDecoration ) ;
7779 context . subscriptions . push (
78- vscode . window . onDidChangeTextEditorSelection ( showDecoration ) ,
79- vscode . window . onDidChangeTextEditorVisibleRanges ( showDecoration ) ,
80+ vscode . window . onDidChangeTextEditorSelection ( showDecorationThrottled ) ,
81+ vscode . window . onDidChangeTextEditorVisibleRanges ( showDecorationThrottled ) ,
8082 vscode . workspace . onDidSaveTextDocument ( ( e ) => {
8183 const editor = vscode . window . activeTextEditor ;
8284 if ( editor !== undefined && e === editor . document ) {
83- showDecoration ( { textEditor : editor } ) ;
85+ showDecorationThrottled ( { textEditor : editor } ) ;
8486 }
8587 } )
8688 ) ;
You can’t perform that action at this time.
0 commit comments