File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import * as fs from "fs";
9
9
import * as path from "path" ;
10
10
import { Repository } from "./repository" ;
11
11
import { Svn } from "./svn" ;
12
+ import { dispose } from "./util" ;
12
13
13
14
interface OpenRepository {
14
15
repository : Repository ;
@@ -29,6 +30,8 @@ export class Model {
29
30
30
31
if ( this . enabled ) {
31
32
this . init ( ) ;
33
+ } else {
34
+ this . disable ( ) ;
32
35
}
33
36
}
34
37
@@ -46,6 +49,15 @@ export class Model {
46
49
this . scanWorkspaceFolders ( ) ;
47
50
}
48
51
52
+ private disable ( ) : void {
53
+ const openRepositories = [ ...this . openRepositories ] ;
54
+
55
+ openRepositories . forEach ( repository => r . dispose ( ) ) ;
56
+
57
+ this . openRepositories = [ ] ;
58
+ this . disposables = dispose ( this . disposables ) ;
59
+ }
60
+
49
61
private onDidChangeWorkspaceFolders ( {
50
62
added,
51
63
removed
Original file line number Diff line number Diff line change
1
+ export function dispose ( disposables : any [ ] ) : any [ ] {
2
+ disposables . forEach ( disposable => disposable . dispose ( ) ) ;
3
+
4
+ return [ ] ;
5
+ }
You can’t perform that action at this time.
0 commit comments