File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { updateDiagnostics } from "./diagnostic/diagnostic";
16
16
import { hoverProviders } from "./hover/HoverProvider" ;
17
17
import { linkProviders } from "./link/LinkProvider" ;
18
18
import { configAffected } from "./support/config" ;
19
+ import { disposeWatchers } from "./support/fileWatcher" ;
19
20
import { info } from "./support/logger" ;
20
21
import { setParserBinaryPath } from "./support/parser" ;
21
22
import { clearDefaultPhpCommand , initVendorWatchers } from "./support/php" ;
@@ -147,6 +148,8 @@ export function deactivate() {
147
148
cleanUpTemp ( ) ;
148
149
}
149
150
151
+ disposeWatchers ( ) ;
152
+
150
153
if ( client ) {
151
154
client . stop ( ) ;
152
155
}
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import { leadingDebounce } from "./util";
4
4
5
5
type FileEvent = "change" | "create" | "delete" ;
6
6
7
+ let watchers : vscode . FileSystemWatcher [ ] = [ ] ;
8
+
7
9
export type WatcherPattern =
8
10
| string
9
11
| string [ ]
@@ -72,6 +74,17 @@ export const createFileWatcher = (
72
74
watcher . onDidDelete ( callback ) ;
73
75
}
74
76
77
+ registerWatcher ( watcher ) ;
78
+
75
79
return watcher ;
76
80
} ) ;
77
81
} ;
82
+
83
+ export const registerWatcher = ( watcher : vscode . FileSystemWatcher ) => {
84
+ watchers . push ( watcher ) ;
85
+ } ;
86
+
87
+ export const disposeWatchers = ( ) => {
88
+ watchers . forEach ( ( watcher ) => watcher . dispose ( ) ) ;
89
+ watchers = [ ] ;
90
+ } ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import * as cp from "child_process";
3
3
import * as fs from "fs" ;
4
4
import * as vscode from "vscode" ;
5
5
import { config , PhpEnvironment } from "./config" ;
6
+ import { registerWatcher } from "./fileWatcher" ;
6
7
import { error , info } from "./logger" ;
7
8
import { showErrorPopup } from "./popup" ;
8
9
import {
@@ -78,6 +79,9 @@ export const initVendorWatchers = () => {
78
79
autoloadWatcher . onDidDelete ( ( ) => {
79
80
hasVendor = false ;
80
81
} ) ;
82
+
83
+ registerWatcher ( watcher ) ;
84
+ registerWatcher ( autoloadWatcher ) ;
81
85
} ;
82
86
83
87
const getPhpCommand = ( ) : string => {
You can’t perform that action at this time.
0 commit comments