Open fdncred opened 3 years ago
One of the ways I can think of achieving this is by using treesitter
. With that, we should have even better highlighting, considering it can do syntax highlighting based on an AST instead of regex-based highlighting (which ig is the popular option at present).
I don't really know how to integrate treesitter
with reedline
(that is something we will need to figure out).
Though I would wager the harder part would have been writing the parser for nu-shell
. (Luckily for us it already exists - https://github.com/LhKipp/tree-sitter-nu).
And for other popular languages, there are already parsers, so if bash/fish/sh or any other shells decide to use reedline
they should get this for little work.
Note: in addition to syntax highlighting we can also get stuff like
cib
which can mean change in block
) Absolutely random thought: as for the drop-down menu, I don't really know how to achieve this with the UI, but if we want to do something overkill we can integrate an LSP client (https://github.com/ebkalderon/tower-lsp) to readline
so that it can do anything that an editor can.
Now the creation of a language server is going to be hard, but my assumption is that the nu-shell folks might already be thinking about it as it can add editor support for almost all the ones that people use.
treesitter
would be an interesting experiment, as you've outlined it.
an LSP would be cool indeed. we definitely want to add a LSP to nushell but we're not there yet. luckily, we have @jntrnr who worked on rust's RLS, i believe. we just need a jt.clone() function to get everything done.
In this one image are several features that I'd love to see reedline strive to attain.
...
on the second linetui
? i guess this population would be language specific, but of course, i'm thinking about nushell. :) a use case is to use this with completions of sub commands in nushell and completions in general.some of these we're well on our way to achieving.
This is taken from here and the github repo.
For reference, i found this collection of supported ansi escape sequences very informative.
To be clear, i'm not talking about baking in python or this python line editor. I'm just using it as a
prior art
reference.