File tree Expand file tree Collapse file tree 2 files changed +5
-37
lines changed
packages/docs-visual-areas/src Expand file tree Collapse file tree 2 files changed +5
-37
lines changed Original file line number Diff line number Diff line change 1- import * as vscode from 'vscode' ;
1+ import { TextDocumentWillSaveEvent , workspace } from 'vscode' ;
22import { triggerUpdateDecorations } from './decorations' ;
3- import { State } from './models' ;
4- import { updateStatusBarItem } from './statusbar' ;
53
64export function addEventHandlers ( ) {
7- const { extensionContext : context } = State ;
8- let { activeTextEditor } = vscode . window ;
9-
10- vscode . window . onDidChangeActiveTextEditor (
11- editor => {
12- activeTextEditor = editor ;
13- if ( editor ) {
14- triggerUpdateDecorations ( ) ;
15- updateStatusBarItem ( ) ;
16- }
17- } ,
18- null ,
19- context . subscriptions
20- ) ;
21-
22- vscode . workspace . onDidChangeTextDocument (
23- event => {
24- if ( activeTextEditor && event . document === activeTextEditor . document ) {
25- triggerUpdateDecorations ( ) ;
26- }
27- } ,
28- null ,
29- context . subscriptions
30- ) ;
31-
32- vscode . window . onDidChangeTextEditorSelection (
33- event => {
34- updateStatusBarItem ( ) ;
35- } ,
36- null ,
37- context . subscriptions
38- ) ;
5+ workspace . onWillSaveTextDocument ( willSaveTextDocument ) ;
6+ async function willSaveTextDocument ( e : TextDocumentWillSaveEvent ) {
7+ e . waitUntil ( Promise . resolve ( triggerUpdateDecorations ( ) ) ) ;
8+ }
399}
Original file line number Diff line number Diff line change @@ -13,8 +13,6 @@ export function activate(context: vscode.ExtensionContext) {
1313 addSubscriptions ( ) ;
1414 addEventHandlers ( ) ;
1515
16- // context.subscriptions.push(disposable);
17-
1816 if ( activeTextEditor ) {
1917 triggerUpdateDecorations ( ) ;
2018 updateStatusBarItem ( ) ;
You can’t perform that action at this time.
0 commit comments