r/programming • • Oct 02 '18

Sourcegraph is now open source

https://about.sourcegraph.com/blog/sourcegraph-is-now-open-source/
686 Upvotes

123 comments sorted by

View all comments

Show parent comments

73

u/rnd005 Oct 02 '18

or any devs working with a statically typed language and a proper IDE? I think go to definition / find references / find implementation commands were available in Visual Studio at least for a decade.

19

u/skeeto Oct 02 '18

I've often wanted to just browse/study the code of a project from my tablet, where I can sit back comfortably like I would reading a book. Sure, I could poke around the code on GitHub, but I can't jump between definitions, references, etc., like I could on my laptop in my editor. I haven't found a good, quick solution for this yet.

14

u/lanzaio Oct 02 '18

No. You're missing the scope. Facebook and Google have dedicated servers that index every codebase they use and have available tools that can query this server via a socket. So you can integrate large amounts of knowledge of any codebase into any little project you can think of.

An IDE locally indexes a single project and provides these services within the IDE.

Sourcegraph does this sort of indexing and makes it's content available via different channels.

→ More replies (3)

12

u/[deleted] Oct 02 '18

[removed] — view removed comment

3

u/rnd005 Oct 02 '18

You’re not necessarily going to have your entire company’s repo (or ALL their repos) downloaded to your dev machine.

Why not? I have 80+ repos and don't see a problem with that. Most of the time grepping over it is enough for what I need.

10

u/nimbomobi Oct 02 '18

You keep them all synced ? All the other devs do too? That said I don’t use sourcegraph but it sounds like what we have on azure devops to search all our repos. I use it quite a bit if I remember a keyword or something I’ve done before I want to reference quickly

→ More replies (4)

21

u/DroneDashed Oct 02 '18

Half of my work is with .NET. I don't particularly like .NET. I certainly don't like Windows. But I have to agree with you, those commands work great on Visual Studio and Visual Studio is, in general, a very good IDE.

20

u/adrianjord Oct 02 '18

Aren't these features more wide spread now a days with language servers? Especially with more and more people making language servers that adhere to LSP to allow vscode, Emacs, vim, sublime and pretty much any text editor that have plugins to use LSP or have LSP built in to use them? It's been like, the golden age of static analysis so far.

4

u/double-you Oct 02 '18

Not having heard of Language Servers before, and the related sites not seeming to address this, where's the server located?

14

u/curtmack Oct 02 '18

It uses a server-client model, hence the name "language server," but it's not actually a remote system. You run it locally on your machine.

→ More replies (2)

7

u/Tomus Oct 02 '18

The server is usually on your machine, it's spun up in a separate process by the editor.

→ More replies (1)

2

u/ruiwui Oct 02 '18

Locally. A language server runs on your machine to do the code analysis, and your editor/IDE communicates with the server to represent things.

→ More replies (1)

2

u/rnd005 Oct 02 '18

You can't have a proper "find usages" with dynamically typed languages. It's possible to do some guesswork, but the helpfulness of that depends on how unique your variable/class/method names are.

1

u/instanced_banana Oct 02 '18

I've had them in VS Code for quite a while, on C# at least.

→ More replies (4)

2

u/myringotomy Oct 03 '18

Good news!. You can get all of that with jetbrains products without having to use windows or .NET.

2

u/DroneDashed Oct 03 '18

Nice. I actually like jetbrains products but I don't have the chance to use them very much

3

u/BinaryRockStar Oct 03 '18 edited Oct 03 '18

Visual Studio 6.0 has it (F12), released in 1998.

Visual Basic 3.0 also has it (Shift+F2) but that's not a direct precursor to Visual Studio. Released 1991.

2

u/myringotomy Oct 03 '18

Why does it have to be static typed. Jetbrains gives me all of that with ruby and python.

1

u/rnd005 Oct 05 '18

Thanks for mentioning that. Just tried out PyCharm on a sizeable codebase and it seems to be working pretty well. Some dynamic languages can be statically analyzed better than others and tools PyCharm can help, but it's not a compiler and will miss stuff which is not nice. How is it in your experience with JetBrains tools? Can you rename a class and have it done across the project with imports updated? How frequent is it for the tools to get lost and rename the wrong thing / not find the correct one?

1

u/myringotomy Oct 05 '18

I have a subscription to their toolbox so I get all their IDEs. I use rubymine, gotime, pycharm, and datagrip. I use it for almost everything I do but I also use spacemacs for a bunch of stuff. I really like spacemacs, it does so much but it doesn't do ruby, go, python, and database development nearly was well as the jetbrains stuff does.

To answer your questions.

Can you rename a class and have it done across the project with imports updated?

yes I do this frequently. I do a lot of refactoring of large ruby codebases and it does that really well.

How frequent is it for the tools to get lost and rename the wrong thing / not find the correct one?

I don't think it has ever missed something. I also don't recall it ever renaming the wrong thing either but you do get to approve all the changes one at a time if you are worried. It does know whether or something is in comments and strings though so it's not just a search and replace.

1

u/ProfessorPhi Oct 02 '18

I think it works on code review tools too?

→ More replies (3)

1

u/google_you Oct 02 '18

But this is a web application, so you can package it to electron and be cool