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

Several inconsistencies found, trying to configure pylsp #1048

Open
michaelaye opened this issue Feb 6, 2024 · 16 comments
Open

Several inconsistencies found, trying to configure pylsp #1048

michaelaye opened this issue Feb 6, 2024 · 16 comments

Comments

@michaelaye
Copy link
Contributor

This project's main README describes installing an example server like so, using the Advanced Settings Editor:

{
  "language_servers": {
    "pyls": {
      "serverSettings": {
        "pyls.plugins.pydocstyle.enabled": true,
        "pyls.plugins.pyflakes.enabled": false,
        "pyls.plugins.flake8.enabled": true
      }
    },
    "r-languageserver": {
      "serverSettings": {
        "r.lsp.debug": false,
        "r.lsp.diagnostics": false
      }
    }
  }
}

But when trying to use the settings for Language Servers, since recently called "Language Servers (Experimental)", it seems one first needs to create a new language server with the right server name and manually activate it with a switch:

image

and then opening the JSON Settings Editor, some of the JSON keywords seem to not match above given instructions:

image

i.e.:

  • language_servers is now languageServers
  • and pyls(p).serverSettings is now pyls(p).configuration

(indicating the recommended replacement of pyls with pylsp).

Note, that this is just an observation of inconsistencies, while I tried to find out how to get a python lsp server running, which I haven't been able to do so far. Something has changed as I was able to do to so before, even wrote a medium post about it...

Another observation: Anytime I added a property using the GUI, the terminal log said:

2024-02-06 13:18:26,728 CET - WARNING - pylsp_jsonrpc.endpoint - Ignoring notification for unknown method $/setTrace
@krassowski
Copy link
Member

krassowski commented Feb 6, 2024

Language Servers (Experimental)

You do not have this extension installed (or enabled, or both). This is coming from JupyteLab 4.0+ and is non functional without this extension (or another one). This extension replaces Language Servers (Experimental) with Language Servers

@krassowski
Copy link
Member

Personally I am not happy that upstream includes Language Servers (Experimental) but no LSP features (which are in this extension) - if it has no features, I would prefer it to not show that settings page at all, but was told that I can just replace it downstream here so here we are. Also there is so much I can do convincing other to embrace LSP features upstream. It really comes down to users voice (and funding).

@krassowski
Copy link
Member

Feel welcome to submit PR replacing pyls with pylsp in readme :)

@michaelaye
Copy link
Contributor Author

Ugh, that one escaped me, I had jupyter-lsp, and jupyter-lsp-python, but not that one. Ironically, I wrote it correct in my old blog post, but STILL overlooked it now. :( Will send a PR.

@michaelaye
Copy link
Contributor Author

Hm, now i don't have ANY language server settings shown anymore.. because I filled something into the experimental settings?

@michaelaye
Copy link
Contributor Author

still have some stuff disabled, don't understand difference between @jupyterlab/lsp-extension (disabled) and @jupyter-lsp/jupyterlab-lsp (enabled). still no settings there, hmpf.

@krassowski
Copy link
Member

Can you try choosing and reopening settings tab? There is a known issue with some settings categories not showing up when loading for the first time with Settings editor open.

If it suits not help, is there anything in the browser console?

@michaelaye michaelaye mentioned this issue Feb 6, 2024
4 tasks
@michaelaye
Copy link
Contributor Author

michaelaye commented Feb 6, 2024

created new clean env and only installed jupyterlab-lsp and jupyter-lsp-python.

Settings still do not appear, but pylsp is being loaded.
This is in the console:

image

@michaelaye
Copy link
Contributor Author

possibly more important context before that:

image

@krassowski
Copy link
Member

Yes, this one suggests that you may have an invalid setting in pylsp.configurationSources. It should be either pyflakes of pyflakes:

"pylsp.configurationSources": {
"type": "array",
"default": ["pycodestyle"],
"description": "List of configuration sources to use.",
"items": {
"type": "string",
"enum": ["pycodestyle", "pyflakes"]
},
"uniqueItems": true
},

Can you check/clear your settings? These are stored on disk in a path indicated by jupyter lab path under @jupyter-lsp/jupyterlab-lsp/plugin.jupyterlab-settings.

@krassowski
Copy link
Member

Wait, you should not need to edit files on disk. You should be able to access the panel in the JSON Settings Editor

@michaelaye
Copy link
Contributor Author

Sorry, i don't know how to get to the pylsp settings with the JSON Settings Editor when they don't appear in the list:

image

@krassowski
Copy link
Member

Thank you, this is a bug. It should be there even if validation fails.

@krassowski
Copy link
Member

What about editing the file on disk?

@michaelaye
Copy link
Contributor Author

michaelaye commented Feb 6, 2024

yes, i removed my settings folder for jupyterlab-lsp and now the entry appears in the settings UI, thanks!

@michaelaye
Copy link
Contributor Author

Maybe i should open another DOCS issue about this, but I can't find on how to activate notebook formatting (for example isort or yapf) using pylsp in the notebook? I only find advice on how to run pylsp in the terminal...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants