@pez in an attempt to understand better, i've done some simplifying of bracket pair colorizer 2 (delete portions of code, compile, execute to test whether basic functionality works). i also compared v1 to v2.
current impression regarding:
v2 Uses the same bracket parsing engine as VSCode, greatly increasing speed and accuracy
is that v1 uses prismjs, whereas v2 uses textmate grammar parsing.v1 also appears to have been using a timer-based approach (which iiuc is what clojure warrior's approach is), and v2 doesn't appear to be
specifically about v2 using textmate grammar parsing:
https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/blob/develop/src/textMateLoader.ts#L19
https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/blob/develop/src/textMateLoader.ts#L114_L116
where i guess vscode-textmate
is:
https://github.com/microsoft/vscode-textmate
Interesting choice. The VS Code team is planning on dropping tmGrammar in favor of whatever they are using in VS. And Atom is going with Tree Sitter.
My experience with tmGrammar (which is a third parser involved in Calva) hasn't been one of all joy and fun. I failed at implementing the comment and ignore forms highlighting there, which is why I did it in Clojure Warrior instead.
thanks for sharing. may be you've seen these already, but fwiw, there's: https://github.com/oakmac/tree-sitter-clojure https://github.com/Tavistock/tree-sitter-clojure i see there's a tree sitter extension for vscode and the following thread suggests there are folks interested in that approach: https://github.com/microsoft/vscode/issues/50140 i guess even if the vscode team folks go with their own thing, it's possible that a tree sitter based thing could turn out to be performant enough. may be one of the tree-sitter-clojure efforts could be adapted for use with the vscode extension...or perhaps someone has tried already?
I wasn't aweare of the Clojure grammar for tree sitter. Very interesting! Even if they both look a bit abandoned.
It was in that 50140 I saw that the vscode team is not planning to use tree sitter: https://github.com/microsoft/vscode/issues/50140#issuecomment-426084826
But maybe that will be reconsidered now that they own Github...
Also had no idea about that extension.
For Calva I think the relevant question would be if Tree Sitter would perform better than our own parser does. The structured edit parser, that is. No idea how much work it would be to switch, but can't imagine it would be all that dramatic.
ah, so it was in that thread. thanks for clarifying. found another tree sitter using vscode extension: https://github.com/EvgeniyPeshkov/syntax-highlighter i guess some experimentation might be in order :)