dart-lang / pub-dev

The pub.dev website
https://pub.dev
BSD 3-Clause "New" or "Revised" License
774 stars 145 forks source link

[Feature Request] Code Search for pub #2097

Open dnfield opened 5 years ago

dnfield commented 5 years ago

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

jonasfj commented 5 years ago

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.

dnfield commented 5 years ago

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

dnfield commented 5 years ago

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.

sigurdm commented 5 years ago

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.

dnfield commented 5 years ago

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
jonasfj commented 5 years ago

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

sigurdm commented 3 weeks ago

This is still relevant