File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,8 +45,22 @@ class PythonLanguageClient extends AutoLanguageClient {
4545 return "ide-python"
4646 }
4747
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+
4862 mapConfigurationObject ( configuration ) {
49- const lsp = configuration . pyls || "pylsp"
63+ const lsp = this . getPyLs ( )
5064 return {
5165 [ lsp ] : {
5266 configurationSources : configuration . pylsConfigurationSources ,
@@ -71,13 +85,7 @@ class PythonLanguageClient extends AutoLanguageClient {
7185
7286 this . python = replacePipEnvPathVar ( pythonBin , venvPath )
7387
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 ( ) ] , {
8189 cwd : projectPath ,
8290 env : pylsEnvironment ,
8391 } )
You can’t perform that action at this time.
0 commit comments