Open kkharji opened 3 years ago
@Olical I believe this can be easily done.
Via logging the actual function definition through parsing ast or simply via logging a formatted string where it appends def name
and defn name
and wrap the doc in string. The latter might be a bit more robust and emacsy but unbelievably far better and accurate (think defmacro, defonce) .
Parsing of code in Conjure has been something I've tried to avoid since day one since that locks you into one language and is extremely brittle without a LOT of work (something I try to avoid because my time is very limited and I have to choose what I work on very carefully to maintain quality over time).
When you "doc" a word you might only get prose back, just an English doc string, what highlighting would be involved there? Or do you just mean it shouldn't look like a comment specifically? Not sure I fully understand your second comment though really, might be missing something.
@Olical not sure what is an easy solution to fit with your standards is. I just want to syntax highlighting for docs and not see them as comments. You are welcome to close this issue if it doesn't make sense 😅
I think that this is something that could be done with treesitter, since you can set syntax in only sections of buffers as demonstrated in this video
Hmm, that might help to highlight known parts of text but we still have to know which parts are code and which parts are prose. And as far as I know there's no way to do that other than parsing all help text and trying to work out what parts are code, what parts are prose + handling that same logic in every language client Conjure supports if possible. It'd suck if we added a whole inference / parsing system that can somehow tell the difference between prose and code then does a bunch of buffer mutation to configure tree sitter stuff for that text then have it only work with Clojure in a super custom way.
What parts do people want highlighted anyway, is it the args lists? Or any code / examples that get dotted around the body?
I've been getting this by using LSP where it pulls data from ClojureDocs (I think) which is annotated HTML so it can add highlighting. Conjure's doc values it gets back from the REPL are just a string of plain text with no metadata or annotations, so understanding it requires parsing completely free text, unless we say "the first line is always the args list and we can highlight that", but that doesn't seem that useful to me?
Could just give an option so people can remove the comment prefixes from doc output so things kinda get highlighted. But that will break your log buffer syntax highlighting because a bunch of English will get dumped into it with unmatched parens and quotes galore 🤔
doc_word
should result in syntax highlighted log to improve readability: Either in markdown or in Clojure, where latter might makes more sense.