Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE or text editor integrations #163

Open
lgo opened this issue Apr 17, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@lgo
Copy link

commented Apr 17, 2018

I wanted to pop an issue in here to discuss or report on integrations.

About a year back I had made an Atom integration that made the built-in search seamlessly use livegrep as a backend. It worked quite well, although it had a number of UX quirks with how to enable livegrep searching and return to Atom's find-and-replace behaviour.

I'd be more than happy to revisit the Atom one I had made and clean it up. Has anyone given considerations to making integrations?

@gnprice

This comment has been minimized.

Copy link

commented Apr 17, 2018

I'd love to see some editor integrations.

There are two main features I think an editor integration could provide:

  • Use livegrep as a nice fast backend for searching across the project, using the editor's UI for searching and showing results.
  • Make it super simple to generate a livegrep link for the code you're looking at right now, so you can paste that in chat / code review / email / whatever.

From what I saw inside Dropbox, I think the make-a-link feature would actually be even more valuable than the search-backend feature. This wasn't what I expected when I first deployed it there, but for most people the seconds it might take a tool like ripgrep to search in our codebase was fast enough... and what we heard most often from users who really valued livegrep was instead that the use case that made it indispensable was linking to code so they could talk about it.

On my current project, the codebase is a lot smaller and git grep really is fast enough; but if I had a great shortcut to make a shareable link, that'd probably be the key feature that'd make me set up a livegrep for us too.

It sounds like your previous integration was mainly about the search-backend feature. If that's what you're excited to build, awesome. Consider this a request to try adding the other thing too. :-)

@lgo

This comment has been minimized.

Copy link
Author

commented Apr 18, 2018

Yea, that's a great idea.

That isn't a far stretch and the only major change would be making it easy to use. When I implemented the search-backend functionality, the plugin it would populate the search results and also indicate if the result was local (in an open project) or remote. When you clicked on a result it would open locally if possible otherwise a livegrep page was opened.

With Atom the tricky part was making it behave with find-and-replace. Instead of duplicating everything they had, I simply had a toggle for livegrep mode and it would hijack all of the existing DOM for the built-in search. Adding a [copy link] text shouldn't be hard request. ;)

@gnprice

This comment has been minimized.

Copy link

commented Apr 18, 2018

Cool. The one thing I'd add about my requested feature: I'd actually decouple it entirely from searching or find-and-replace. The workflow I have in mind is more like, there's some code I'm looking at -- I may have gotten there through any means, maybe a search, maybe I searched for something I knew was nearby and then scrolled to it, maybe I was just editing some code and noticed something I wanted to start a conversation about somewhere -- and I want to make a link I can share that points to that line on a livegrep file-viewing page.

So the UI is probably basically a key shortcut and it copies to the clipboard, and maybe acknowledges somewhere that it's done so. (I haven't used Atom much, but this would go in the message area at the bottom of Emacs, or in Material/Android terms it'd be a "snackbar" or a "toast".)

Though it totally also makes sense to me to have the search-backend feature optionally produce a link to the corresponding livegrep search-results page.

The key piece that this feature shares with the search-backend feature is really the part where the user configures where the livegrep install is. That and someone knowing/learning enough of the editor's APIs to build an integration at all. :-)

@nelhage

This comment has been minimized.

Copy link
Contributor

commented Apr 18, 2018

I use https://github.com/sshaw/git-link pretty heavily in my editor to get github links, and I'm +1 to the feature in general for sites that use livegrep as their code browser. We don't, so I wouldn't personally use it today.

I do think a slick editor integration for search would be really nice. I recently switched from Linux to a mac, and git grep is much slower, to the point where I've started switching to the livegrep command line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.