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,21 @@ 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+ pyls = "pyls"
54+ }
55+ // cache
56+ this . pyls = pyls
57+ }
58+ return this . pyls
59+ }
60+
4861 mapConfigurationObject ( configuration ) {
49- const lsp = configuration . pyls || "pylsp"
62+ const lsp = this . getPyLs ( )
5063 return {
5164 [ lsp ] : {
5265 configurationSources : configuration . pylsConfigurationSources ,
@@ -71,13 +84,7 @@ class PythonLanguageClient extends AutoLanguageClient {
7184
7285 this . python = replacePipEnvPathVar ( pythonBin , venvPath )
7386
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 ] , {
87+ const childProcess = super . spawn ( this . python , [ "-m" , this . getPyLs ( ) ] , {
8188 cwd : projectPath ,
8289 env : pylsEnvironment ,
8390 } )
You can’t perform that action at this time.
0 commit comments