pub-dev icon indicating copy to clipboard operation
pub-dev copied to clipboard

[Feature Request] Code Search for pub

Open dnfield opened this issue 6 years ago • 7 comments

Something like https://cs.chromium.org/ would be really nice to have for pub.

It would help Flutter contributors understand the impact of (potentially) breaking changes better. It would also help the community be able to find example implementations of classes/methods/etc. they're interested in.

It would be important that this functionality allow searching all source files contained in a package, not just the public portions of the library. It would be nice if it could include searching of any non-Dart source as well (such as Java/Kotlin/ObjC/Swift files in Flutter plugins, but potentially other langauges as Dart FFI becomes a reality).

/cc @goderbauer @hixie

dnfield avatar Feb 27 '19 17:02 dnfield

Agreed, this would be awesome...

Please refile this issue in the repository for the pub service: https://github.com/dart-lang/pub-dartlang-dart

Note. a prerequisite of this would be source listings for Dart, ideally with cross referencing and other stuff... I asked about this on dartdoc not that long ago..

Note. pub.dartlang.org already does search public API extracted during dartdoc generation.. and dartdoc already supports simple search within the given package.. but there is no source listings or cross referencing in the code.

jonasfj avatar Feb 28 '19 19:02 jonasfj

@kevmoo can this be transfered or should I just close it and open a new one?

dnfield avatar Feb 28 '19 20:02 dnfield

What I'd really like is not just the source listings for Dart, but also any other source in there - Objective C, Java, Swift, Kotlin, C/C++, etc. But even just Dart would be good to start with.

dnfield avatar Feb 28 '19 22:02 dnfield

What would be the top use-cases for this? While it sounds like a cool feature, I worry that we would have a hard time providing something significantly better than github codesearch provides (of course this assumes that plugins are available on github...) , and falls outside the scope of the pub service as I see it: providing access to the public api of packages. Not saying we shouldn't do it - just want to understand the proposal better.

sigurdm avatar Mar 01 '19 10:03 sigurdm

Githubs codesearch is pretty poor imo. It doesn't understand syntax, or even support searching for a literal beyond simple cases.

I would see the following use cases:

  1. Search for all usages of a class or method in files of a specific type
  2. Search for a specific quoted string
  3. Search for files that contain string a but do not contain string b

dnfield avatar Mar 01 '19 15:03 dnfield

I've personally used https://go-search.org/ before, it can be useful to find examples of how stuff works.

jonasfj avatar Mar 04 '19 11:03 jonasfj

This is still relevant

sigurdm avatar Aug 22 '24 08:08 sigurdm