2022-01-01 11:42:28 +01:00
|
|
|
diff --git a/pylsp/config/schema.json b/pylsp/config/schema.json
|
2022-01-07 16:34:21 +01:00
|
|
|
index c29d78b..4f30101 100644
|
2022-01-01 11:42:28 +01:00
|
|
|
--- a/pylsp/config/schema.json
|
|
|
|
+++ b/pylsp/config/schema.json
|
|
|
|
@@ -69,6 +69,14 @@
|
|
|
|
"default": null,
|
|
|
|
"description": "List of errors and warnings to enable."
|
|
|
|
},
|
|
|
|
+ "pylsp.plugins.jedi.auto_import_modules": {
|
|
|
|
+ "type": "array",
|
2022-01-07 16:34:21 +01:00
|
|
|
+ "default": ["numpy", "gi"],
|
2022-01-01 11:42:28 +01:00
|
|
|
+ "items": {
|
|
|
|
+ "type": "string"
|
|
|
|
+ },
|
|
|
|
+ "description": "List of module names for jedi to import (jedi.settings.auto_import_modules)."
|
|
|
|
+ },
|
|
|
|
"pylsp.plugins.jedi.extra_paths": {
|
|
|
|
"type": "array",
|
|
|
|
"default": [],
|
|
|
|
diff --git a/pylsp/workspace.py b/pylsp/workspace.py
|
2022-01-07 16:34:21 +01:00
|
|
|
index bf312f6..4758b53 100644
|
2022-01-01 11:42:28 +01:00
|
|
|
--- a/pylsp/workspace.py
|
|
|
|
+++ b/pylsp/workspace.py
|
|
|
|
@@ -14,6 +14,8 @@ from . import lsp, uris, _utils
|
2022-02-08 13:34:50 +01:00
|
|
|
|
2022-01-01 11:42:28 +01:00
|
|
|
log = logging.getLogger(__name__)
|
2022-02-08 13:34:50 +01:00
|
|
|
|
2022-01-07 16:34:21 +01:00
|
|
|
+DEFAULT_AUTO_IMPORT_MODULES = ["numpy", "gi"]
|
2022-01-01 11:42:28 +01:00
|
|
|
+
|
|
|
|
# TODO: this is not the best e.g. we capture numbers
|
|
|
|
RE_START_WORD = re.compile('[A-Za-z_0-9]*$')
|
|
|
|
RE_END_WORD = re.compile('^[A-Za-z_0-9]*')
|
|
|
|
@@ -252,6 +254,8 @@ class Document:
|
2022-02-08 13:34:50 +01:00
|
|
|
|
2022-01-01 11:42:28 +01:00
|
|
|
if self._config:
|
|
|
|
jedi_settings = self._config.plugin_settings('jedi', document_path=self.path)
|
|
|
|
+ jedi.settings.auto_import_modules = jedi_settings.get('auto_import_modules',
|
|
|
|
+ DEFAULT_AUTO_IMPORT_MODULES)
|
|
|
|
environment_path = jedi_settings.get('environment')
|
|
|
|
extra_paths = jedi_settings.get('extra_paths') or []
|
|
|
|
env_vars = jedi_settings.get('env_vars')
|