nvimdots icon indicating copy to clipboard operation
nvimdots copied to clipboard

Python lsp better choice?

Open ayamir opened this issue 1 year ago • 11 comments

Feature description

As we discussed in #815, current pylsp doesn't support inlay-hint. Welcome for python developers to discuss a better choice.

Additional information

No response

ayamir avatar Feb 11 '24 02:02 ayamir

As @Jint-lzxy said, the license terms of pylance explicitly prevent us from using it with anything other than the MS builds of VSCode, including VSCodium (AFAIK, at least)..

ayamir avatar Feb 11 '24 02:02 ayamir

Honestly, I'm waiting for Astral (the company that builds Ruff) to build a type checker, haha.

Will then use whatever they are cooking up there.

aarnphm avatar Feb 17 '24 14:02 aarnphm

seems very interesting https://github.com/astral-sh/ruff-lsp https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#ruff_lsp

ruff-lsp supports surfacing Ruff diagnostics and providing Code Actions to fix them, but is intended to be used alongside another Python LSP in order to support features like navigation and autocompletion.

also, astral's new "pip" looks freaking fast too! https://github.com/astral-sh/uv https://youtu.be/YKDpiOU77xY

CharlesChiuGit avatar Feb 19 '24 15:02 CharlesChiuGit

already migrate my whole workflow to uv and rye haha

aarnphm avatar Feb 19 '24 15:02 aarnphm

already migrate my whole workflow to uv and rye haha

I guess it's this one? https://github.com/mitsuhiko/rye

from my interpretation, it looks like u purely use uv to install python pkgs and rye to manage the project env?

CharlesChiuGit avatar Feb 20 '24 02:02 CharlesChiuGit

ye, think of rye as better pdm

aarnphm avatar Feb 20 '24 14:02 aarnphm

Take a look at this pyright fork repository basedpyright which supports a number of features missing from pylsp.

Mythos-404 avatar Mar 18 '24 05:03 Mythos-404

Take a look at this pyright fork repository basedpyright which supports a number of features missing from pylsp.

nice. and it's now supported by nvim-lspconfig. worth a shoot.

CharlesChiuGit avatar Mar 18 '24 07:03 CharlesChiuGit

i think it's very hard to do the migration if we're talking about 1-to-1 mapping.

Take ruff as an example, we use it as a linter/formatter right now. So if we need to separate it from our current LSP, which is pylsp, we need to config ruff in none-ls, and it's quite hard to do since ruff doesn't provide well-documented way to config in cli, but only file-based configs.

If we make a file-based config, then we need to add that file in ruff's none-ls config to make it valid, and that will conflict with user's project ruff config.

i dont think there's a KISS way to do default config with basedpyright + ruff + black.

CharlesChiuGit avatar Apr 22 '24 08:04 CharlesChiuGit

Honestly, I'm waiting for Astral (the company that builds Ruff) to build a type checker, haha.

Will then use whatever they are cooking up there.

@aarnphm isn't ruff have type checker within? Or where can i check their road map?

CharlesChiuGit avatar Apr 22 '24 09:04 CharlesChiuGit

ruff is not a type checker, it is a linter. the LSP is just a lint server.

aarnphm avatar Apr 23 '24 08:04 aarnphm