Skip to content

Commit 7725cd5

Browse files
mrclaryccordoba12
andcommitted
Apply suggestions from code review
Co-authored-by: Carlos Cordoba <[email protected]>
1 parent ee29549 commit 7725cd5

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

Diff for: CONFIGURATION.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This server can be configured using the `workspace/didChangeConfiguration` metho
2121
| `pylsp.plugins.flake8.select` | `array` of unique `string` items | List of errors and warnings to enable. | `null` |
2222
| `pylsp.plugins.jedi.auto_import_modules` | `array` of `string` items | List of module names for jedi.settings.auto_import_modules. | `["numpy"]` |
2323
| `pylsp.plugins.jedi.extra_paths` | `array` of `string` items | Define extra paths for jedi.Script. | `[]` |
24-
| `pylsp.plugins.jedi.prioritize` | `boolean` | Whether to place extra_paths at the beginning (true) or end (false) of `sys.path` | `false` |
24+
| `pylsp.plugins.jedi.prioritize_extra_paths` | `boolean` | Whether to place extra_paths at the beginning (true) or end (false) of `sys.path` | `false` |
2525
| `pylsp.plugins.jedi.env_vars` | `object` | Define environment variables for jedi.Script and Jedi.names. | `null` |
2626
| `pylsp.plugins.jedi.environment` | `string` | Define environment for jedi.Script and Jedi.names. | `null` |
2727
| `pylsp.plugins.jedi_completion.enabled` | `boolean` | Enable or disable the plugin. | `true` |

Diff for: pylsp/config/schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
},
152152
"description": "Define extra paths for jedi.Script."
153153
},
154-
"pylsp.plugins.jedi.prioritize": {
154+
"pylsp.plugins.jedi.prioritize_extra_paths": {
155155
"type": "boolean",
156156
"default": false,
157157
"description": "Whether to place extra_paths at the beginning (true) or end (false) of `sys.path`"

Diff for: pylsp/workspace.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def jedi_script(self, position=None, use_document_path=False):
521521
extra_paths = []
522522
environment_path = None
523523
env_vars = None
524-
prioritize = False
524+
prioritize_extra_paths = False
525525

526526
if self._config:
527527
jedi_settings = self._config.plugin_settings(
@@ -538,7 +538,7 @@ def jedi_script(self, position=None, use_document_path=False):
538538

539539
extra_paths = jedi_settings.get("extra_paths") or []
540540
env_vars = jedi_settings.get("env_vars")
541-
prioritize = jedi_settings.get("prioritize")
541+
prioritize_extra_paths = jedi_settings.get("prioritize_extra_paths")
542542

543543
# Drop PYTHONPATH from env_vars before creating the environment to
544544
# ensure that Jedi can startup properly without module name collision.
@@ -547,8 +547,7 @@ def jedi_script(self, position=None, use_document_path=False):
547547
env_vars.pop("PYTHONPATH", None)
548548

549549
environment = self.get_enviroment(environment_path, env_vars=env_vars)
550-
551-
sys_path = self.sys_path(environment_path, env_vars, prioritize, extra_paths)
550+
sys_path = self.sys_path(environment_path, env_vars, prioritize_extra_paths, extra_paths)
552551

553552
project_path = self._workspace.root_path
554553

@@ -585,15 +584,15 @@ def get_enviroment(self, environment_path=None, env_vars=None):
585584
return environment
586585

587586
def sys_path(
588-
self, environment_path=None, env_vars=None, prioritize=False, extra_paths=[]
587+
self, environment_path=None, env_vars=None, prioritize_extra_paths=False, extra_paths=[]
589588
):
590589
# Copy our extra sys path
591590
path = list(self._extra_sys_path)
592591
environment = self.get_enviroment(
593592
environment_path=environment_path, env_vars=env_vars
594593
)
595594
path.extend(environment.get_sys_path())
596-
if prioritize:
595+
if prioritize_extra_paths:
597596
path += extra_paths + path
598597
else:
599598
path += path + extra_paths

0 commit comments

Comments
 (0)