Spying on helix as a subprocess. Is there a way to get telemetry? #8538
-
Hello, I'm working on an app that has to do with annotations. If I'm very lucky, there's already a way to get the data I need. If not, I may fork helix to add it. Either way, I'd very much like to hear some thoughts from people who know helix's internals better than I do. The VisionImagine something a bit like tmux, where helix is running as a subprocess and the user interacts with helix via something less than 100% of the visible area. Except unlike tmux, that extra space is not used to show a different subproces, but instead it's used by the parent process like a margin--you can put annotations there and as you scroll up and down in helix the annotations will scroll up and down also. They're sort of anchored to the text--when you can't see the text anymore, the annotation goes away also. I plan to wrap The ChallengeI have the text that helix is showing the user, so I have something to go off of when it comes to anchoring the annotations to positions on the "window" boundary, but imagine that the window is very small:
Suppose I want to attach an annotation to the third instance of the word To solve it, I need:
Additionally, I want to know what the selections are so that if the user has highlighted something within helix they can then use the highlighted bounds to create an annotation. Some Ideasparse the status bar at the bottom Realistically, the output is more like this:
If the user is viewing a file on the disk, I can maybe tell helix that it's in a large window, but show the user a slightly smaller one, parsing the line that appears on the bottom to learn which file they're editing. This will work sort-of, but I also want the user to be able to paste into a new buffer and then create annotations on the pasted text. In this case there would be no file for me to read. Also, the status line doesn't provide enough data for me to know what they have highlighted. add a backchannel Here I'd have a fork of helix which accepted some CLI args which caused it to listen on some network port or named pipe for requests like "what is the current buffer's contents?" Probably there would also be an event stream so that helix could notify the listener of edits or selection changes. pretend to be tree sitter I don't know much about the conversation between helix and tree sitter, but it seems like tree sitter consumes much of the same data that I need to consume. Perhaps I could pretend to be a tool that offers syntax highlighting or refactor services and learn what I need to know that way. If you can suggest an approach and point me at code that I'd need to familiarize myself with in order to take that approach, I'd surely appreciate it. If not, well thanks for taking a look anyhow 🙂 . |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There is a plugin system in the works that will probably be best suited to get this information. For this reason, I would not recommend putting a bunch of effort into forking Helix to add some form of IPC yourself, nor to build something as fragile as trying to scrape the text off the raw terminal output. That said, there's no concrete timeline on when the plug-in system will be ready or even testable. If you want to start your project sooner rather than later and you also plan on doing it for other editors too, it might be best to start with one of the other editors which already have existing mechanisms to extract this information. |
Beta Was this translation helpful? Give feedback.
There is a plugin system in the works that will probably be best suited to get this information. For this reason, I would not recommend putting a bunch of effort into forking Helix to add some form of IPC yourself, nor to build something as fragile as trying to scrape the text off the raw terminal output.
That said, there's no concrete timeline on when the plug-in system will be ready or even testable. If you want to start your project sooner rather than later and you also plan on doing it for other editors too, it might be best to start with one of the other editors which already have existing mechanisms to extract this information.