UNPKG

atom-nuclide

Version:

A unified developer experience for web and mobile development, built as a suite of features on top of Atom to provide hackability and the support of an active community.

83 lines (66 loc) 2.05 kB
Object.defineProperty(exports, '__esModule', { value: true }); /* * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the license found in the LICENSE file in * the root directory of this source tree. */ exports.activate = activate; exports.deactivate = deactivate; exports.consumeProvider = consumeProvider; exports.observeTextEditor = observeTextEditor; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _atom2; function _atom() { return _atom2 = require('atom'); } var _Hyperclick2; function _Hyperclick() { return _Hyperclick2 = _interopRequireDefault(require('./Hyperclick')); } var hyperclick = null; function activate() { hyperclick = new (_Hyperclick2 || _Hyperclick()).default(); // FB-only: override the symbols-view "Go To Declaration" context menu item // with the Hyperclick "confirm-cursor" command. // TODO(hansonw): Remove when symbols-view has a proper API. try { // $FlowFB var _require = require('./fb/overrideGoToDeclaration'); var overrideGoToDeclaration = _require.overrideGoToDeclaration; overrideGoToDeclaration(); } catch (e) { // Ignore. } } function deactivate() { if (hyperclick != null) { hyperclick.dispose(); hyperclick = null; } } function consumeProvider(provider) { if (hyperclick != null) { hyperclick.consumeProvider(provider); return new (_atom2 || _atom()).Disposable(function () { if (hyperclick != null) { hyperclick.removeProvider(provider); } }); } } /** * A TextEditor whose creation is announced via atom.workspace.observeTextEditors() will be * observed by default by hyperclick. However, if a TextEditor is created via some other means, * (such as a building block for a piece of UI), then it must be observed explicitly. */ function observeTextEditor() { return function (textEditor) { if (hyperclick != null) { hyperclick.observeTextEditor(textEditor); } }; }