|
| z3t4 wrote:
| I take it that many people like the idea with tree-sitter but
| don't really know how to use it. Tree-sitter does have
| documentation but it's not that useful.
|
| It would be interesting to know how many sales you get from a
| niche book like this though.
| ninepoints wrote:
| In what way is its documentation not useful? I did a project
| based on TreeSitter a year ago and the docs were perfectly
| clear and adequate, and I was up and running within half an
| hour or so
| alwaysbeconsing wrote:
| There's not much end-user documentation the Tree-sitter project
| can really provide. It's a programming interface. The stuff
| that an Emacs, NeoVim, ... user is actually interacting with
| depends on the integration in the editor. So it's up to those
| docs to explain what features they expose _based on_ Tree-
| sitter.
|
| For example, the multiple cursor thing at the end is _enabled_
| by having the concrete syntax tree from Tree-sitter 's parse,
| but Tree-sitter has nothing whatsoever to do with the cursors:
| it just provides locations in the text based on particular
| queries (like "all `identifier` nodes named 'foo' that are sub-
| nodes of this other node").
|
| Even the headliner feature, syntax highlighting, isn't provided
| directly by Tree-sitter. It's up to the client system to
| inspect the syntax tree and apply attributes to its rendered
| text -- however it does that rendering.
| pimeys wrote:
| Helix editor has it built-in so it's a good place to start
| looking into tree-sitter. For me the important parts are:
|
| - Much better (and faster) syntax hilighting
|
| - Shrink and expand selection (select variable, all variables
| inside parentheses, the whole block, the whole function)
|
| - Select next or previous sibling node
|
| - Goto matching bracket from where I am right now
|
| - Jump between functions
|
| - Jump between type definitions
|
| - Jump between parameters
|
| - Jump between comments
|
| - Jump between tests
|
| I think Helix must be the easiest way to start experimenting
| with tree-sitter. You need no plugins, just install the editor
| and start experimenting:
|
| https://helix-editor.com/
| d357r0y3r wrote:
| It feels like people use these editors for the novelty of it and
| not because it's truly the best for productivity.
| snapdaddy wrote:
| I will treat your comment as serious and explain why I
| personally use emacs.
|
| The thing I love most about emacs is that it is joyously
| consistent. The same key combination to jump ahead by a word
| works everywhere, such as when you're opening files or
| navigating directories. This consistency means that I am often
| very efficient trying new packages that I have never used.
|
| Maybe you've never seen someone use emacs in anger? If so,
| check out this video of Steve Yegge doing some stuff in Emacs:
| https://youtu.be/lkIicfzPBys?t=142
| okasaki wrote:
| Ah yes, the novelty of using emacs, an editor that started in
| 1976.
| [deleted]
| Barrin92 wrote:
| fact aside that I don't think I've ever heard emacs associated
| with novelty (the thing is as old as Stonehenge), I wish this
| productivity cult would die. Programming is fun and play.
| Discovery and experimentation are great things.
| nektro wrote:
| title should include "in Emacs"
| pcstl wrote:
| I think adding "in Emacs" to the title of an article published
| on Mastering Emacs Dot Org might be a bit redundant.
| mekster wrote:
| Is everyone supposed to comprehend the domain name of the
| post?
| wafflemaker wrote:
| Scrolled over the title (thought it was some programming
| algorithm concept) and then by chance I've read the site name
| saying it's about Emacs which prompted me to open the
| discussion.
|
| Maybe on some setups the site name is not as easily visible
| as the title?
| agumonkey wrote:
| some times a bit of redundancy doesn't hurt
| gumby wrote:
| Given how powerful Emacs is and how important it has been for
| my computing over the past four decades, I think it would be
| more useful to me for people to label all non-emacs articles
| [Not Emacs]
| avodonosov wrote:
| Anyone knows, why github code navigation, which is based on tree-
| sitter [1], supports only subset of languages for which tree-
| sitter has parsers [2]? For example, Common Lisp is not
| supported. I asked github [3], but they are silent.
|
| 1 - the "search based" navigation is based on tree sitter
| https://docs.github.com/en/repositories/working-with-files/u...
|
| 2 - the list of parsers in the official docs: https://tree-
| sitter.github.io/tree-sitter/
|
| 3 - https://github.com/orgs/community/discussions/55704
| kfir wrote:
| I believe this paper has an answer to your question -
| https://queue.acm.org/detail.cfm?id=3487022
| avodonosov wrote:
| Thank you very much for the link.
|
| I don't see an answer in there, though.
|
| They use tagging (as described also here: https://tree-
| sitter.github.io/tree-sitter/code-navigation-sy...). From
| both docs I assume `tree-sitter tags` works out of box for
| any language that has a parser. (Since neither doc instructs
| to save a custom config for tag extraction query, I assume
| every language plugin provides tagging queries).
| euiq wrote:
| While we're talking about this, I've been quite disappointed by
| the new GitHub file browser: the new features look neat, but
| the core file browsing experience is significantly worse for me
| because the new UI is much more complicated and every action
| seems to do way more work.
|
| I couldn't immediately find a way to opt out; I wouldn't mind
| the new file browser so much if I could drop into it on demand
| instead of having it forced down my throat.
| awayto wrote:
| I worked with tree sitter a bit for a small project. It seems
| to be the case that, while it covers a large set of languages,
| the actual implementation of each subset doesn't follow the
| exact same underlying API. And it follows that there is no
| universal AST parser as far as I can tell. Languages have many
| types of atomic parts to such an extent that unifying them is a
| tremendously complex task.
| nico wrote:
| There is a very cool gif demo at the bottom showing contextual
| editing with multiple cursors using an extension
|
| Some pictures/video or gif would have been really nice at the top
| of the article to get a quick idea of what I'll be able to get by
| following the guide
| [deleted]
| mickeyp wrote:
| Good shout. I've added another example image near the top,
| instead of burying the lede for people wondering what it's
| about.
| nico wrote:
| Amazing, thank you
| audiodude wrote:
| This is so hopeless complicated that I'm glad I use VSCode and
| not Emacs anymore. Sheesh.
| okasaki wrote:
| OK? It's feature in development. Eventually emacs 29 with tree
| sitter will be part of distro packaging, and it will just be an
| "apt install emacs" away.
| audiodude wrote:
| That's not the impression I got from TFA. It sounds like,
| once you have Emacs compiled with tree-sitter, you also need
| to have a language binding in a shared library in a known
| location (that you have to compile yourself or depend on the
| kindness of strangers). And once you have that, you actually
| need someone to write a major mode that utilizes it at all.
| And if you want to make that major mode the default for that
| file type, there are a few other things you need to do. Etc.
| pridkett wrote:
| I use both VS Code and Emacs. One of the things I love about
| Emacs is that if you put enough work into it, it will be like
| nothing else. There are times when I'm writing code, a text
| file, or even managing git commits with magit that I can sit
| back and say "wow, this is genuinely a pleasure to use."
|
| But, it takes a lot of work to get there. I still don't have
| everything working super well, debugging is way easier for me
| in VS Code. But, I'm still learning (after 25+ years as an
| Emacs user), and that brings me joy.
|
| It's like when I'm working on electronics. There's a genuine
| joy I get from using my Hakko soldering station, Mitutoyo
| calipers, or my Engineer hand tools. Using something that is
| supremely well designed for a purpose brings me joy.
|
| And org-mode. Seriously, org-mode.
___________________________________________________________________
(page generated 2023-05-28 23:00 UTC) |