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

document how to install the cli more clearly #178

Closed
leet0rz opened this issue Mar 21, 2024 · 16 comments · Fixed by #221
Closed

document how to install the cli more clearly #178

leet0rz opened this issue Mar 21, 2024 · 16 comments · Fixed by #221
Labels
documentation Improvements or additions to documentation vim/neovim

Comments

@leet0rz
Copy link

leet0rz commented Mar 21, 2024

After following the guide on installing from the market place and setting it up under lspconfig with lspconfig.basedpyright.setup{} I get this message when opening a py file:

[lspconfig] Cannot access configuration for basedpyright. Ensure this server is listed in 'server_configuration.md' or added as a custom server.

Usually when I get errors with other language servers its because its not in PATH and callable via terminal, but I am not sure what part of this needs to be in PATH for it to work, maybe you can help me with that.

@DetachHead
Copy link
Owner

@baco would you mind taking a look at this?

@baco
Copy link
Contributor

baco commented Mar 21, 2024

@leet0rz it seems you need to update nvim-lspconfig on your installation. The plugin can not find the specs for basedpyright, which were added to their code along last weekend. Are you using the Git dev version of the nvim-lspconfig plugin?

Try upgrading the plugin with the package manager you are using on your Neovim.

@leet0rz
Copy link
Author

leet0rz commented Mar 21, 2024

@leet0rz it seems you need to update nvim-lspconfig on your installation. The plugin can not find the specs for basedpyright, which were added to their code along last weekend. Are you using the Git dev version of the nvim-lspconfig plugin?

Try upgrading the plugin with the package manager you are using on your Neovim.

I am just using regular lspconfig as instructed from the repo with Neovim.
Now I've updated lspconfig via lazy.nvim and a different error shows up:

Spawning language server with cmd: 'table: 0x028c88ff4a58' failed. The language server is either not installed, missing from PATH, or not executable

I do have it installed as instructed through the marketplace of vscode. Guess my initial thought was on point from it missing in PATH? What file exactly does it call, what has to be in PATH for the terminal to be able to call this?

@baco
Copy link
Contributor

baco commented Mar 21, 2024

