Skip to content

Commit

Permalink
fix: use which to detect pylsp
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jun 9, 2021
1 parent 01dfc6c commit a2c8444
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ coverage
build
dist
VendorLib
.mypy_cache
7 changes: 2 additions & 5 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { shell } = require("electron")
const execFileSync = require("child_process").execFileSync
const whichSync = require("which").sync
const { AutoLanguageClient } = require("atom-languageclient")
const { detectVirtualEnv, detectPipEnv, replacePipEnvPathVar, sanitizeConfig } = require("./utils")

Expand Down Expand Up @@ -53,10 +53,7 @@ class PythonLanguageClient extends AutoLanguageClient {

let pyls = atom.config.get("ide-python.pyls") || "pylsp"
// check if it exists
try {
execFileSync(pyls, ["--help"], { stdio: "inherit" })
} catch (e) {
console.error(e)
if (whichSync(pyls, { nothrow: true }) === null) {
pyls = "pyls"
}
const childProcess = super.spawn(python, ["-m", pyls], {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"untildify": "3.0.2",
"vscode-debugadapter": "1.24.0",
"vscode-debugprotocol": "1.24.0",
"which": "^2.0.2",
"xml2js": "0.4.17"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a2c8444

Please sign in to comment.