Spotter

Spotter is a universal search interface. Like in the case of the Inspector, we accomplish this through a moldable interface.

Search always happens in a context of an object. The default Spotter opens in a default context and can multiple kinds of searches like Object, for a class or ./ for the local folder.

The actual search is defined separately. Each search definition has a name, and is presented in the search result in the form of a search category. Through this, every search yields results in possibly multiple categories of results. For example, in the default context we get:

Molding search

A Spotter search is like an inspector view: it's a method implemented in a class of the object in the context of which we want to search. The global Spotter starts from an instance of GtSpotterStart Object subclass: #GtSpotterStart instanceVariableNames: 'spotterModel' classVariableNames: '' package: 'GToolkit-Spotter-Extensions' . This one has methods like GtSpotterStart>>#gtSearchForClassesFor: gtSearchForClassesFor: aSearch <gtSearch> ^ aSearch explicit priority: 10; title: 'Classes'; search: [ :aContext | GtPharoIndex current asyncClassesForWord: aContext searchQuery ]; "itemIcon: #systemIcon;" "keyBinding: $b meta;" yourself which is responsible for searching for classes and traits in the image:

Such search methods can be defined in any class.

To learn from similar methods, you can look at Querying Pharo code with GT filters:

#gtSearch gtPragmas