With Code Search, I have:
* Rewritten a CMake build system, which would have been practically impossible without access to real-world examples because of how poorly designed and documented it is;
* Validated machine-generated translations by looking up language strings from projects that used human translators;
* Tracked down bugs in unfamiliar codebases, using symbol-based navigation, without the downtime of fetching a bunch of files and waiting for a language server to process them locally;
* Reviewed how projects were using the APIs of a library I work on to determine whether high-maintenance features were actually used, and whether tricky features were being used correctly or needed redesigning to reduce programmer error
Kudos to the team at GitHub. Genuinely stellar work.
For translations I would search a phrase using `<phrase> lang:"Gettext Catalog" path:/<language iso code>/`.
For reviewing library consumers I would just search for `<my library name> (<function name> OR <other function name> OR <third function name>) NOT path:<my library name>/**`.
There may be better queries for some of these, but I really didn’t have to do any magic or weird tricks. Everything more or less just works.
Searching how an API is used.
Searching how people configured something.
Searching accidental uses of an attribute:
https://github.com/dotnet/csharplang/discussions/5657#discus...
The previous standard GitHub search I found to be remarkably bad. I would be looking at some small public repo, search for an exact string match I know exists in the code, scope the search to that repo only, and still see zero results. Even copy-pasting a line of code from a file in the repo often resulted in zero matches.
I can see how it would be handy to search a codebase online, especially one you don't have cloned locally, but for my own codebases, I can search the entire thing just fine in VS Code with ctrl-shft-f.
It's also great if you drank the GitHub kool-aid as you can do a single search and find related code snippets, issues, pull requests and discussions that could possibly help. I'm personally not to big into the ecosystem, in fact I'm considering moving to Fossil so I can have everything inside the repo, but for those who are it's a great feature.
GitHub code search pretty much solves that. For any API you can find an example of someone else using it.
I've been using it for this for a year now and I wouldn't want to live without it.
Amazing. This was the light bulb moment for me. I work at [big tech co] and we have an internal code search tool, and anytime I need to use a new API I pull it up to find examples of how it's used.
Now I can do this for the entire world of OSS, amazing.
Searching for non-documented or badly documented API, find implementation of an algorithm or specific pattern, find how people are using a niche tool, etc.
I have even used it to find my own API in the wild to look for potential breaking changes and improvements to do.