Fork me on GitHub
#vscode
<
2020-01-25
>
sogaiu09:01:48

@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.

sogaiu09:01:36

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.

sogaiu09:01:05

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

pez10:01:41

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.

pez10:01:00

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.

sogaiu12:01:49

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?

pez12:01:44

I wasn't aweare of the Clojure grammar for tree sitter. Very interesting! Even if they both look a bit abandoned.

pez12:01:19

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

pez12:01:58

But maybe that will be reconsidered now that they own Github...

pez12:01:20

Also had no idea about that extension.

pez12:01:18

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.

sogaiu13:01:28

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 :)