Skip to content

Commit 4d34da9

Browse files
authored
fix: make python a class attribute (#338)
closes #336 #335 #337
1 parent 21dfcd5 commit 4d34da9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/main.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ class PythonLanguageClient extends AutoLanguageClient {
6464
if (venvPath) {
6565
pylsEnvironment["VIRTUAL_ENV"] = venvPath
6666
}
67-
const python = replacePipEnvPathVar(atom.config.get("ide-python.python"), venvPath)
67+
this.python = replacePipEnvPathVar(atom.config.get("ide-python.python"), venvPath)
6868

6969
let pyls = atom.config.get("ide-python.pyls") || "pylsp"
7070
// check if it exists
7171
if (whichSync(pyls, { nothrow: true }) === null) {
7272
pyls = "pyls"
7373
}
74-
const childProcess = super.spawn(python, ["-m", pyls], {
74+
const childProcess = super.spawn(this.python, ["-m", pyls], {
7575
cwd: projectPath,
7676
env: pylsEnvironment,
7777
})
@@ -81,8 +81,8 @@ class PythonLanguageClient extends AutoLanguageClient {
8181
onSpawnError(err) {
8282
const description =
8383
err.code == "ENOENT"
84-
? `No Python interpreter found at \`${python}\`.`
85-
: `Could not spawn the Python interpreter \`${python}\`.`
84+
? `No Python interpreter found at \`${this.python}\`.`
85+
: `Could not spawn the Python interpreter \`${this.python}\`.`
8686
atom.notifications.addError("`ide-python` could not launch your Python runtime.", {
8787
dismissable: true,
8888
description: `${description}<p>If you have Python installed please set "Python Executable" setting correctly. If you do not please install Python.</p>`,
@@ -106,8 +106,8 @@ class PythonLanguageClient extends AutoLanguageClient {
106106
description:
107107
"Make sure to install `pylsp` 0.19 or newer by running:\n" +
108108
"```\n" +
109-
`${python} -m pip install 'python-lsp-server[all]'\n` +
110-
`${python} -m pip install git+https://github.com/tomv564/pyls-mypy.git\n` +
109+
`${this.python} -m pip install 'python-lsp-server[all]'\n` +
110+
`${this.python} -m pip install git+https://github.com/tomv564/pyls-mypy.git\n` +
111111
"```",
112112
})
113113
}

0 commit comments

Comments
 (0)