← Back to context

Comment by jjeaff

2 years ago

Could you elaborate more on why this is a significant feature?

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 not only about searching your own repository, it allows you to search through every single public repository on GitHub. I personally use it a lot to learn more obscure APIs which are badly documented or which I'm just not used to, simply search for the method I'm trying to use and find infinite examples of real world usage, along with the code license right next to it.

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.

Ever wanted to use an API and found the documentation to be lacking?

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.

  • > For any API you can find an example of someone else using 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.

I think others have pretty much summarised it already:

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.

For me it's been very useful at finding codebases with work done on extremely specific niche things that would've been near impossible to find otherwise (e.g. tools for obscure protocols hidden away on obtusely named repos)