-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: add --stdio option #19
Conversation
edeeb1d
to
3f79e72
Compare
3f79e72
to
e9cb7b0
Compare
[RefactorEx](https://github.com/gp-pereira/refactorex) is an LSP server that allows for refactoring Elixir code. It adds the ability to rename symbols via `vim.lsp.buf.rename()` and various code actions. Right now it uses an intermediary repository, https://github.com/synic/refactorex-mason to download the sourcecode, patch it to support the stdio transport, and create a launch script to use the stdio transport. Hopefully in the future this intermediary repository won't be necessary, once refactorex itself supports stdio (gp-pereira/refactorex#19).
[RefactorEx](https://github.com/gp-pereira/refactorex) is an LSP server that allows for refactoring Elixir code. It adds the ability to rename symbols via `vim.lsp.buf.rename()` and various code actions. Right now it uses an intermediary repository, https://github.com/synic/refactorex-mason to download the sourcecode, patch it to support the stdio transport, and create a launch script to use the stdio transport. Hopefully in the future this intermediary repository won't be necessary, once refactorex itself supports stdio (gp-pereira/refactorex#19).
Hi there, first of all, thanks for the PR, neovim support was already on my roadmap, but I wasn't expecting it so soon. It's super nice for me to see people are interested in the tool I've built. Your changes seem to work for me as well. But how about updates? As soon as I update the repository, neovim users get the newest versions? Can you handle this mason registry submittion or do you want me to tackle it? |
Once it is in mason, yes, they will automatically be notified of a new version and they'll be able to update. I've started the process of submitting it (though I will need to modify it now because the intermediary repository isn't necessary anymore - that was only there to apply the stdio support patch) |
Thanks man, you're my hero! Let me know if you need anything else to make it work. |
No sir, you are the hero! I'm new to Elixir, but after years of Python, Typescript, and Go, I found the LSP situation in Elixir to be less than ideal. Your work certainly helps bridge the gap quite a bit. Only thing needed is a new release published (actually just a new tag) - definition looks like this: ---
name: refactorex
description: Language server allowing for refactoring Elixir code
homepage: https://github.com/gp-pereira/refactorex
licenses:
- MIT
languages:
- Elixir
categories:
- LSP
source:
# renovate:datasource=github-tags
id: pkg:github/gp-pereira/[email protected]
build:
run: mix deps.get && mix compile
bin: exec:bin/start-stdio
bin:
refactorex: "{{source.build.bin}}" When you post a new code update, the Later on, if you want to move/rename things in the repository, we can do version based overrides |
Amazing! v0.1.29 is already out for you. Do you really need the extra script? Can't use the regular bin/start and pass the flag on this definition that you sent me? No problem with that, just curious. There's an official Elixir LSP on its way and I hope to get my refactorings there so they're available for everyone could you link me the registry submittion when you sent it please? I'll ask a few neovim friends to give a try as well |
I tried to make it work without the extra script but couldn't get it figured out. Mason doesn't run the "bin" file directly, it creates a wrapper, or shim, to it (kinda like asdf), on Unix this is just a symlink. As far as I can tell, there's no way to have it create a wrapper with, or pass any arguments. I will ask when I create the PR. Maybe there's some hidden way to do it, and you can ditch that extra script. I will let you know (will probably be tomorrow) |
The [stdio PR](gp-pereira/refactorex#19) has been accepted and merged for 0.1.29, so the now unnecessary patch code has been removed.
I've created a neovim plugin for RefactorEx: https://github.com/synic/refactorex. This works for now, but it's not ideal. Ideally, it would be added to the mason registry at https://github.com/mason-org/mason-registry.
Mason is just a package manager for LSP servers (and DAP servers, etc), which allows a neovim user to easily search for and install lsp servers.
The trouble is, mason doesn't provide for configuring an lsp server with a tcp transport. As far as I can tell (happy to be proven wrong here), not one server in their registry uses any transport other than stdio. It seems most language servers, even the elixir based ones, all use stdio now (see elixir-ls or nextls).
Other benefits of using stdio vs tcp are that you don't have to hunt down a port or worry about any of that. I'm pretty sure VSCode can just use stdio too, and it might make the setup and usage less complicated and error prone.
I've tried this out, running
./bin/start --stdio
and then connecting to it via neovim just works. If/when this gets merged, I can then submit a PR to the mason registry, which will give all neovim users super easy access to RefactorEx