Skip to content

Commit a2c8444

Browse files
committed
fix: use which to detect pylsp
1 parent 01dfc6c commit a2c8444

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ coverage
77
build
88
dist
99
VendorLib
10+
.mypy_cache

lib/main.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { shell } = require("electron")
2-
const execFileSync = require("child_process").execFileSync
2+
const whichSync = require("which").sync
33
const { AutoLanguageClient } = require("atom-languageclient")
44
const { detectVirtualEnv, detectPipEnv, replacePipEnvPathVar, sanitizeConfig } = require("./utils")
55

@@ -53,10 +53,7 @@ class PythonLanguageClient extends AutoLanguageClient {
5353

5454
let pyls = atom.config.get("ide-python.pyls") || "pylsp"
5555
// check if it exists
56-
try {
57-
execFileSync(pyls, ["--help"], { stdio: "inherit" })
58-
} catch (e) {
59-
console.error(e)
56+
if (whichSync(pyls, { nothrow: true }) === null) {
6057
pyls = "pyls"
6158
}
6259
const childProcess = super.spawn(python, ["-m", pyls], {

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"untildify": "3.0.2",
6868
"vscode-debugadapter": "1.24.0",
6969
"vscode-debugprotocol": "1.24.0",
70+
"which": "^2.0.2",
7071
"xml2js": "0.4.17"
7172
},
7273
"devDependencies": {

pnpm-lock.yaml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)