File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,21 @@ 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
+ pyls = "pyls"
54
+ }
55
+ // cache
56
+ this . pyls = pyls
57
+ }
58
+ return this . pyls
59
+ }
60
+
48
61
mapConfigurationObject ( configuration ) {
49
- const lsp = configuration . pyls || "pylsp"
62
+ const lsp = this . getPyLs ( )
50
63
return {
51
64
[ lsp ] : {
52
65
configurationSources : configuration . pylsConfigurationSources ,
@@ -71,13 +84,7 @@ class PythonLanguageClient extends AutoLanguageClient {
71
84
72
85
this . python = replacePipEnvPathVar ( pythonBin , venvPath )
73
86
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 ( ) ] , {
81
88
cwd : projectPath ,
82
89
env : pylsEnvironment ,
83
90
} )
You can’t perform that action at this time.
0 commit comments