Excellent, I supposed that was the case (that you didn't have nvim-lspconfig up to date), because you see, that message you had:

[lspconfig] Cannot access configuration for basedpyright. Ensure this server is listed in 'server_configuration.md' or added as a custom server.

says it so:

Ensure this server is listed in 'server_configuration.md' or added as a custom server.

meaning “the plugin didn't know of any basedpyright thing”. Now it does.

The new error you are getting also says it so:

The language server is either not installed, missing from PATH, or not executable

Now, nvim-lspconfig knows in its registry of something called basedpyright, but the registry is telling it that should call the executable basedpyright-langserver and that's not on your PATH.

How do you install your LSP servers? Are you using mason + mason-lspconfig?

If you are using both, take into account that both of those plugins need to be up to date as well. mason is a registry of LSP servers, linters, debuggers, available for installation on Neovim, and mason-lspconfig takes care of the default configurations when nvim-lspconfig is up, and also auto-installs basedpyright (or any other LSP server), using mason under the hood. Both plugins had PRs merged for me during this week, adding the necessary settings for the workflow I describe. Update them, please.

If you are using neither, you can still install basedpyright manually using pip. I would recommend, in that case, using pipx for the installation (pipx install basedpyright) and ensure you have $HOME/.local/bin in your PATH, in the shell of your preference. Or, directly adding basedpyright in the virtual environment of the project you are developing (pip install basedpyright within the virtual environment of your project).

Tell us how it went!!

@leet0rz
Copy link
Author

leet0rz commented Mar 21, 2024

Excellent, I supposed that was the case (that you didn't have nvim-lspconfig up to date), because you see, that message you had:

[lspconfig] Cannot access configuration for basedpyright. Ensure this server is listed in 'server_configuration.md' or added as a custom server.

says it so:

Ensure this server is listed in 'server_configuration.md' or added as a custom server.

meaning “the plugin didn't know of any basedpyright thing”. Now it does.

The new error you are getting also says it so:

The language server is either not installed, missing from PATH, or not executable

Now, nvim-lspconfig knows in its registry of something called basedpyright, but the registry is telling it that should call the executable basedpyright-langserver and that's not on your PATH.

How do you install your LSP servers? Are you using mason + mason-lspconfig?

If you are using both, take into account that both of those plugins need to be up to date as well. mason is a registry of LSP servers, linters, debuggers, available for installation on Neovim, and mason-lspconfig takes care of the default configurations when nvim-lspconfig is up, and also auto-installs basedpyright (or any other LSP server), using mason under the hood. Both plugins had PRs merged for me during this week, adding the necessary settings for the workflow I describe. Update them, please.

If you are using neither, you can still install basedpyright manually using pip. I would recommend, in that case, using pipx for the installation (pipx install basedpyright) and ensure you have $HOME/.local/bin in your PATH, in the shell of your preference. Or, directly adding basedpyright in the virtual environment of the project you are developing (pip install basedpyright within the virtual environment of your project).

Tell us how it went!!

It seems to be working after doing pip install basedpyright, but would this all work if I did that from the start and not installing it through the vscode market place? I guess this puts it in PATH and makes it callable to neovim, my question is what exactly is the folder depth that made it work, would having site-packages\basedpyright in PATH work or would also site-packages being in PATH work?

@baco
Copy link
Contributor

baco commented Mar 22, 2024

I think so. The visualstudio marketplace is for VSCode extensions. I mean, if you knew already you were needing the LSP server for Neovim only, why bothering installing extensions for an editor you don't use?

But I don't think the documentation is misleading in that sense. There are separate sub-sections for each editor, and certainly the Neovim sub-section doesn't says anything about the visualstudio marketplace.

@leet0rz
Copy link
Author

leet0rz commented Mar 22, 2024

I think so. The visualstudio marketplace is for VSCode extensions. I mean, if you knew already you were needing the LSP server for Neovim only, why bothering installing extensions for an editor you don't use?

But I don't think the documentation is misleading in that sense. There are separate sub-sections for each editor, and certainly the Neovim sub-section doesn't says anything about the visualstudio marketplace.

I guess I did not see the section split there but in my defense I just checked your basedpyright front page, your installation page and lspconfig's basedpyright page. None of them have anything resembling pip install basedpyright, am I missing something or where exactly does it tell users how to install the language server?

Looking at these 3 links:
https://github.com/DetachHead/basedpyright
https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#basedpyright
And where you would think it would be:
https://github.com/DetachHead/basedpyright/blob/main/docs/installation.md

@baco
Copy link
Contributor

baco commented Mar 22, 2024

First of all, I wouldn't like to seal any project credits whatsoever. The project is not mine, I am just helping with the documentation regarding Neovim configuration (that's why DetachHead asked for my help here).

Having clarified that, the documentation does tell how to install the Command Line Interface standalone. Just the next section after all the editors configuration alternatives.

Whether it is among your specific needs to have it installed that way or not, is solely dependent on the setup of your Neovim, which this project doesn't intent to cover.

For instance, I don't need to install it that way, I use Mason, as many people does. And the documentation doesn't cover that installation method, because is one way to setup Neovim, not the LSP itself but Neovim as an editor. And as it is my preference to use an alternative setup for my Neovim, I should know how to deal with that if it wasn't working, perhaps go to ask to that project instead.

What I mean at this point is, that I think your first inquiry is valid, because perhaps you didn't know when nvim-lspconfig started to give support for this LSP server, and as such, you didn't know that you needed a really up to date version of that plugin. In time, there will be no need for clarification because everyone trying to try basedpyright will have a sufficient up to date version of nvim-lspconfig. But beyond that, I don't think the documentation is lacking information about installation.

@leet0rz
Copy link
Author

leet0rz commented Mar 22, 2024

First of all, I wouldn't like to seal any project credits whatsoever. The project is not mine, I am just helping with the documentation regarding Neovim configuration (that's why DetachHead asked for my help here).

Having clarified that, the documentation does tell how to install the Command Line Interface standalone. Just the next section after all the editors configuration alternatives.

Whether it is among your specific needs to have it installed that way or not, is solely dependent on the setup of your Neovim, which this project doesn't intent to cover.

For instance, I don't need to install it that way, I use Mason, as many people does. And the documentation doesn't cover that installation method, because is one way to setup Neovim, not the LSP itself but Neovim as an editor. And as it is my preference to use an alternative setup for my Neovim, I should know how to deal with that if it wasn't working, perhaps go to ask to that project instead.

