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

Allow multiline searches #35

Open
akshetpandey opened this Issue Jan 25, 2018 · 6 comments

Comments

Projects
None yet
7 participants
@akshetpandey
Copy link

akshetpandey commented Jan 25, 2018

Hey, its very common to have a single objc function call span multiple lines. Is there was to search multiple lines in sourcegraph?

@beyang

This comment has been minimized.

Copy link
Member

beyang commented Jan 26, 2018

Yes, I can see the pain with a language like Objective-C. @keegancsmith any thoughts on how hard this would be to support?

@keegancsmith

This comment has been minimized.

Copy link
Member

keegancsmith commented Jan 26, 2018

There isn't a way right now. Our JIT backend could support it, our indexed backend probably could as well (would need to investigate). For the JIT backend in theory it could be faster, since a surprising cost in regex engines is finding newlines and counting them. Our bigger issue is the way the API is structured assumes single line matches, which affects us all the way up into our frontend. As such I don't see it being a short term priority to implement.

@beyang

This comment has been minimized.

Copy link
Member

beyang commented Jan 26, 2018

@akshetpandey it sounds like this will be a non-trivial amount of dev work. Can you share some more information to help us prioritize accordingly?

  • Can you point to some code examples from open source that demonstrate the problem and give us a clear target? Perhaps there is a simpler solution that doesn't require "full" multiline support.
  • Is this a dealbreaker for your use of Sourcegraph on the Objective-C code you care about?
  • If so, are you still finding Sourcegraph useful in other languages, or is Objective-C the primary language you wish to index?
@akshetpandey

This comment has been minimized.

Copy link
Author

akshetpandey commented Jan 26, 2018

1> https://github.com/AFNetworking/AFNetworking/blob/master/Example/iOS%20Example/Controllers/GlobalTimelineViewController.m#L91-L92

Suppose I want to find all implementation of that delegate because I want to refactor it and find out who is affected.

Or suppose I have a crash in a function alertView:didDismissWithButtonIndex: . But that is a delegate function and my stack trace won't tell me exactly which one is crashing. Now I need to find all instances of that function in all my codebase. Very often the delegate declaration will be split into multiple lines.

Its not an end of the world, because I can always search just didDismissWithButtonIndex but there are a whole bunch of false positives. Does make doing back of the hand estimation hard but isn't really a blocker.

2>
Its not a deal breaker but with no support for language server for objc and no multiline matches its basically as good as github org search.

3>
Objc is about 90% of our code base and very few people deal in other languages. Its still early days to find out how sourcegraph would impact our workflow. I personally have been using ripgrep for all my searches so I am still trying to figure out how to fit sourcegraph into my use cases but the potential seems interesting.

@beyang

This comment has been minimized.

Copy link
Member

beyang commented Jan 29, 2018

Thanks for describing those, Akshet. In full transparency, we will likely not get around to addressing this directly in our next iteration (the next month or so). After that, we will revisit the following proposals that may address your issue:

  • Multiline search
  • Objective-C code intelligence

Will post back to this issue when there is more news to report.

@keegancsmith keegancsmith added the search label Jul 27, 2018

@sourcegraph sourcegraph deleted a comment from sourcegraph-bot Oct 9, 2018

@slimsag slimsag removed the new-contributor label Oct 9, 2018

@sqs sqs added this to the Backlog milestone Oct 25, 2018

chrismwendt added a commit that referenced this issue Nov 4, 2018

chrismwendt added a commit that referenced this issue Nov 4, 2018

@FranklinYu

This comment has been minimized.

Copy link

FranklinYu commented Nov 28, 2018

The searching function is the key; how it is presented doesn’t really matter. For example, if I search tableView:heightForRowAtIndexPath:, I wouldn’t mind if Sourcegraph gives single line result

https://github.com/AFNetworking/AFNetworking/blob/5890adc404d0187dcc452f467c8fc3cedc19869d/Example/iOS%20Example/Controllers/GlobalTimelineViewController.m#L91

Also the hover card for Objective-C classes and methods would be helpful. Shall we start with Objective-C language server?

@keegancsmith keegancsmith modified the milestones: Backlog, 3.1 Jan 7, 2019

@keegancsmith keegancsmith added the plan label Jan 7, 2019

@sqs sqs removed the plan label Jan 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment