News for hackers. Stuff that matters.
Re:An infinite canvas for code exploration by pst723 on Monday May 06, 2024 @05:03PM (#40279500)
We built an "infinite canvas" style app for exploring codebases. We cut your repo into atomic pieces - functions, data structures etc. and give you an interactively expandable graph of defintions.

Even with the best go-to-definition editor feature you need to keep a whole bunch of mental context when tracking down a deep control flow. The idea of Territory is to give you exactly the relevant cross-section through a large codebase. A code map that you build in this fashion can then provide explanatory value to others.

So far we indexed Linux, LLVM and Godot to prove we can handle repos of that scale and to provide value free of charge to free software contributors. We will be adding more repos and shipping self-service build setup later. Would love to hear your opinion. Are there any projects you think we should cover next? We are doing C/C++ first -- our initial parsing setup is build around libclang.

Re:An infinite canvas for code exploration by pseudosudoer on Monday May 06, 2024 @06:38PM (#40280311)
Ideally this would be a standalone app (perhaps ported using electron) that I could run locally, and import codebases directly. Sourcegraph was on the right track, but eventually fizzled out unfortunately.

I would love to use a tool like this to navigate the unknown on rails!

Re:An infinite canvas for code exploration by sqs on Monday May 06, 2024 @07:45PM (#40280751)
Sourcegraph CEO here. We stopped making a standalone Electron app (which was an experiment) and instead remained focused on our web app and editor extensions. You can use Cody in your editor with no server needed. We didn’t fizzle out. :)
Re:An infinite canvas for code exploration by pst723 on Monday May 06, 2024 @08:58PM (#40281177)
Oh hi there! Love what Sourcegraph is doing.
Re:An infinite canvas for code exploration by pseudosudoer on Tuesday May 07, 2024 @01:03PM (#40288400)
I confused Sourcetrail and SourceGraph, didn't mean to spread misinformation on your product!
Re:An infinite canvas for code exploration by pst723 on Monday May 06, 2024 @06:45PM (#40280362)
That is definitely an option. However what you get from a hosted service is that we do the indexing for you. That can take a significant amount of time for a huge codebase.
Re:An infinite canvas for code exploration by jijijijij on Monday May 06, 2024 @07:20PM (#40280601)
Love the idea, but isn't the "indexing" part of many editors and language servers already? Ctags and stuff? Never got the impression that to be a huge problem on modern hardware.

I doubt, there will be much demand for throwing large non-public code bases into third party services... However, I can totally see how this would be a hit as a FOSS project.

Re:An infinite canvas for code exploration by sdesol on Monday May 06, 2024 @08:26PM (#40281014)
I've built a code search engine in the past so I know how painful debugging long indexing jobs can be and I would certainly be reluctant to support private repos until I know I can index thousands if not tens of thousands of open source repos with no issues.
Re:An infinite canvas for code exploration by pst723 on Monday May 06, 2024 @11:19PM (#40282018)
That's more or less the plan. We want to prove our concept with free software repos first.
Re:An infinite canvas for code exploration by blcArmadillo on Monday May 06, 2024 @10:37PM (#40281773)
By chance did you mean Sourcetrail [1] instead of Sourcegraph? Old demo video on YouTube: https://youtu.be/Cfu6f0uyzc8?si=oNS9KKlbgEk_Ct0p.

[1] https://github.com/CoatiSoftware/Sourcetrail

Re:An infinite canvas for code exploration by pseudosudoer on Tuesday May 07, 2024 @01:02PM (#40288385)
Yes you're right, my mistake!
Re:An infinite canvas for code exploration by dontdieych on Monday May 06, 2024 @05:21PM (#40279650)
I would like editing code in this style. Focus on narrow area but can easily view as bird eye.

Nice work!

Re:An infinite canvas for code exploration by pst723 on Monday May 06, 2024 @05:36PM (#40279777)
Thank you!

Editing is definitely on the roadmap. We would like to have an agent to sync edits with your local workspace at some point.

Re:An infinite canvas for code exploration by verdverm on Monday May 06, 2024 @06:20PM (#40280171)
What about a VS Code extension? Would love to explore like this in my IDE over needing a separate tool / webapp

Something like: https://github.com/pixelkind/p5canvas

Re:An infinite canvas for code exploration by pst723 on Monday May 06, 2024 @06:31PM (#40280259)
I got that request from a couple of people already. Definitely coming soon. For now, we tried to make it easy to hop around manually. Click the node header to copy path, ⌘P, paste. Pasting a path to our search bar also works.
Re:An infinite canvas for code exploration by gigatexal on Monday May 06, 2024 @06:53PM (#40280411)
Post to HN when that launches. I’ll take a look then.
Re:An infinite canvas for code exploration by pst723 on Monday May 06, 2024 @07:19PM (#40280595)
Sure. You can follow as on X @territory_dev, I post updates there.
Re:An infinite canvas for code exploration by verdverm on Monday May 06, 2024 @06:55PM (#40280434)
I can imagine a number of really cool ways to explore code with a tight integration to intellisense / LSP

in particular, show all callers and callees of a code snippet

Re:An infinite canvas for code exploration by speps on Monday May 06, 2024 @06:22PM (#40280195)
Support Unreal Engine and you'd get a lot of interest from game devs!
Re:An infinite canvas for code exploration by azeirah on Monday May 06, 2024 @06:43PM (#40280347)
I have some interesting ideas about this, as I've been thinking about it and have been prototyping ideas for ... a decade at this point?

Do you have a way to contact you?

Any reason you're not using treesitter with LSPs by the way? This would make it really easy to get this working with all major languages at once.

Re:An infinite canvas for code exploration by pst723 on Monday May 06, 2024 @07:19PM (#40280591)
LSP and treesitter are cool and we might use them when adding more languages eventually. From my understanding though treesitter does parsing only and it would take a bunch of work to do the semantic analysis clang already does. Plus clang is an industry tried compiler that we know can handle a lot of the rough edge cases of C and C++. LSP is closer to our use case but I think still not close enough. It took a lot of work to get the right points to cut the code at and when talking to clang directly, at least we can inspect things at a decently low level.

Are you on X? You can DM me at @pst723 or @territory_dev.

Re:An infinite canvas for code exploration by voxelghost on Monday May 06, 2024 @10:12PM (#40281596)
Some first impression UI feedback:

Don't overlap existing boxes when exploring new definition. Instead find the lowest free space in the column (or insert it at appropriate level)

When adding a reference to rather than exploring definition, default to adding box to the opposite side (left)

Re:An infinite canvas for code exploration by pst723 on Monday May 06, 2024 @11:37PM (#40282115)
Ah yes those are definitely on the TODO list.
Re:An infinite canvas for code exploration by voxelghost on Tuesday May 07, 2024 @12:55AM (#40282474)
While we are at it, it would probably also be nice to (optionally) color the background of the explored row(or token) and color the title bar of the result correspondingly (I am thinking similar to Godbolt color coding for matching C->ASM)
Re:An infinite canvas for code exploration by anentropic on Tuesday May 07, 2024 @11:24AM (#40286845)
It'd be great if this UI could happen inside VS Code, for the current workspace and its dependencies
Re:An infinite canvas for code exploration by aappleby on Wednesday May 08, 2024 @03:15PM (#40301848)
This might interest you - https://github.com/aappleby/wideboard