From 10fe92a152bc5fca186faa13b92e11f822861578 Mon Sep 17 00:00:00 2001 From: Karla Spuldaro Date: Wed, 14 Jul 2021 16:38:54 -0400 Subject: [PATCH 1/3] Update broken link to Configuring doc --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f70a2eeec..1a3b5370b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -332,7 +332,7 @@ python scripts/lint.py ### Specs -While language servers can be configured by the user using a simple JSON or Python [configuration file](./Configuring.html#language-servers), +While language servers can be configured by the user using a simple JSON or Python [configuration file](./docs/Configuring.ipynb), it is preferable to provide users with an option that does not require manual configuration. The language server specifications (specs) wrap the configuration (as would be defined by the user) into a Python class or function that can be either: @@ -361,7 +361,7 @@ A spec is a Python callable (a function, or a class with `__call__` method) that The above example is only intended as an illustration and not as an up-to-date guide. For details on the dictionary contents, see the [schema][] definition and [built-in specs][]. -Basic concepts (meaning of the `argv` and `languages` arguments) are also explained in the [configuration files](./Configuring.html#language-servers) documentation. +Basic concepts (meaning of the `argv` and `languages` arguments) are also explained in the [configuration files](./docs/Configuring.ipynb) documentation. When contributing a specification we recommend to make use of the helper classes and other [utilities][] that take care of the common use-cases: From a916329d063366daa3ba98e8830e218b9460926d Mon Sep 17 00:00:00 2001 From: Karla Spuldaro Date: Wed, 14 Jul 2021 16:40:02 -0400 Subject: [PATCH 2/3] Fix argv None type warning --- python_packages/jupyter_lsp/jupyter_lsp/specs/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python_packages/jupyter_lsp/jupyter_lsp/specs/utils.py b/python_packages/jupyter_lsp/jupyter_lsp/specs/utils.py index 86ad2b6ed..2958803ac 100644 --- a/python_packages/jupyter_lsp/jupyter_lsp/specs/utils.py +++ b/python_packages/jupyter_lsp/jupyter_lsp/specs/utils.py @@ -141,9 +141,15 @@ def __call__(self, mgr: LanguageServerManagerAPI) -> KeyedLanguageServerSpecs: troubleshooting.append(spec["troubleshoot"]) spec["troubleshoot"] = "\n\n".join(troubleshooting) + is_installed = self.is_installed(mgr) + return { self.key: { - "argv": [mgr.nodejs, node_module, *self.args], + "argv": ( + [mgr.nodejs, node_module, *self.args] + if is_installed + else [] + ), "languages": self.languages, "version": SPEC_VERSION, **spec, From 7da93b4fe14f13cf29e782bcf5601a11cc9774ae Mon Sep 17 00:00:00 2001 From: Karla Spuldaro Date: Wed, 14 Jul 2021 18:01:31 -0400 Subject: [PATCH 3/3] Lint formatting --- python_packages/jupyter_lsp/jupyter_lsp/specs/utils.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/python_packages/jupyter_lsp/jupyter_lsp/specs/utils.py b/python_packages/jupyter_lsp/jupyter_lsp/specs/utils.py index 2958803ac..7b6862f34 100644 --- a/python_packages/jupyter_lsp/jupyter_lsp/specs/utils.py +++ b/python_packages/jupyter_lsp/jupyter_lsp/specs/utils.py @@ -142,14 +142,10 @@ def __call__(self, mgr: LanguageServerManagerAPI) -> KeyedLanguageServerSpecs: spec["troubleshoot"] = "\n\n".join(troubleshooting) is_installed = self.is_installed(mgr) - + return { self.key: { - "argv": ( - [mgr.nodejs, node_module, *self.args] - if is_installed - else [] - ), + "argv": ([mgr.nodejs, node_module, *self.args] if is_installed else []), "languages": self.languages, "version": SPEC_VERSION, **spec,