palantir / python-language-server

An implementation of the Language Server Protocol for Python
MIT License
2.6k stars 283 forks source link

Allow the language server implementation to be used by other projects #681

Closed suoto closed 4 years ago

suoto commented 4 years ago

I have this language server that relies on pyls.python_ls.PythonLanguageServer for the low level LSP interface, and I wonder if the language server logic - an abstract language server implementation if you will - could be extracted and made available as an independent Python module, so that I (and hopefully others) can use basically subclass pyls.python_ls.PythonLanguageServer directly, without other side effects like installing the pyls executable.

Not sure how often this is asked, I could fork this repo and remove the plugin portion, but would be great to hear your thoughts.

Thanks!

gatesn commented 4 years ago

What are you trying to do specifically? We have a custom version of the language server by calling the pyls executable, but by adding custom plugins and disabling unwanted ones.

This mostly allows for arbitrary extensibility.

Is the aim to create a non-Python LS?

suoto commented 4 years ago

Yes, I'm using pyls as a base for a non-Python LS and I know pyls is a Python LS :)

Considering that every LS out there needs JSON stdin/stdout interface, RPC method dispatching and workspace doc management in addition to its own language specific code, it seemed to me that reusing an existing LS is more efficient than keeping my own implementation of it.

ccordoba12 commented 4 years ago

@suoto, what you need was already done by this project:

https://github.com/openlawlibrary/pygls

suoto commented 4 years ago

Will have a look, thanks @ccordoba12!