Live data from Hacker News

Ripgrep 14 Released

github.com

41–50 of 73 posts

Re: Ripgrep 14 Released

#41

If you are an Emacs user like me, you must try out the consult-ripgrep command from the peerless Consult [1] package by Daniel Mendler: search your whole project with ripgrep and get a live preview of every matching candidate all inside of Emacs! [1]: https://github.com/minad/consult

Yep, the consult suite and rg are two of my favorite things. And I'm not even a SWE.

Re: Ripgrep 14 Released

#43

The release notes use the word "headling" twice instead of presumably "headline". I had to look it up in case this was a new usage of this archaic word.

Ah nice catch! I meant to say "headlining." Fixed now.

I hope you used rg to catch the catch :)

#eatyourowndogfood

Re: Ripgrep 14 Released

#44
My muscle memory is still dialed in to `ack`, but I recently built an open source tool called `grep-ast` [0] that serves a similar function to ripgrep, ack, etc. The difference is that it shows matching lines in the context of the functions/methods/classes/etc that contain them.

It uses the abstract syntax tree (AST) of the source code to show how the matching lines fit into the code structure. It shows relevant code from every layer of the AST, above and below the matches.

It feels quite useful when you're grepping to understand how functions, classes, variables etc are used within a non-trivial codebase.

Here's a snippet that shows grep-ast searching the django repo. Notice that it finds `ROOT_URLCONF` and then shows you the method and class that contain the matching line, including a helpful part of the docstring. If you ran this in the terminal, it would also colorize the matches.

  django$ gast ROOT_URLCONF

  middleware/locale.py:

  │from django.conf import settings
  │from django.conf.urls.i18n import is_language_prefix_patterns_used
  │from django.http import HttpResponseRedirect
  ⋮...
  │class LocaleMiddleware(MiddlewareMixin):
  │    """
  │    Parse a request and decide what translation object to install in the
  │    current thread context. This allows pages to be dynamically translated to
  │    the language the user desires (if the language is available).
  ⋮...
  │    def process_request(self, request):
  ▶        urlconf = getattr(request, "urlconf", settings.ROOT_URLCONF)
[0] https://github.com/paul-gauthier/grep-ast

Re: Ripgrep 14 Released

#45

My muscle memory is still dialed in to `ack`, but I recently built an open source tool called `grep-ast` [0] that serves a similar function to ripgrep, ack, etc. The difference is that it shows matching lines in the context of the functions/methods/classes/etc that contain them. It uses the abstract syntax tree (AST) of the source code to show how the matching lines fit into the code structure. It shows relevant code…

have you looked at semgrep? This isn't the same thing but is similarly poking at the whole "ASTs are a thing we want to grep at" problem

Re: Ripgrep 14 Released

#46
Andrew sets an extremely high bar for open-source engineering. As a loose member of the broader Rust community, I've benefited enormously not only from his code but also from his discussion comments and his blog posts (especially [1] and [2]).

Congratulations on the release, Andrew! I also notice that you've joined Astral [3], which as a fan of Rust/Ruff/rg I'm thrilled about.

[1]: https://blog.burntsushi.net/transducers/

[2]: https://blog.burntsushi.net/foss/

[3]: https://github.com/astral-sh

Re: Ripgrep 14 Released

#47

I'm still sad that --sort-files makes ripgrep run in single-core mode. (I know you can't make --sort-files _free_ in multi-core mode, but it would still be faster than single-core) https://github.com/BurntSushi/ripgrep/issues/152

The shell function from this comment works pretty well for me: https://github.com/BurntSushi/ripgrep/issues/152#issuecommen...

Re: Ripgrep 14 Released

#48

Andrew sets an extremely high bar for open-source engineering. As a loose member of the broader Rust community, I've benefited enormously not only from his code but also from his discussion comments and his blog posts (especially [1] and [2]). Congratulations on the release, Andrew! I also notice that you've joined Astral [3], which as a fan of Rust/Ruff/rg I'm thrilled about. [1]: https://blog.burntsushi.net/transdu…

<3

Re: Ripgrep 14 Released

#49
post #45

My muscle memory is still dialed in to `ack`, but I recently built an open source tool called `grep-ast` [0] that serves a similar function to ripgrep, ack, etc. The difference is that it shows matching lines in the context of the functions/methods/classes/etc that contain them. It uses the abstract syntax tree (AST) of the source code to show how the matching lines fit into the code structure. It shows relevant code…

have you looked at semgrep? This isn't the same thing but is similarly poking at the whole "ASTs are a thing we want to grep at" problem

Thanks for the pointer. There are definitely a few tools that have explored the idea of searching the AST of code. Semgrep seems to do that, as does a tool called ast-grep [0].

Both of them are sort of doing the opposite of my tool. They are letting you specify your search as a chunk of code/AST.

My tool let's you grep a regex as usual, but shows you the matches in a helpful AST aware way.

[0] https://ast-grep.github.io/

Re: Ripgrep 14 Released

#50
Hyperlink support? Hell yes! This has been such a frustration of using terminal tools to search in files. I love that the vscode format even linkifies by matched line. Thanks for this update burntsushi!
Post reply on HN