hyperclick Archived: ... Source Code has been archived

Pluggable text-clicking UI for Atom

facebook-atom

1,029,229

515

0.1.5

BSD-3-Clause

GitHub

This package provides the following services:

This package consumes the following services:

Hyperclick

NOTE: This package is now a bundled version of the code in atom-ide-ui. Please refer to the atom-ide-ui repository to view or modify the source.

Pluggable text-clicking UI for Atom.

Hyperclick is triggered by two events:

Known Providers

Check out the wiki: https://github.com/facebook-atom/hyperclick/wiki/Known-Providers

Demo

Install hyperclick with this demo package to recreate the screencast below.

hyperclick-demo

Provider API

Example

Declare the provider callback in the package.json (e.g. getProvider).

"providedServices": {
  "hyperclick": {
    "versions": {
      "0.1.0": "getProvider"
    }
  }
}

NOTE: Providers for hyperclick.provider@0.0.0 are still accepted, but that naming is now deprecated. Please use hyperclick@0.1.0 for new providers.

Define the provider callback in lib/main.js.

export function getProvider() {
  return {
    priority: 1
    grammarScopes: ['source.js'], // JavaScript files
    getSuggestionForWord(
      textEditor: TextEditor,
      text: string,
      range: Range
    ): ?HyperclickSuggestion {
      return {
        // The range(s) to underline as a visual cue for clicking.
        range,
        // The function to call when the underlined text is clicked.
        callback() {},
      };
    },
  };
}

Details

You must define one of these methods on the provider:

The methods return a suggestion or a Promise that resolves to a suggestion:

Additional provider fields: