Open stites opened 7 years ago
We could implement this ad-hoc, or we could go the full structured editing route. Ad hoc seems easier at first, but it doesn't scale if we want to add lots of similar features in the future.
Full structured editing would be fantastic. We could write functions that read the syntax tree for a buffer, generate an edit, and put it in the right place. That way most of these functions can be totally language independent, but still do exactly the right thing.
If I am understanding correctly, there are syntax trees being generated separately for each language, right?
I think first we would need to have one standard syntax tree type, so there can be a standard way of reading it.
In order to generate code, like correct indentation (like == in Vim), refactoring (take a lambda out, and write a named function, etc.), merging comments, etc. we need a set of rules for each language to make generating code unambiguous. Otherwise, we don't know how much indentation to use where, how comments should look, etc.
How would all of this look with yi's current codebase?
One neovim feature which I think is nice: Given some file for which we know what a comment is (in this case a .hs file): Hitting join (
J
) merges the comments: