Hey guys! I am new to neovim and I'm really loving it. Today I was setting up lsp and I am stuck.
What python lsp would be better? As far as I know there are jedi, pyright, python-lsp-server.
There is [[https://www.reddit.com/r/neovim/comments/rjrytp/which_python_lsp_is_better/ | this]] but its quite old.
Python client library for Language Server Protocol (LSP) - Stack Overflow
Best python lsp?
what python lsp and linter
Which python lsp is better?
Videos
I am the author of multilspy, which is a LSP client in Python, with a library interface and is intended to be used to build applications around language servers. It handles the configuration and initialization of different language servers, and offers a simple interface. It currently supports running Eclipse JDT.LS for Java, rust-analyzer for Rust, OmniSharp for C# and jedi-language-server for Python. You can install it using pip by running:
pip install multilspy
Example usage of multilspy:
from multilspy import SyncLanguageServer
from multilspy.multilspy_config import MultilspyConfig
from multilspy.multilspy_logger import MultilspyLogger
...
config = MultilspyConfig.from_dict({"code_language": "java"}) # Also supports "python", "rust", "csharp"
logger = MultilspyLogger()
lsp = SyncLanguageServer.create(config, logger, "/abs/path/to/project/root/")
with lsp.start_server():
result = lsp.request_definition(
"relative/path/to/code_file.java", # Filename of location where request is being made
163, # line number of symbol for which request is being made
4 # column number of symbol for which request is being made
)
result2 = lsp.request_completions(
...
)
result3 = lsp.request_references(
...
)
...
I've discovered that, as of July 2023, there is a library named pygls (https://github.com/openlawlibrary/pygls) that is currently developing a usable client for the Language Server Protocol (LSP).
While we wait for the first official release, I've included it in my setup.py file under "install_requires". This ensures it will be automatically installed during the setup of my project. Here's how I modified the file:
install_requires=[
'pygls @ git+https://github.com/openlawlibrary/pygls.git'
]
With this line of code, pygls will be directly fetched from the GitHub repository and installed into your environment.
» pip install lsprotocol