1
+ // tslint:disable: no-console
1
2
import * as assert from 'assert' ;
2
3
import * as os from 'os' ;
3
4
import * as path from 'path' ;
@@ -23,21 +24,21 @@ function getHaskellConfig() {
23
24
}
24
25
25
26
function getWorkspaceRoot ( ) {
26
- return vscode . workspace . workspaceFolders ! [ 0 ] ! . uri ;
27
+ return vscode . workspace . workspaceFolders ! [ 0 ] ;
27
28
}
28
29
29
30
function getWorkspaceFile ( name : string ) {
30
- const wsroot = getWorkspaceRoot ( ) ;
31
+ const wsroot = getWorkspaceRoot ( ) . uri ;
31
32
return wsroot . with ( { path : path . posix . join ( wsroot . path , name ) } ) ;
32
33
}
33
34
34
35
const disposables : Disposable [ ] = [ ] ;
35
36
36
- async function existsWorkspaceFile ( fileRelativePath : string ) {
37
+ async function existsWorkspaceFile ( pattern : string ) {
37
38
return new Promise < vscode . Uri > ( ( resolve ) => {
38
- // tslint:disable: no-console
39
- console . log ( `Creating file system watcher for ${ fileRelativePath } ` ) ;
40
- const watcher = vscode . workspace . createFileSystemWatcher ( `** ${ fileRelativePath } ` ) . onDidCreate ( ( uri ) => {
39
+ const pat : vscode . RelativePattern = new vscode . RelativePattern ( getWorkspaceRoot ( ) , pattern ) ;
40
+ console . log ( `Creating file system watcher for ${ pat } ` ) ;
41
+ const watcher = vscode . workspace . createFileSystemWatcher ( pat ) . onDidCreate ( ( uri ) => {
41
42
console . log ( `Created: ${ uri } ` ) ;
42
43
resolve ( uri ) ;
43
44
} ) ;
@@ -86,8 +87,7 @@ suite('Extension Test Suite', () => {
86
87
suiteTeardown ( async ( ) => {
87
88
disposables . forEach ( ( d ) => d . dispose ( ) ) ;
88
89
await vscode . commands . executeCommand ( CommandNames . StopServerCommandName ) ;
89
- const dirContents = await vscode . workspace . fs . readDirectory ( getWorkspaceRoot ( ) ) ;
90
- // tslint:disable: no-console
90
+ const dirContents = await vscode . workspace . fs . readDirectory ( getWorkspaceRoot ( ) . uri ) ;
91
91
console . log ( `Deleting test ws contents: ${ dirContents } ` ) ;
92
92
dirContents . forEach ( async ( [ name , type ] ) => {
93
93
const uri : vscode . Uri = getWorkspaceFile ( name ) ;
0 commit comments