File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,22 @@ class PythonLanguageClient extends AutoLanguageClient {
45
45
return "ide-python"
46
46
}
47
47
48
+ getPyLs ( ) {
49
+ if ( this . pyls === undefined ) {
50
+ let pyls = atom . config . get ( "ide-python.pyls" ) || "pylsp"
51
+ // check if it exists
52
+ if ( whichSync ( pyls , { nothrow : true } ) === null ) {
53
+ // use the other one if it doesn't exist
54
+ pyls = pyls === "pylsp" ? "pyls" : "pylsp"
55
+ }
56
+ // cache
57
+ this . pyls = pyls
58
+ }
59
+ return this . pyls
60
+ }
61
+
48
62
mapConfigurationObject ( configuration ) {
49
- const lsp = configuration . pyls || "pylsp"
63
+ const lsp = this . getPyLs ( )
50
64
return {
51
65
[ lsp ] : {
52
66
configurationSources : configuration . pylsConfigurationSources ,
@@ -71,13 +85,7 @@ class PythonLanguageClient extends AutoLanguageClient {
71
85
72
86
this . python = replacePipEnvPathVar ( pythonBin , venvPath )
73
87
74
- let pyls = atom . config . get ( "ide-python.pyls" ) || "pylsp"
75
- // check if it exists
76
- if ( whichSync ( pyls , { nothrow : true } ) === null ) {
77
- pyls = "pyls"
78
- }
79
-
80
- const childProcess = super . spawn ( this . python , [ "-m" , pyls ] , {
88
+ const childProcess = super . spawn ( this . python , [ "-m" , this . getPyLs ( ) ] , {
81
89
cwd : projectPath ,
82
90
env : pylsEnvironment ,
83
91
} )
You can’t perform that action at this time.
0 commit comments