Skip to content

Commit 8ce7903

Browse files
committed
Call it workspaceFolder internally
1 parent 0f76c91 commit 8ce7903

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

server/src/server.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default class BashServer {
3232
private documents: LSP.TextDocuments<TextDocument> = new LSP.TextDocuments(TextDocument)
3333
private executables: Executables
3434
private linter?: Linter
35-
private rootPath: string | null | undefined
35+
private workspaceFolder: string | null | undefined
3636
private uriToCodeActions: { [uri: string]: CodeAction[] | undefined } = {}
3737

3838
private constructor({
@@ -41,33 +41,34 @@ export default class BashServer {
4141
connection,
4242
executables,
4343
linter,
44-
rootPath,
44+
workspaceFolder,
4545
}: {
4646
analyzer: Analyzer
4747
capabilities: LSP.ClientCapabilities
4848
connection: LSP.Connection
4949
executables: Executables
5050
linter?: Linter
51-
rootPath: string | null | undefined
51+
workspaceFolder: string | null | undefined
5252
}) {
5353
this.analyzer = analyzer
5454
this.clientCapabilities = capabilities
5555
this.config = config.getDefaultConfiguration()
5656
this.connection = connection
5757
this.executables = executables
5858
this.linter = linter
59-
this.rootPath = rootPath
59+
this.workspaceFolder = workspaceFolder
6060
}
6161
/**
6262
* Initialize the server based on a connection to the client and the protocols
6363
* initialization parameters.
6464
*/
6565
public static async initialize(
6666
connection: LSP.Connection,
67-
{ rootPath, capabilities }: LSP.InitializeParams,
67+
{ rootPath, rootUri, capabilities }: LSP.InitializeParams,
6868
): // TODO: use workspaceFolders instead of rootPath
6969
Promise<BashServer> {
7070
const { PATH } = process.env
71+
const workspaceFolder = rootUri || rootPath
7172

7273
if (!PATH) {
7374
throw new Error('Expected PATH environment variable to be set')
@@ -83,7 +84,7 @@ export default class BashServer {
8384
capabilities,
8485
connection,
8586
executables,
86-
rootPath,
87+
workspaceFolder,
8788
})
8889
}
8990

@@ -192,12 +193,12 @@ export default class BashServer {
192193
}
193194

194195
private async startBackgroundAnalysis(): Promise<{ filesParsed: number }> {
195-
const { rootPath } = this
196-
if (rootPath) {
196+
const { workspaceFolder } = this
197+
if (workspaceFolder) {
197198
return this.analyzer.initiateBackgroundAnalysis({
198199
globPattern: this.config.globPattern,
199200
backgroundAnalysisMaxFiles: this.config.backgroundAnalysisMaxFiles,
200-
rootPath,
201+
rootPath: workspaceFolder,
201202
})
202203
}
203204

0 commit comments

Comments
 (0)