-
Notifications
You must be signed in to change notification settings - Fork 701
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
Plugins and (G)UI #160
Comments
I've been thinking about this for a while, and I have some thoughts: A goal of the project is to support a variety of frontends, but also to take advantage of native UI as much as possible. With this in mind, I think that specific UI idioms and implementations need to be left up to the front end, but standards can be described for many common plugin tasks. Off the top of my head, I think standard message formats and names would work for autocompletion, status bar items, tooltips, and gutter items. In some of these cases, it might even make sense for a plugin to contain image assets. By this I mean: a plugin which offers completion suggestions should return results in a standard format, and a front-end should present these results with whatever UI is appropriate. I do think that there are potentially helpful plugins where this fails; these are cases where much of the real work is in designing the interface, or in doing drawing. It might be nice to have a minimap plugin, for instance, but this wouldn't make a ton of sense in xi-tui. So my basic current thinking is that plugins should be implementation agnostic, should fail well, and that should be some thought to allowing platform-specific plugins. Curious to see what others think. :) |
A common frontend API seems to me like the most reasonable approach as well. In some sense, such an API would not even be specific to Xi. Instead, it would provide a general description of common text editor UI idioms, as well as a message format. Any text editor could decide to provide this API, even it is does not use the Xi core. Even better, it would be possible to write plugins for other editors which translate incoming messages into editor-native API calls. In the best case, this results in an easy way to write cross-editor plugins. Here are some further issues that would need to be adressed if chosing this direction:
|
It might be worth looking at Microsoft's language server protocol (blog post) for inspiration, here? I think one of my next steps will be trying to play around with the implementation of some UI-dependant plugin, to try and get a sense for how that interaction feels. |
There is a key difference to the LSP though. The LSP is about giving information with predefined semantics to the editor, which than handles it as it deems fit. The editor frontend protocol would basically do the opposite: Send abritrary data to the editor, which then presents it in a specific way. So the two protocols would nicely complement each other. edit: Actually, I'm not so sure about this anymore. The LSP includes features like notifications or completions. Although one could argue that autocompletion should not be part of the frontend protocol, since it needs to be requested by the editor. And notifications don't really fit into the LSP, there is nothing language specific about them. They are just communication between a plugin and the editor, which is what the frontend protocol should be about. |
It's been a couple months since the last update here and it appears that the community is starting to coalesce around Language Server Protocol (LSP), including for Rust via RLS. A good way forward might be to create a generic LSP xi plugin that shuffles messages between a LSP server and the xi server. |
@infogulch: I actually started working on this a week or two ago, just testing out RLS with xi's existing (very basic) plugin support, which was able to request completions and print them to the console. I definitely think that LSP support is something we will be working on as soon as the plugin story coheres a bit more. |
Awesome, that sounds exciting! Just curious, how do you expect to implement this? Will xi speak LSP natively or will there be a plugin that translates between the two protocols? |
the xi-client will speak the xi client protocol, but my current thinking is that, where possible, the naming and layout of certain types (such as a completion group, etc) will be identical to the LSP implementation. (None of this is nailed down) |
Any progress on LSP support? |
@bbigras no, hopefully later this year. |
@cmyr I am interested in doing the work necessary for RLS/LSP integration. Would you have some time to write up a mentor doc for me on it? |
@estk hi! sorry I missed this, just catching up on some issue backlog. There's actually been a lot of work done over the summer towards RLS/LSP support, although there's still lots more to do. @betterclever was working on support in core, and has made a lot of progress; we have the ability to connect to a language server and send various things back and forth, and I believe at least hover definitions is working in the mac frontend, although getting a language server running is a bit fragile. In any case, maybe start poking around looking at some of those merged PRs and that will give you a sense of where things are at? Happy to answer specific questions! |
Many editor plugins integrate with the UI of the editor. Examples inlude opening new panes (e.g a file-explorer plugin), adding a status bar, adding to a status bar, line gutter information, and so on. How would these sorts of plugins be handled in Xi? The following approaches are the obvious ones, but all of them have their problems.
The way Xi handles this might impact discussions such as #158.
The text was updated successfully, but these errors were encountered: