{"id":3063,"date":"2018-11-11T23:44:41","date_gmt":"2018-11-11T23:44:41","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=3063"},"modified":"2018-11-12T02:51:41","modified_gmt":"2018-11-12T02:51:41","slug":"sourcegraph-an-open-source-source-code-search-engine","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/11\/11\/sourcegraph-an-open-source-source-code-search-engine\/","title":{"rendered":"Sourcegraph: An Open-Source Source Code Search Engine"},"content":{"rendered":"<p>Last updated November 11, 2018<\/p>\n<p>In a <a href=\"https:\/\/jaxenter.com\/open-source-sourcegraph-150244.html\" target=\"_blank\" rel=\"noopener\">recent announcement<\/a>, a Code Search and Navigation tool named <a href=\"https:\/\/sourcegraph.com\/\" target=\"_blank\" rel=\"noopener\">Sourcegraph<\/a> was <a href=\"https:\/\/about.sourcegraph.com\/blog\/sourcegraph-is-now-open-source\/\" target=\"_blank\" rel=\"noopener\">declared Open Source<\/a>. As it makes navigating through Source Code much more convenient, the tool itself going Open Source is definitely a big plus for developers!<\/p>\n<p>We\u2019ve looked into its features and also tried to find out how it can be so helpful for developers who are used to navigate through code hosts like GitHub, GitLab and others quite regularly.<\/p>\n<h2>Sourcegraph Features<\/h2>\n<p>As stated on <a href=\"https:\/\/github.com\/sourcegraph\/sourcegraph\" target=\"_blank\" rel=\"noopener\">their GitHub page<\/a>, Sourcegraph has the following features:<\/p>\n<ul>\n<li>Fast global Code search<\/li>\n<li>Intelligent Code recognition<\/li>\n<li>Code host Enhancement on GitHub, GitLab and more<\/li>\n<li>Extension API for easier third-party integration<\/li>\n<\/ul>\n<p>You can deploy Sourcegraph on your server and configure it to work with your or your organization\u2019s Git repositories. Once that\u2019s done, you get a search engine where you can search all the codes.<\/p>\n<p>But if you are a lone developer, like me, you can still use Sourcegraph on GitHub or <a href=\"https:\/\/itsfoss.com\/github-alternatives\/\" target=\"_blank\" rel=\"noopener\">GitHub alternatives like GitLab<\/a>.<\/p>\n<p>I am going to quickly show you how to use Sourcegraph for a better code navigation on GitHub.<\/p>\n<h2>Using Sourcegraph on GitHub<\/h2>\n<p>Let\u2019s find out how you can easily try this tool with a <a href=\"https:\/\/addons.mozilla.org\/en-US\/firefox\/addon\/sourcegraph\/\" target=\"_blank\" rel=\"noopener\">Firefox<\/a> or <a href=\"https:\/\/chrome.google.com\/webstore\/detail\/sourcegraph\/dgjhfomjieaadpoljlnidmbgkdffpack\" target=\"_blank\" rel=\"noopener\">Chrome<\/a> extension. Here, we\u2019ve used Firefox:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/itsfoss.com\/wp-content\/uploads\/2018\/10\/Sourcegraph-Firefox-extension.jpg?ssl=1\" alt=\"Sourcegraph Firefox add-on\" \/><\/p>\n<p>This is how it looks like with the Sourcegraph extension installed and when you view a file on the <a href=\"https:\/\/www.vim.org\" target=\"_blank\" rel=\"noopener\">Vim<\/a> repository on GitHub:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i1.wp.com\/itsfoss.com\/wp-content\/uploads\/2018\/10\/Vim-With-Sourcegraph1-1.jpg?ssl=1\" alt=\"Sourcegraph source code engine\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i2.wp.com\/itsfoss.com\/wp-content\/uploads\/2018\/10\/Vim-With-Sourcegraph3.jpg?ssl=1\" alt=\"Sourcegraph extension on GitHub\" \/><\/p>\n<p>Note how we can see the new Sourcegraph buttons within the GitHub interface, thanks to the installed extension. One thing to note is that one need not even login into GitHub to navigate through hosted Code and their repositories in order to make use of the helpful features of Sourcegraph.<\/p>\n<p>When you click on \u201cView File\u201d, the entire look changes and the file is opened for you in a completely new interface within the browser itself:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/itsfoss.com\/wp-content\/uploads\/2018\/10\/Vim-With-Sourcegraph4.jpg?ssl=1\" alt=\"Sourcegraph extension on GitHub\" \/><\/p>\n<p>Without Sourcegraph, if you want to look for files with a particular format, say C++ .cpp files in this example, it is very difficult to filter and view them if we try to use GitHub\u2019s own search engine within this repository:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i1.wp.com\/itsfoss.com\/wp-content\/uploads\/2018\/10\/Searching-Vim-Repository-Without-Sourcegraph.jpg?ssl=1\" alt=\"Sourcegraph extension on GitHub\" \/><\/p>\n<p>But once you are using this extension, see how easily you can view all such files in one go within the repository:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/itsfoss.com\/wp-content\/uploads\/2018\/10\/Vim-With-Sourcegraph1.jpg?ssl=1\" alt=\"Sourcegraph extension on GitHub\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i1.wp.com\/itsfoss.com\/wp-content\/uploads\/2018\/10\/Searching-Vim-Repository-With-Sourcegraph.jpg?ssl=1\" alt=\"Sourcegraph extension on GitHub\" \/><\/p>\n<p>Sourcegraph can narrow down through Code Search very intelligently as explained in this video:<\/p>\n<p>Code intelligence in Sourcegraph is powered by <a href=\"http:\/\/langserver.org\/\" target=\"_blank\" rel=\"noopener\">Lang Server<\/a>, which enables identifying the type of Programming Language you are using:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i1.wp.com\/itsfoss.com\/wp-content\/uploads\/2018\/10\/Sourcegraph-Connected-Via-Lang-Server.jpg?ssl=1\" alt=\"Language support Sourcegraph\" \/><\/p>\n<p>Learn more about its usefulness in the following video:<\/p>\n<h2>Bonus Tip on using Sourcegraph<\/h2>\n<p>Even without installing an extension on your browser, you can directly use Sourcegraph as an <a href=\"https:\/\/en.wikipedia.org\/wiki\/Integrated_development_environment\" target=\"_blank\" rel=\"noopener\">IDE<\/a> on top of any repository on GitHub by just adding \u201csourcegraph.com\/\u201d as a prefix to the repository <a href=\"https:\/\/en.wikipedia.org\/wiki\/URL\" target=\"_blank\" rel=\"noopener\">URL<\/a>.<\/p>\n<p>For example, the URL for the official Vim repository is:<\/p>\n<p><a href=\"https:\/\/github.com\/vim\/vim\" target=\"_blank\" rel=\"noopener\"><em>github.com\/vim\/vim<\/em><\/a><\/p>\n<p>To view the same through Sourcegraph, modify the URL as below and you\u2019re good to go:<\/p>\n<p><em><a href=\"http:\/\/sourcegraph.com\/github.com\/vim\/vim\" target=\"_blank\" rel=\"noopener\">sourcegraph.com\/github.com\/vim\/vim<\/a><\/em><\/p>\n<p>I\u2019ve also tested this method with <a href=\"https:\/\/gitlab.com\" target=\"_blank\" rel=\"noopener\">GitLab<\/a> and it works there too! You can try other repositories as well!<\/p>\n<p>Sourcegraph Developers have a master plan behind declaring it Open Source:<\/p>\n<blockquote><p>Make basic code intelligence ubiquitous (for every language, and in every editor, code host, etc.)<\/p>\n<p>Make code review continuous and intelligent<\/p>\n<p>Increase the amount and quality of open-source code<\/p><\/blockquote>\n<p>Here are the ways they suggest you can contribute to its <a href=\"https:\/\/github.com\/sourcegraph\/sourcegraph\/blob\/master\/docs\/local-development.md\" target=\"_blank\" rel=\"noopener\">Development<\/a>:<\/p>\n<ul>\n<li>Submit <a href=\"http:\/\/oss-watch.ac.uk\/resources\/pullrequest\" target=\"_blank\" rel=\"noopener\">pull requests<\/a> to the Sourcegraph Open Source Project<\/li>\n<li>Actively participate in its <a href=\"https:\/\/github.com\/sourcegraph\/about\/tree\/master\/projects\" target=\"_blank\" rel=\"noopener\">continued development<\/a><\/li>\n<li>Add and improve <a href=\"https:\/\/github.com\/sourcegraph\/about\" target=\"_blank\" rel=\"noopener\">documentation<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/sourcegraph\/sourcegraph-extension-api\" target=\"_blank\" rel=\"noopener\">Build Sourcegraph extensions<\/a> to Enhance Code viewing\/reviewing on both Sourcegraph and GitHub<\/li>\n<\/ul>\n<p>So this was a brief look into how Sourcegraph can make the developer\u2019s life a lot more easier and hassle-free.<\/p>\n<p>Are you a Developer? Would you like to adopt this new Open Source Tool in your day-to-day programming tasks? Let us know in the comments section below.<\/p>\n<p><a href=\"https:\/\/itsfoss.com\/sourcegraph\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last updated November 11, 2018 In a recent announcement, a Code Search and Navigation tool named Sourcegraph was declared Open Source. As it makes navigating through Source Code much more convenient, the tool itself going Open Source is definitely a big plus for developers! We\u2019ve looked into its features and also tried to find out &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/11\/11\/sourcegraph-an-open-source-source-code-search-engine\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Sourcegraph: An Open-Source Source Code Search Engine&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3063","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/3063","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=3063"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/3063\/revisions"}],"predecessor-version":[{"id":3278,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/3063\/revisions\/3278"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=3063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=3063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=3063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}