I'm working on a cross-editor snippet manager. the project was at a standstill for a while due to life and the lack of a certain feature in a dependency which has just recently been implemented. A lot of my ideas for it's functionality sort of go against how snippets are normally implemented. I wanted to get the opinion of people with more experience with both rust and software engineering.
I was originally planning on storing all snippets in a radix-trie, and finding some way to pass insertion mode input to sniper. my reasoning being that I wanted to make snippets modular or lib-based, and there were situations where in a single editing session you would want access to snippets for more than one language (for example embedded mathjax in markdown, jupyter notebooks with lang/shell/markdown) and it seemed easier to pass input and decide on the appropriate context via keystrokes.
however after doing more research on the two editors I plan on implementing it in (kakoune and vscode), both have ways of handling text matching (and I imagine this carries over to most editors), so as long as those methods allow for fast rebuilding of those maps there isn't as much of a need to pass input directly to sniper, as much as negotiate a handshake when a snippet is matched. I guess my question is in a project like this(where I want consistent behavior across multiple editors), how much should I rely on the functionality of the editors themselves, and how much should rely on self-defined functionality while avoiding the inner-platform effect
also, I was thinking of daemonizing it so that you would have one instance for every running editor, partially because it seemed more efficient when you have multiple editors open, all of which may be using the same set of languages and libraries. however, the problem with that is the containing structure needs to be mutable(because language and library based snippets will need to be added situationally), which if I remember correctly means that in rust it's not considered thread-safe. Is there a way to have something which needs to be thread-safe(handline multiple requests), and changed at runtime without rebuilding the entire structure everytime a new set of snippets is added?
here's a link to the repositories:
- the core library, written in rust which stores and manages snippets, and functionality for state-management
- the library that makes it available to python, I was planning on using this kakoune on tasks that I didn't want to write in shell script
- basically a shell repo that I plan to work on once I update sniper-node