Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make python a class attribute #338

Merged
merged 1 commit into from
Jun 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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