@@ -32,7 +32,7 @@ export default class BashServer {
32
32
private documents : LSP . TextDocuments < TextDocument > = new LSP . TextDocuments ( TextDocument )
33
33
private executables : Executables
34
34
private linter ?: Linter
35
- private rootPath : string | null | undefined
35
+ private workspaceFolder : string | null | undefined
36
36
private uriToCodeActions : { [ uri : string ] : CodeAction [ ] | undefined } = { }
37
37
38
38
private constructor ( {
@@ -41,33 +41,34 @@ export default class BashServer {
41
41
connection,
42
42
executables,
43
43
linter,
44
- rootPath ,
44
+ workspaceFolder ,
45
45
} : {
46
46
analyzer : Analyzer
47
47
capabilities : LSP . ClientCapabilities
48
48
connection : LSP . Connection
49
49
executables : Executables
50
50
linter ?: Linter
51
- rootPath : string | null | undefined
51
+ workspaceFolder : string | null | undefined
52
52
} ) {
53
53
this . analyzer = analyzer
54
54
this . clientCapabilities = capabilities
55
55
this . config = config . getDefaultConfiguration ( )
56
56
this . connection = connection
57
57
this . executables = executables
58
58
this . linter = linter
59
- this . rootPath = rootPath
59
+ this . workspaceFolder = workspaceFolder
60
60
}
61
61
/**
62
62
* Initialize the server based on a connection to the client and the protocols
63
63
* initialization parameters.
64
64
*/
65
65
public static async initialize (
66
66
connection : LSP . Connection ,
67
- { rootPath, capabilities } : LSP . InitializeParams ,
67
+ { rootPath, rootUri , capabilities } : LSP . InitializeParams ,
68
68
) : // TODO: use workspaceFolders instead of rootPath
69
69
Promise < BashServer > {
70
70
const { PATH } = process . env
71
+ const workspaceFolder = rootUri || rootPath
71
72
72
73
if ( ! PATH ) {
73
74
throw new Error ( 'Expected PATH environment variable to be set' )
@@ -83,7 +84,7 @@ export default class BashServer {
83
84
capabilities,
84
85
connection,
85
86
executables,
86
- rootPath ,
87
+ workspaceFolder ,
87
88
} )
88
89
}
89
90
@@ -192,12 +193,12 @@ export default class BashServer {
192
193
}
193
194
194
195
private async startBackgroundAnalysis ( ) : Promise < { filesParsed : number } > {
195
- const { rootPath } = this
196
- if ( rootPath ) {
196
+ const { workspaceFolder } = this
197
+ if ( workspaceFolder ) {
197
198
return this . analyzer . initiateBackgroundAnalysis ( {
198
199
globPattern : this . config . globPattern ,
199
200
backgroundAnalysisMaxFiles : this . config . backgroundAnalysisMaxFiles ,
200
- rootPath,
201
+ rootPath : workspaceFolder ,
201
202
} )
202
203
}
203
204
0 commit comments