getHelpers method

List<JsObject> getHelpers(
  1. Position pos,
  2. String type
)

Fetch the set of applicable helper values for the given position. Helpers provide a way to look up functionality appropriate for a mode. The type argument provides the helper namespace (see registerHelper), in which the values will be looked up. When the mode itself has a property that corresponds to the type, that directly determines the keys that are used to look up the helper values (it may be either a single string, or an array of strings). Failing that, the mode's helperType property and finally the mode's name are used.

For example, the JavaScript mode has a property fold containing "brace". When the brace-fold addon is loaded, that defines a helper named brace in the fold namespace. This is then used by the foldcode addon to figure out that it can use that folding function to fold JavaScript code.

When any 'global' helpers are defined for the given namespace, their predicates are called on the current mode and editor, and all those that declare they are applicable will also be added to the array that is returned.

Implementation

List<JsObject> getHelpers(Position pos, String type) {
  return List.from(callArgs('getHelpers', [pos.toProxy(), type]));
}