by srcreigh · 5y ago · 0 comments
I can't wait for the tools to get built with this. Paredit for TypeScript. Syntax-tree based highlighting (vs regex highlighting). A command to "add an arg to current function" which works across languages. A command to add a CSS class to the nearest JSX node, or to walk up the tree at the className="| ..." position, adding a new className if it doesn't exist.
There's a nicely documented Emacs package for this [1]. The documentation is at [2]. The parse trees work great. There's syntax highlighting support and tree-walking APIs. There's a bit of confusion about TSX vs typescript langs but it's fixable with some config change [3].
[1]: https://github.com/ubolonton/emacs-tree-sitter [2]: https://ubolonton.github.io/emacs-tree-sitter/ [3]: https://github.com/ubolonton/emacs-tree-sitter/issues/66#iss...
The query language is also what's used to drive the fuzzy/ctags-like Code Navigation feature. Both of those are powered by tree-sitter query files defined in each language's repo, like these for Go: https://github.com/tree-sitter/tree-sitter-go/tree/master/qu...
Curious if there's any efforts to bring tree-sitter to VSCode? Exposing tree-sitter to extensions could open up so many possibilities like OP mentioned.
The potential for this is essentially something like Paredit, but for all languages.
If you know a Lisp I recommend just giving paredit a spin for a few minutes, it's an interesting experience.
The new code runs way faster and is so much nicer to work with.
Once all the kinks are gone, I can’t imagine going back.
[1] https://github.com/emacs-csharp/csharp-mode/blob/master/csha...
- indentation may be fine for a final doc, but not always while editing. Especially for new lines starting new code-blocks.
- adding new syntax not already known by tree-sitter requires up streaming to at least 2 repos before we can use it in a released version of our package. This can feel less hands on and slow than working in a single repo where you have full control.
No super-biggies yet though.
And I can stop feeling like my fingers have all lost a knuckle when I'm writing Typescript :)
EDIT: finally found it https://github.com/alphapapa/prism.el
I don't see it as condescension though. I think it's just a way of speaking.
It's one thing to joke about it a little, but this is just arrogance on display with obvious derision for us children who find that traditional syntax highlighting is beneficial.
I recall reading once that Vim tabs were a crutch for people who "can't remember what they're working on". It's the same kind of arrogance and presumptiveness.
This would be a wonderful idea in any programming language.
But I agree with the other commenter that this speaker is really condescending. Not a person I'd want to work with.
"You've all seen syntax coloring, right? That's something we put in our text editors to make it easier for kindergardeners to do programming"
:)
Is there a list of ideas for Structural Editing in C-like languages?
I can think of `extend-selection, `move to parent block`, `add arg to function`