Skip to content

Commit 5037c16

Browse files
committed
Move plugins.jedi.extra_paths handling into Document.sys_path()
Before this commit, plugins.jedi.extra_paths configuration is used only at execution of jedi.Script in Document.jedi_script(). Therefore, at spawning a process for other plugins (e.g pylint), such extra paths are ignored. It might causes unintentional failure of finding out libraries installed into those locations, even though Jedi can find out. After this commit, just using Document.sys_path() instead of sys.path is enough path configuration for any plugins.
1 parent 40a5e77 commit 5037c16

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pyls/workspace.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,13 @@ def jedi_names(self, all_scopes=False, definitions=True, references=False):
230230
)
231231

232232
def jedi_script(self, position=None):
233-
extra_paths = []
234233
environment_path = None
235234

236235
if self._config:
237236
jedi_settings = self._config.plugin_settings('jedi', document_path=self.path)
238237
environment_path = jedi_settings.get('environment')
239-
extra_paths = jedi_settings.get('extra_paths') or []
240238

241-
sys_path = self.sys_path(environment_path) + extra_paths
239+
sys_path = self.sys_path(environment_path)
242240
environment = self.get_enviroment(environment_path) if environment_path else None
243241

244242
kwargs = {
@@ -272,4 +270,11 @@ def sys_path(self, environment_path=None):
272270
path = list(self._extra_sys_path)
273271
environment = self.get_enviroment(environment_path=environment_path)
274272
path.extend(environment.get_sys_path())
273+
274+
if self._config:
275+
jedi_settings = self._config.plugin_settings('jedi', document_path=self.path)
276+
extra_paths = jedi_settings.get('extra_paths')
277+
if extra_paths:
278+
path.extend(extra_paths)
279+
275280
return path

0 commit comments

Comments
 (0)