1
1
import { readdirSync , statSync } from 'fs' ;
2
2
import { join , relative } from 'path' ;
3
- import { moduleDirectoryExtension } from 'shared' ;
3
+ import {
4
+ DATA_DIRECTORY ,
5
+ MOD_DIRECTORY ,
6
+ moduleDirectoryExtension ,
7
+ } from 'shared' ;
4
8
import { WorkspaceFolder } from 'vscode-languageserver' ;
5
- import { URI } from 'vscode-uri' ;
9
+ import { URI , Utils } from 'vscode-uri' ;
6
10
7
11
class FileSystemService {
8
12
public moduleFileList : string [ ] = [ ] ;
@@ -16,11 +20,20 @@ class FileSystemService {
16
20
public updateFileList ( ) : void {
17
21
this . moduleFileList = [ ] ;
18
22
this . workspaces . forEach ( ( folder ) => {
19
- const workspacePath = URI . parse ( folder . uri ) . fsPath ;
20
- const workspaceFileList = this . getAllFiles ( workspacePath ) ;
23
+ const workspaceUri = URI . parse ( folder . uri ) ;
21
24
22
- for ( const file of workspaceFileList ) {
23
- this . moduleFileList . push ( relative ( workspacePath , file ) ) ;
25
+ const dataPathUri = Utils . joinPath ( workspaceUri , DATA_DIRECTORY ) ;
26
+ const modsPathUri = Utils . joinPath ( workspaceUri , MOD_DIRECTORY ) ;
27
+
28
+ const workspaceDataFileList = this . getAllFiles ( dataPathUri . fsPath ) ;
29
+ const workspaceModFileList = this . getAllFiles ( modsPathUri . fsPath ) ;
30
+
31
+ for ( const file of workspaceDataFileList ) {
32
+ this . moduleFileList . push ( relative ( dataPathUri . fsPath , file ) ) ;
33
+ }
34
+
35
+ for ( const file of workspaceModFileList ) {
36
+ this . moduleFileList . push ( relative ( modsPathUri . fsPath , file ) ) ;
24
37
}
25
38
} ) ;
26
39
}
0 commit comments