jupyterlab-lsp
jupyterlab-lsp copied to clipboard
Finding globally-jlpm-installed Node-based language servers
Raising this as a feature request for now, because I couldn't really see explicit discussion of it on the Language Servers doc, but still not 100% sure whether what I'm seeing is working as designed?
Elevator Pitch
As an ML environment administrator, I'd sometimes like to install Node-based language servers globally for our users (i.e. jlpm global add --dev ...
), instead of locally, so they don't clutter up the JupyterLab folder view.
Today, trying this global
install command with bash-language-server
for example didn't seem to work.
Motivation
Although I understand installing node modules locally brings benefits for consistency on a project, some data scientist personas are unfamiliar with NodeJS and confused by install artifacts.
Observed Behavior
When running the following command (and restarting the Jupyter server / refreshing the page), I see LSP correctly initializes with bash support. However, the package.json
, yarn.lock
and node_modules
get created in local folder which I'm trying to avoid:
jlpm add --dev bash-language-server
Instead using this alternative command (likewise restarting/refreshing), the server package seems to be installed under ~/.config/yarn/global/node_modules
but LSP seems not to find it ("Additional servers needed"):
jlpm global add --dev bash-language-server
I'm running on Amazon SageMaker Studio's recently launched JupyterLab v3.3 environment - which I appreciate is a bit custom/specific, so apologies if this is just a misconfiguration somewhere & would appreciate your help finding it! But I noticed the language server doc didn't seem to make any mention of global installs, so maybe it's not supported?
Perhaps as a workaround we could explicitly configure bash via language_servers, but I had a tough time digging out where the default/auto-detected configuration for these known language servers lives? I.e. what would the standard argv
be?
Design Ideas
(If it doesn't already), I think it would be useful for jupyter-lsp's auto-detection to also detect global NPM/yarn/jlpm install locations for Node-based language servers. It'd also be great if the docs could be improved to help users look up what the default configurations for each of the "known" language servers is? I couldn't find this easily from fishing around in either my Jupyter config folders or this code repo.
Would #731 solve this?
As I understand, jlpm
is a Jupyter-provided version of yarn
, rather than npm
.
From a quick test on my SageMaker Studio environment I found that npm prefix -g
(/opt/conda/envs/studio) yields a different folder than jlpm global dir
(/home/sagemaker-user/.config/yarn/global) - and hence packages globally installed via jlpm global add XYZ
end up in a different place than npm install -g XYZ
.
So I believe what we'll see is that jupyterlab-lsp picks up packages globally installed by NPM but not by Yarn/JLPM - but haven't had a chance to fully test and be sure. That wouldn't be ideal (and may be worth calling out in the docs), but seems like an improvement!