@@ -2,26 +2,21 @@ import * as vscode from "vscode";
2
2
import { TextDecoder } from "text-encoding" ;
3
3
import { PromiseSocket } from "promise-socket" ;
4
4
5
-
6
5
export default class LivecodescriptServerProvider {
7
6
private enabled : boolean ;
8
7
private host : string ;
9
8
private port : number ;
10
9
11
-
12
10
constructor ( ) {
13
11
this . loadConfiguration ( ) ;
14
12
}
15
13
16
-
17
14
public activate ( subscriptions : vscode . Disposable [ ] ) {
18
15
subscriptions . push ( this ) ;
19
16
subscriptions . push (
20
17
vscode . workspace . onDidSaveTextDocument (
21
18
async ( { fileName, languageId, lineAt } ) => {
22
-
23
19
console . log ( "DOCUMENT SAVED" ) ;
24
-
25
20
if ( this . enabled && languageId === "livecodescript" ) {
26
21
const regex = '"([-.:a-zA-Z0-9_s?!]+)"' ;
27
22
const scriptName = lineAt ( 0 ) . text . match ( regex ) [ 1 ] ;
@@ -30,23 +25,21 @@ export default class LivecodescriptServerProvider {
30
25
stack : scriptName ,
31
26
filename : fileName ,
32
27
} ;
33
-
28
+
34
29
this . sendToLiveCode ( query ) ;
35
30
}
36
31
}
37
32
)
38
33
) ;
39
-
40
34
subscriptions . push (
41
35
vscode . workspace . onDidChangeConfiguration ( ( ) =>
42
36
this . loadConfiguration ( )
43
37
)
44
38
) ;
45
-
39
+ }
46
40
47
41
public dispose ( ) : void { }
48
42
49
-
50
43
private loadConfiguration ( ) {
51
44
console . log ( "CONFIG CHANGED" ) ;
52
45
const section = vscode . workspace . getConfiguration ( "livecodescript" ) ;
@@ -105,7 +98,6 @@ export default class LivecodescriptServerProvider {
105
98
this . sendToLiveCode ( query ) ;
106
99
}
107
100
} ) ;
108
-
109
101
}
110
102
}
111
103
}
0 commit comments