11import { readdirSync , statSync } from 'fs' ;
22import { join , relative } from 'path' ;
3- import { moduleDirectoryExtension } from 'shared' ;
3+ import {
4+ DATA_DIRECTORY ,
5+ MOD_DIRECTORY ,
6+ moduleDirectoryExtension ,
7+ } from 'shared' ;
48import { WorkspaceFolder } from 'vscode-languageserver' ;
5- import { URI } from 'vscode-uri' ;
9+ import { URI , Utils } from 'vscode-uri' ;
610
711class FileSystemService {
812 public moduleFileList : string [ ] = [ ] ;
@@ -14,13 +18,23 @@ class FileSystemService {
1418 }
1519
1620 public updateFileList ( ) : void {
21+ console . log ( 'Updating file list' ) ;
1722 this . moduleFileList = [ ] ;
1823 this . workspaces . forEach ( ( folder ) => {
19- const workspacePath = URI . parse ( folder . uri ) . fsPath ;
20- const workspaceFileList = this . getAllFiles ( workspacePath ) ;
24+ const workspaceUri = URI . parse ( folder . uri ) ;
2125
22- for ( const file of workspaceFileList ) {
23- this . moduleFileList . push ( relative ( workspacePath , file ) ) ;
26+ const dataPathUri = Utils . joinPath ( workspaceUri , DATA_DIRECTORY ) ;
27+ const modsPathUri = Utils . joinPath ( workspaceUri , MOD_DIRECTORY ) ;
28+
29+ const workspaceDataFileList = this . getAllFiles ( dataPathUri . fsPath ) ;
30+ const workspaceModFileList = this . getAllFiles ( modsPathUri . fsPath ) ;
31+
32+ for ( const file of workspaceDataFileList ) {
33+ this . moduleFileList . push ( relative ( dataPathUri . fsPath , file ) ) ;
34+ }
35+
36+ for ( const file of workspaceModFileList ) {
37+ this . moduleFileList . push ( relative ( modsPathUri . fsPath , file ) ) ;
2438 }
2539 } ) ;
2640 }
0 commit comments