Skip to content

Commit

Permalink
fix: make python a class attribute (#338)
Browse files Browse the repository at this point in the history
closes #336 #335 #337
  • Loading branch information
ThatXliner authored Jun 10, 2021
1 parent 21dfcd5 commit 4d34da9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ class PythonLanguageClient extends AutoLanguageClient {
if (venvPath) {
pylsEnvironment["VIRTUAL_ENV"] = venvPath
}
const python = replacePipEnvPathVar(atom.config.get("ide-python.python"), venvPath)
this.python = replacePipEnvPathVar(atom.config.get("ide-python.python"), venvPath)

let pyls = atom.config.get("ide-python.pyls") || "pylsp"
// check if it exists
if (whichSync(pyls, { nothrow: true }) === null) {
pyls = "pyls"
}
const childProcess = super.spawn(python, ["-m", pyls], {
const childProcess = super.spawn(this.python, ["-m", pyls], {
cwd: projectPath,
env: pylsEnvironment,
})
Expand All @@ -81,8 +81,8 @@ class PythonLanguageClient extends AutoLanguageClient {
onSpawnError(err) {
const description =
err.code == "ENOENT"
? `No Python interpreter found at \`${python}\`.`
: `Could not spawn the Python interpreter \`${python}\`.`
? `No Python interpreter found at \`${this.python}\`.`
: `Could not spawn the Python interpreter \`${this.python}\`.`
atom.notifications.addError("`ide-python` could not launch your Python runtime.", {
dismissable: true,
description: `${description}<p>If you have Python installed please set "Python Executable" setting correctly. If you do not please install Python.</p>`,
Expand All @@ -106,8 +106,8 @@ class PythonLanguageClient extends AutoLanguageClient {
description:
"Make sure to install `pylsp` 0.19 or newer by running:\n" +
"```\n" +
`${python} -m pip install 'python-lsp-server[all]'\n` +
`${python} -m pip install git+https://github.com/tomv564/pyls-mypy.git\n` +
`${this.python} -m pip install 'python-lsp-server[all]'\n` +
`${this.python} -m pip install git+https://github.com/tomv564/pyls-mypy.git\n` +
"```",
})
}
Expand Down

0 comments on commit 4d34da9

Please sign in to comment.