Integration with ALE?
Hi,
I already like what you are doing with nvim, and the remote LSP functionality will be very useful, so I don't want to pile on any additional feature requests. I was more wondering on your perspective on how such a workflow would look for you.
I mostly work in Python and run formatters such as black and isort on every save. Of course I currently work in ssh mostly (but would love to get rid of the input lag).
How would this integrate with "distant" in your view? Formatters run on remote (would distant auto-sync the changed files?)? Or formatters somehow run locally on the buffer? Or would this best be integrated with format.nvim?
Thanks and great work. Very much looking forward to telescope integration!
TLDR; I would want distant to support this where formatters run on the remote machine, but it requires an update to distant where it watches files for changes and reports back. I'll add it to my backlog. :)
It's a good question. There are two different ways this could be done and would be dependent on how the formatter works.
-
Remote formatter: The formatters would run on the remote machine just like language servers. When you want to perform any formatting, you would use distant to kick off the formatter on the remote machine and report back whatever formatters normally communicate. The feature that distant would need to support is watching files for changes. Today, if a formatter ran, you would need to manually reload the file to see the changes using
:e. -
Local formatter: Alternatively, distant.nvim could write out the current buffer to a file, run local formatters on that file, and then load the file back into the buffer. Distant.nvim would then need to send the changes over to the remote machine so we actually do the change.
I'd given it some thought in the past, so here's my answer. Personally, I'm a fan of the first option as it keeps all of the tooling on the remote machine and doesn't require me to install anything project-specific on my local machine. This does require a little more work to be done in distant first.
I agree that option one would be better. Some formatters rely on options e.g. in pyproject.toml for configuration, and those would in general only be available on the remote machine. Great to hear it is part of the backlog!
@hhoeflin as a heads up, the newest distant binary (0.16.0 and higher) supports file watching now. There's a branch of this repo that has rewritten the plugin to use the new binary and support that feature.
It doesn't yet support formatters officially, though. Some smaller changes are needed for that to happen, but the bulk of work is done.
Closing this out. An integration with ale is definitely possible and could be done through a mixture of wrapping ALE LSP programs and configuring to watch files for changes.
Not something that will be tackled directly by this plugin, at least not right now since I do not have time nor do I use ALE. Feel free to open a discussion topic if you want this to continue, though!