Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings for uninstalled language servers #645

Merged
merged 3 commits into from
Jul 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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:

Expand Down
4 changes: 3 additions & 1 deletion python_packages/jupyter_lsp/jupyter_lsp/specs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,11 @@ 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,
Expand Down