What I mean at this point is, that I think your first inquiry is valid, because perhaps you didn't know when nvim-lspconfig started to give support for this LSP server, and as such, you didn't know that you needed a really up to date version of that plugin. In time, there will be no need for clarification because everyone trying to try basedpyright will have a sufficient up to date version of nvim-lspconfig. But beyond that, I don't think the documentation is lacking information about installation.

Considering this is a python language server, there is nothing up front on the front page of the repo or under the installation guide that tells us how to install it. The neovim part tells us how to set it up under lspconfig as with everything else and that is simple like with any other language server, but that is "usage", not "installation" . If its hidden behind the command-line section that's something entirely different, which will cause confusion. Most of the time the global way to install the language server is right up front in the repo under "installation > pip install blabla", not hidden under layers of abstraction.

Most of the people who use neovim and actually program it ourselves see mason as just bloatware, it's usually better to go to the repo, install the language server yourself and put the language server in PATH so it's callable for neovim, there is no reason to use mason for this, it's just another plugin that can break and provide errors like we've seen with so many of our users in our neovim discord. We usually recommend staying away from mason for that exact reason.

Anyway, thanks for letting me know it was just a simple pip package.

Last question, does it not support pyside6 yet? It does not seem to recognize when I import pyside6 functionality. No issues while using regular pyright or jedi. Thanks.

@baco
Copy link
Contributor

baco commented Mar 22, 2024

Most of the time the global way to install the language server is right up front in the repo under "installation > pip install blabla", not hidden under layers of abstraction.

Yeahp... there is no solution about the unwillingness to read the whole documentation 😕. But you could improve on that by offering a PR instead, highlighting the parts you consider are most important. I'm sure @DetachHead will appreciate that other approach better.

Last question, does it not support pyside6 yet? It does not seem to recognize when I import pyside6 functionality. No issues while using regular pyright or jedi. Thanks.

I don't know, not a Qt fan myself. Perhaps @DetachHead has more insight about that.

@DetachHead
Copy link
Owner

DetachHead commented Mar 23, 2024

Most of the time the global way to install the language server is right up front in the repo under "installation > pip install blabla", not hidden under layers of abstraction.

the reason i didn't put pip install basedpyright front and center is because there are many different and better tools nowadays people use to install pypi packages, such as pdm and poetry (edit: actually you shouldn't use poetry), so i figured it was better to just link to the package on the pypi website instead.

Last question, does it not support pyside6 yet? It does not seem to recognize when I import pyside6 functionality. No issues while using regular pyright or jedi. Thanks.

if you’re running into issues importing things it may be the same issue as #158. i haven’t been able to reproduce any issues importing 3rd party packages though, so if you could produce a minimal example that would be appreciated

@DetachHead DetachHead added documentation Improvements or additions to documentation and removed help wanted labels Mar 24, 2024
@DetachHead DetachHead changed the title Cannot access configuration for basedpyright. document how to install the cli more clearly Mar 29, 2024
@DetachHead
Copy link
Owner

i added one of these thingies to the installation instructions:

image

hope this makes it more clear

@leet0rz
Copy link
Author

leet0rz commented Apr 4, 2024

i added one of these thingies to the installation instructions:

image

hope this makes it more clear

I would put that at the top or similar to tmux's repo right at the front page and not near the bottom. But that's just me, you do you. I'll get back to checking in more on the pyqt/pyside issue a bit later.

@gennaro-tedesco
Copy link

Probably part of the confusion is generated by the fact that the terminology "installation instruction" points to

local lspconfig = require("lspconfig")
lspconfig.basedpyright.setup{}

and that should be re-named as "neovim configuration instructions" or the like, the installation pointing to a generic way to install a python program as per here. For people who are unfamiliar to language servers (and come from IDE packaged solutions) it's unclear that a language server is a program that must be installed on your computer first and only then configured in your editor - which is why pointing the installation instructions to neovim configuration might generate confusion for some.

@KotlinIsland
Copy link
Collaborator

@gennaro-tedesco please feel free to file another issue if you think an improvement could be made here.

@DetachHead
Copy link
Owner

@gennaro-tedesco thanks for pointing this out, i noticed the pycharm extension also requires the pypi package to be installed so i updated the docs in #366

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation vim/neovim
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants