|
| 1 | +import { CompositeDisposable } from "atom" |
| 2 | +import { SignatureHelpManager } from "./signature-help-manager" |
| 3 | +import { SignatureHelpRegistry } from "atom-ide-base" |
| 4 | + |
| 5 | +let subscriptions: CompositeDisposable |
| 6 | +let signatureHelpManager: SignatureHelpManager |
| 7 | + |
| 8 | +/** |
| 9 | + * called by Atom when activating an extension |
| 10 | + */ |
| 11 | +export function activate() { |
| 12 | + // Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable |
| 13 | + subscriptions = new CompositeDisposable() |
| 14 | + if (!signatureHelpManager) signatureHelpManager = new SignatureHelpManager() |
| 15 | + subscriptions.add(signatureHelpManager) |
| 16 | + require("atom-package-deps") |
| 17 | + .install("atom-ide-signature-help") |
| 18 | + .then(() => { |
| 19 | + signatureHelpManager.initialize(renderer) |
| 20 | + }) |
| 21 | +} |
| 22 | + |
| 23 | +/** |
| 24 | + * called by Atom when deactivating an extension |
| 25 | + */ |
| 26 | +export function deactivate() { |
| 27 | + if (subscriptions) { |
| 28 | + subscriptions.dispose() |
| 29 | + } |
| 30 | +} |
| 31 | + |
| 32 | +export function provideSignatureHelp(): SignatureHelpRegistry { |
| 33 | + return signatureHelpManager.signatureHelpRegistry |
| 34 | +} |
| 35 | + |
| 36 | +export const config = { |
| 37 | + showSignatureHelpOnTyping: { |
| 38 | + title: "Show signature automatically", |
| 39 | + description: |
| 40 | + "If set to true, the signature help is shown as soon as you start typing. Otherwise you will have to activate it via keypress.", |
| 41 | + type: "boolean", |
| 42 | + default: true, |
| 43 | + }, |
| 44 | + glowOnHover: { |
| 45 | + title: "Glow on hover", |
| 46 | + description: "Should signature glow when you hover on it?", |
| 47 | + type: "boolean", |
| 48 | + default: true, |
| 49 | + }, |
| 50 | +} |
0 commit comments