superlou / lapce-python

Python LSP plugin for the Lapce editor
MIT License
22 stars 4 forks source link

run any lsp from the configuration #1

Closed dholth closed 2 years ago

dholth commented 2 years ago

Thanks for creating lapce-python. I was able to get debugging output from the terminal, but it doesn't do anything for my Python code just yet. I copied lapce-rust's main.rs and edited it so that it just runs any language server from the configuration file.

superlou commented 2 years ago

@dholth, thanks! I am in a similar place, I think. The LSP is starting because I can see it create a log file, but I don't think Lapce is sending it any requests as the log is empty. Are you building Lapce from the go-lang PR or from the current master?

dholth commented 2 years ago

I am not building Lapce at all, I just downloaded it.

superlou commented 2 years ago

Ah. The developer for that PR is recently back and is hopefully going to update it to the latest Lapce master. It seems like they needed to make some changes to the LSP interface in Lapce to get the support they were looking for. That said, the lapce-rust plugin works on master.

superlou commented 2 years ago

In hindsight, we should figure out a way to not have our user paths in the plugin.toml file :)

dholth commented 2 years ago

The os environment $HOME etc. isn't sent to the plugin

nheuillet commented 2 years ago

Hello @dholth , As plugins are run in sandboxed wasi runtime, no env variable is passed by default. On my PR ( golang support ), I bypassed this problem by adding an env_command option, which executes a specified command at plugin start to generate this env. Can you please try to look into my Golang plug-in to check if you can reproduce the same behaviour ? there is a good chance it might help you to generate more logs or at least make the Python plugin usable

dholth commented 2 years ago

golang sends env https://github.com/lapce/lapce/blob/7881e86e9d5d37c596518362363170fe5f5305a4/lapce-proxy/src/plugin.rs#L182 lgtm I'll let you know if I can try it with the plugin

nheuillet commented 2 years ago

@dholth Yes but the env variable you are pointing at is generated using the command specified here: https://github.com/nheuillet/lapce-go/blob/e1ec920a7b7aeb72220bfe54ef5505c1ab6b428a/plugin.toml#L11

In any case, I added an issue here related to the python lsp that you might be interested in

dholth commented 2 years ago

I see now, the plugin gets the options, then the wasi plugin sends those options back to the editor over json, then the editor responds to that message by starting our separate language server binary, then the options could be processed again but only in the branch to set command line arguments for the lsp.