9 ms·
Show HN: Sourcetrail – Get productive on unfamiliar source code
- aeling 9y agoThis looks super interesting - great video! Everything is processed offline, I assume? No code leaves the machine?
- nebucnaut 9y agoIndeed, everything's offline! You don't even need an internet connection to run Sourcetrail :)
- problems 9y agoWhat's the C++ support like?
- egraether 9y agoSourcetrail developer here: Pretty solid. We use clang libTooling.
- gigatexal 9y agoC# support would be cool too!
- malnourish 9y agoHow's the performance on a large codebase? North of 500k lines, few thousand cpp/h files, 40+mb
- nebucnaut 9y agoWe have been working on that for the past few month. Right now the performance is pretty good for C++ projects up to around 2 million lines of code. For C projects the performance is even better! If you want to test it, just download the pre-indexed clang project (900k loc) from our website (https://www.sourcetrail.com/downloads#extra https://www.sourcetrail.com/downloads#extra). Indexing the project took 12 minutes on a 5 year old laptop.
- malnourish 9y agoReally great news! I think I'll give this a demo when I have some capacity. Thanks
- davidshepherd7 9y agoI tried it on a fairly big repo today (~500k loc) and once it was done with the initial processing performance was fine.
- rasjani 9y agoCompile commands ? Please Yes?
- nebucnaut 9y agoYes, we support Compile Commands :)
- jschwartzi 9y agoThere is also a tool called Bear which will generate compile commands from Make-based builds, in case you were wondering. I've used it with some success. https://github.com/rizsotto/Bear https://github.com/rizsotto/Bear
- rasjani 9y agoIm well aware of bear. Works fine in some cases, not so well in others. Author is also doing scan-build replacement in python which imho is far superior to bear.
- voltagex_ 9y agoWhat are compile commands?
- nebucnaut 9y agoA Compile Command is a JSON file entry that specifies what the C/C++ compiler should do when compiling a file. So it defines a file to compile and all the required flags (like include paths or preprocessor defines). These Compile Commands are used for all kind of Clang based tools. You can read more here: https://clang.llvm.org/docs/JSONCompilationDatabase.html https://clang.llvm.org/docs/JSONCompilationDatabase.html
- jsk2600 9y agoAny plans to support Kotlin ?
- nebucnaut 9y agoKotlin is definitely on the shortlist for the next language to be supported! Which language we'll pick up exactly depends on the landscape of available tools for that language. Kotlin is pretty new so I guess that there could be a need for Sourcetrail :)
- ftomassetti 9y agoIf you ever go that route and you plan or using/creating some open-source components I would be very interested on hearing more (I am a JavaParser/JavaSymbolSolver contributor)
- nickpresta 9y agoWhat languages are supported? At least on mobile, there is zero mention of language support outside of testimonials and screenshots. Is it just Java and C++?
- RussianCow 9y agoThe intro video mentions Java, C, and C++.
- nebucnaut 9y agoRight, it's "just" Java, C and C++ for now but we are planning to extend our available languages as soon as possible!
- critium 9y agowould that happen to include scala?
- nebucnaut 9y agoUnfortunately it doesn't. Even though Scala and Java output the same kind of bytecode, these languages have different language specifications. We currently only support what's in the JLS.
- gaelian 9y agoAny rough idea when you might have C# support?
- danielvf 9y agoI used Sourcetrail a few months ago to figure out a ugly ball of embedded C code that I needed to reimpliment. Sourcetrail was super helpful for this. It paid for itself in an afternoon.
- nebucnaut 9y agoThank you for the kind words! We are always happy to hear from a satisfied customer :)
- skibz 9y agoThere doesn't seem to be a vscode plugin for Sourcetrail. Could be a worthwhile addition?
- egraether 9y agoIt hasn't been requested so far. Is it actively used by C/C++ or Java developers?
- egraether 9y agoNevertheless I opened a feature request to track demand: https://github.com/CoatiSoftware/SourcetrailBugTracker/issues/397 https://github.com/CoatiSoftware/SourcetrailBugTracker/issue...
- nebucnaut 9y agoThank you again for your request. We now offer a plugin for VS code: https://github.com/CoatiSoftware/vsce-sourcetrail https://github.com/CoatiSoftware/vsce-sourcetrail
- nautilus12 9y agoI doubt you could ever get something like this working for Ruby, which is where it is actually badly needed.
- nebucnaut 9y agoYes, dynamically typed languages are much harder to tackle :/
- dkarapetyan 9y agoYou don't need it to be fully automated. For dynamic languages you would have people in the loop to annotate the parts the tool couldn't figure out.
- nautilus12 9y agoThis seems like no better off. Documentation is historically always out of date the second its written. The same would be true for annotation.
- diggan 9y agoGuess you could have some assertions together with the annotations to make sure things are up-to-date. Then integrate those tests with your CI of choice and it should be a bit easier to keep up-to-date.
- dkarapetyan 9y agoAs noted by others the annotations would be active checks. More like proofs in coq than static text. That way you'd be building up a logical understanding of the code base that was machine verifiable sidestepping the issue of stale comments. If done properly this could even feed into code dynamics to capture information on the runtime information. So that at every point in the program you could start asking questions like how many times did this line execute, what was the type of this variable at this point, how much memory was allocated, and so on and so forth.
- peternicky 9y agoCan you please share the roadmap for adding new language support?
- nebucnaut 9y agoTo be honest: We have not decided what language we will pick up next. Our first priority is to improve on our Java coverage. In a few months we should be ready to choose our next language. We are thinking about either tackling Python or implement support for a more recent language like Kotlin, Swift or Go.
- xyclos 9y agoI spend a lot of time in clients' ios apps which were developed by other contractors long ago and then I'm asked to fix bugs and add new features. I think this would help me save a lot of time. Since it already supports C/C++ would objective-c support be relatively straightforward to add? Not sure if there are many others who would like to see it, but I know I would definitely appreciate it.
- devrandomguy 9y agoA Lisp might be an easy language to target, because of its consistent syntax and "code is data" philosophy. With Clojure, you could both reuse some of your work on Java, and support Clojure's Java interop. Attempting to support Clojure would drive improvements in the Java support.
- fusiongyro 9y agoI doubt there's very much legacy-ish Kotlin or Swift code out there to be a significant selling point for your product.
- tylerc230 9y agoSwift would be great. Perhaps you could leverage SourceKit.
- dbcurtis 9y agoSeems to me there is probably a huge amount of legacy Python code around that people need to explore. In fact, I've spent the entire day so far creating some so that we have enough legacy Python code around in a couple more years. Wouldn't want to run short.
- dkarapetyan 9y agoI really want something like this for heterogenous codebases. Maybe along the lines of ollydbg and ida but for "reverse" engineering Ruby, python, and go.
- boltzmannbrain 9y agoLooks cool! This hits a pain point of mine working in a legacy Python and C/C++ codebase. Any plans for Python support?
- nebucnaut 9y agoHappy to hear that you like it! Full support of Python won't be easy but maybe we could tackle this one in stages. Implement highly demanded features in a first Python release and improve on that later on.
- sandGorgon 9y ago+1 for python.
- boltzmannbrain 9y agoThat'd be great. How can we stay in the loop to hear about Python and other feature releases?
- nebucnaut 9y agoOh, that's an easy question :) You can either follow us on Twitter (https://twitter.com/Sourcetrail https://twitter.com/Sourcetrail) or just sign up for our mailing list (https://www.sourcetrail.com/#get-started https://www.sourcetrail.com/#get-started). I promise that we won't spam you ;)
- tempodox 9y agoI could use something like this for PHP spaghetti code.
- sbarre 9y agoYou may be interested in Exakat: https://www.exakat.io/up-and-running-with-exakat/ https://www.exakat.io/up-and-running-with-exakat/
- bastijn 9y agoDo you also have arrows to methods in your own class? In addition, how does this relate to code maps in VS? https://msdn.microsoft.com/en-us/library/jj739835.aspx https://msdn.microsoft.com/en-us/library/jj739835.aspx Seems they cover a similar thing.
- nebucnaut 9y agoYes, Sourcetrail also shows class internal calls and accessed fields. Code Maps in VS has a different approach because they try to keep the graph small by making the user add symbols. So if you are trying to see every access of a symbol it is easy to miss something. Sourcetrail on the other hand keeps the graph small and comprehensible by showing only one level of dependencies. You don't need to add anything yourself. So you cannot miss any relation ;)
- bastijn 9y agoThanks. Sounds more promising than I took from you landing page. I will give it a go on my c/c++ code bases. See if it can help me. I now notice the free trial cannot be run on your own project. I have to say I won't buy anything that I didn't try on a real sample before. What made you decide to go for this option instead of regular limited functionality or time bound (my preference).
- justboxing 9y agoHow different is this from CodeLens ? Seems like most of these features are in CodeLens anyways, maybe the licensing for CodeLens?? CodeLens => https://msdn.microsoft.com/en-us/library/dn269218.aspx https://msdn.microsoft.com/en-us/library/dn269218.aspx
- egraether 9y agoCodeLens is great for finding references within the IDE. It also provides information about the history, which Sourcetrail doesn't do yet. I would say we go a step further, by also providing a visual representation of the references to symbol, which quickly conveys how a symbol is embedded into the rest of the code base, without even reading a line of code. That makes exploring a lot faster.
- smoothgrips 9y agoI think you're thinking of CodeMAP, not CodeLENS. CodeMap => https://docs.microsoft.com/en-us/visualstudio/modeling/use-code-maps-to-debug-your-applications https://docs.microsoft.com/en-us/visualstudio/modeling/use-c...
- redm 9y agoI love the implementation for C++, I'm just waiting for more language support.
- chubot 9y agoHm does anyone know of a web-based tool like this that uses Clang as a back end? I want to put open source code like the bash and Python interpreters in it and be able to navigate symbolically. And I want nice permalinks. EDIT: It looks like https://woboq.com/codebrowser.html https://woboq.com/codebrowser.html is what I want. The code available but not under and open source license. https://github.com/woboq/woboq_codebrowser/ https://github.com/woboq/woboq_codebrowser/ I will probably try this, but I'm interested in alternatives!
- sqs 9y agoWe built Sourcegraph, which is a web-based code search and navigation tool. Our Python support is in beta, and you can try it out at https://sourcegraph.com/github.com/plotly/dash/-/blob/dash/dash.py#L26:9$references https://sourcegraph.com/github.com/plotly/dash/-/blob/dash/d.... (And hit Alt+D/Opt+D to search by symbol.) Sourcegraph also supports a bunch of other languages: https://sourcegraph.com/help/languages https://sourcegraph.com/help/languages. It gives you nice URLs (hit Alt+Y/Opt+Y to get the full commit ID in the URL to make it permanent). Would love to hear your feedback.
- chubot 9y agoI just spent a few minutes clicking around but had a bit of trouble. EDIT: nevermind, most of this is due to the fact that you have to keep "repo" in the search box, which I found confusing. I quickly found the repo I wanted, but discovered that C/C++ isn't supported, so Woboq is more useful to me at the moment. I tried to build something like this once myself, and made the mistake of going "wide" rather than "deep". That is, trying to support all languages. I think it does make sense to try to get the absolute best experience for one language. But yeah for now since C/C++ aren't supported, it's not useful for me. ------ I typed "cpython" in the search box on https://sourcegraph.com/ https://sourcegraph.com/ and got no results. (I also typed "python" and got no results, which seems pretty odd.) I would have liked to browse this repo: https://github.com/python/cpython https://github.com/python/cpython I guess you have to import repositories yourself? There seem to be sample repositories, but they are in Go, and I'm interested in C/C++ (the Python interpreter, not Python source code). I'm looking for something that uses Clang as a back end for intelligent navigation of C/C++ projects. Also, I would like to browse the bash source code, but as far as I know it isn't available on Github. Can SourceGraph import from an arbitrary git repo? https://savannah.gnu.org/git/?group=bash https://savannah.gnu.org/git/?group=bash That said I'm glad somebody is working on this problem! I like your mission statement.
- nikki93 9y agoInteresting can you edit code in the text view too? Wonder if this could be the one place to write your code too.
- egraether 9y agoWe decided to leave out editing early in the process. Most developers already have their favorite editor and it's a lot of work to implement all features that users would expect from it. We decided to focus on source exploration instead. Sourcetrail is made for the second screen. We implemented plugins for the most used source editors to enable easy switching. Please have a look at our documentation: https://www.sourcetrail.com/documentation/#CODEEDITORPLUGINS https://www.sourcetrail.com/documentation/#CODEEDITORPLUGINS
- nikki93 9y agoCool! Wonder what the graph exploration view would be like if you used a hyperbolic plane to embed it in haha: https://en.m.wikipedia.org/wiki/Hyperbolic_tree https://en.m.wikipedia.org/wiki/Hyperbolic_tree Nice work; seems like you hit a nice medium between trying out something new and keeping it connected to the real world and practical. :)
- alkonaut 9y agoWebsite feedback: Supported languages is the #1 most important piece of info about this software. It should be front and center and probably repeated a few times already on the landing page.
- bigtunacan 9y agoIf I could upvote you more than once; I would. I left the site not really knowing what language/s are supported. After digging through the entire page it looks like maybe C/C++/Java? There should be a huge button, or something, front, and center. <<SUPPORTED LANGUAGES>> Looks like a cool idea, but I don't know if I can even utilize this tool.
- ska 9y agoThis may be a result of your feedback, but for me looking just now it it front and center: "Sourcetrail - A cross platform source explorer for C/C++ and Java"
- 0xffff2 9y agoAlthough physically front and center, the fact that that line is nearly the smallest thing on the page caused me to gloss over it entirely my first time through.
- haffla 9y agoI didn't see it either. Was about to ask if it'll work for Rails projects haha
- alkonaut 9y agoHaha there it is. Who said whining on HN doesn't change the world.
- ebcode 9y agoThat honor goes to melling: >Some guy whining on HN about a first generation product adds zero value. https://news.ycombinator.com/item?id=9500455 https://news.ycombinator.com/item?id=9500455
- agentgt 9y agoJust a feature request if it isn't already in the works: Runtime analysis of code that actually matters ie live code. Often its hard to figure out what in the code base actually matters. Debugging is still sort of difficult and dead code is really hard to find and get rid of. Particularly if reflection is used heavily which it almost always is these days. Otherwise (IMO) as a Java developer IntelliJ and Eclipse are actually not that far off in their static analysis and already pretty good to discover the code. Especially IntelliJ as I can easily see them enhancing their code view/discovery as well as they already have static dead code analysis. I guess I don't think discovering code bases is that much of a problem compared to understand what is actually running. That is I think debugging particularly multithreaded applications is vastly more difficult problem. Thus runtime analysis would be very useful.
- egraether 9y agoThank you for your input! I wouldn't call it a feature request though, I'd say it's another tool. But, you are right, exploration of dynamicly analyzed code would also greatly benefit understanding.
- enobrev 9y agoThis looks like an exceptionally useful tool! Thanks for making and sharing it. The video is excellent. It reminds me of a feature I've always wanted, which would be a code unravel-er. Basically I'd like to be able to select a line anywhere in a codebase, and have said codebase expand to show me the entire execution path as if it were in one single scope, with the ability to re-collapse sections back into loops and functions while reading. I think it would help to better understand the codepaths that can start to get fuzzy when jumping between abstractions. It would be great - not only for understanding unfamiliar code - but also for double-checking logic across longer code paths. At any rate - great idea, great implementation, and beautiful website.
- CPAhem 9y agoIf you're looking for a similar tool which does have a code unravel-er look at SciTools Understand[1] for C/C++/Java My previous company used Understand on a large unfamiliar codebase, it helped greatly, but was pricey. [1] https://scitools.com/ https://scitools.com/
- popeko 9y agoThere's also Source Insight [1] which supports C/C++/Java/Obj-C - quite a fantastic tool, but unfortunately it's Windows only (Wine works with a few hiccups) [1] https://www.sourceinsight.com/ https://www.sourceinsight.com/
- Operyl 9y agoWait a second, a tool that supports going through Obj-C is Windows only? That’s .. a shame.
- fazzone 9y agoI am playing around with an idea like this for editing Clojure in Emacs with cider-mode. You have to manually build the 'thread' that such a code unravel-er would return, but then you can read and edit functions from many files in one buffer. You start with the highest-level function you are interested in, and then pull the definitions of functions it calls into view as needed. https://github.com/fazzone/multifiles.el/tree/cider-hacks https://github.com/fazzone/multifiles.el/tree/cider-hacks
- kuangye 9y agoHas anyone run a large codebase like chromium with this tool? Is the indexing looking at what's compiled like libclang or is it static like gtags?
- ensiferum 9y agoI'd imagine it's going to violently shit itself. Chromium has pretty good online code search btw.
- kuangye 9y agoYes, but not the kind of visualization and calling stack shown by SourceTrial. Some of the code is 10 layers deep where the stuff actually happens with many complicated usage of inheritance, which I figure is where this kind of tool can shine.
- davidshepherd7 9y agoPretty sure it's compiled,I tried it out and it took a while to process on code that ggtags parses in seconds.
- coffeeski 9y agoA CDN hosted site would be good
- coffeeski 9y agoOr hosted on an S3 bucket... took forever to load
- coffeeski 9y agoWatched the demo video, can you add support to Javascript and Ruby? This is an amazing tool
- joshdotsmith 9y agoLooks fantastic. Do you have plans to support additional languages? This would be particularly useful in open source.
- pavlakoos 9y agoThat looks amazing. Does it also work with Objective-C ?
- egraether 9y agoNo, not yet. There is a feature request: https://github.com/CoatiSoftware/SourcetrailBugTracker/issues/36 https://github.com/CoatiSoftware/SourcetrailBugTracker/issue...
- mden 9y agoOn a first look, it looks amazing. This is actually what I've always imagined "graphical" programming to look like.
- girishso 9y agoSlightly tangential.. a code editor was showcased on HN few years back, with context sensitive "panes".. for example currently selected function/variable declarations in another pane. Very impressive stuff, but can't seem to find it anywhere now.
- girishso 9y agoThe best similar tool looks like http://brackets.io/ http://brackets.io/, but it only works for HTML/CSS.
- nkerkin 9y agoVisual Studio 2013 and lower had the Code Definition window, which sounds very similar to what you are describing. It was replaced by the (possibly inferior) inline Code Peek feature in VS15.
- girishso 9y agoIt was most definitely not Visual Studio, it was from some startup. But thanks anyway!
- Zalos 9y agoAny plans to add support for PHP to this? it looks really cool :)
- ifree 9y agoGot lots of compiling error when trying it on a large code base
- m712 9y agoNot saying this is bad, but... Instead of giving money to a tool like this, you could just use ctags/etags, both of which are Free Software. It doesn't show detailed graphs like Sourcetrail does, but it allows source code traversal by function definitions, and supports a crapton of languages.
- davidshepherd7 9y agoI had a quick play with this today and it seems like something that could be really useful. A couple of relatively minor comments for you: * In C++ it might be useful to filter include guards out of the symbol lists. * I had some problems with using the menus (couldn't click on them, when I did select them couldn't get the menu to drop down). It's probably just because I'm using a weird window manager (xmonad, no window decorations, Ubuntu 16.04).
- fomojola 9y agoLooks really good: one possible suggestion would be to allow sharing/reuse of indexes. Let me commit the built index to git and then have someone else checkout and use the index that was prebuilt. One (potentially paying) alternative would be to provide a precompilation service. Not sure if your index generation can be parallelized, but potentially you could take an archive of the code (or pull directly from Github or Bitbucket or any other repo endpoint) then spin up a large EC2 instance (or the equivalent for your cloud of choice) and accelerate the generation of the index. For large codebases it may provide a good boost.