Skip to content

Commit 8e29121

Browse files
committed
fix: configs not working for the deprecated pyls
1 parent c66cecc commit 8e29121

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

lib/main.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,21 @@ class PythonLanguageClient extends AutoLanguageClient {
4545
return "ide-python"
4646
}
4747

48+
getPyLs() {
49+
if (this.pyls === undefined) {
50+
let pyls = atom.config.get("ide-python.pyls") || "pylsp"
51+
// check if it exists
52+
if (whichSync(pyls, { nothrow: true }) === null) {
53+
pyls = "pyls"
54+
}
55+
// cache
56+
this.pyls = pyls
57+
}
58+
return this.pyls
59+
}
60+
4861
mapConfigurationObject(configuration) {
49-
const lsp = configuration.pyls || "pylsp"
62+
const lsp = this.getPyLs()
5063
return {
5164
[lsp]: {
5265
configurationSources: configuration.pylsConfigurationSources,
@@ -71,13 +84,7 @@ class PythonLanguageClient extends AutoLanguageClient {
7184

7285
this.python = replacePipEnvPathVar(pythonBin, venvPath)
7386

74-
let pyls = atom.config.get("ide-python.pyls") || "pylsp"
75-
// check if it exists
76-
if (whichSync(pyls, { nothrow: true }) === null) {
77-
pyls = "pyls"
78-
}
79-
80-
const childProcess = super.spawn(this.python, ["-m", pyls], {
87+
const childProcess = super.spawn(this.python, ["-m", this.getPyLs()], {
8188
cwd: projectPath,
8289
env: pylsEnvironment,
8390
})

0 commit comments

Comments
 (0)