Skip to content

Commit

Permalink
feat: convert main to TypeScript
Browse files Browse the repository at this point in the history
- Use module level variables
- export functions directly
- no null set is needed in deactivate
- fix import and types
  • Loading branch information
aminya committed Feb 6, 2021
1 parent 516cf00 commit e39d52c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 75 deletions.
74 changes: 0 additions & 74 deletions lib/main.js

This file was deleted.

50 changes: 50 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { CompositeDisposable } from "atom"
import { SignatureHelpManager } from "./signature-help-manager"
import { SignatureHelpRegistry } from "atom-ide-base"

let subscriptions: CompositeDisposable
let signatureHelpManager: SignatureHelpManager

/**
* called by Atom when activating an extension
*/
export function activate() {
// Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
subscriptions = new CompositeDisposable()
if (!signatureHelpManager) signatureHelpManager = new SignatureHelpManager()
subscriptions.add(signatureHelpManager)
require("atom-package-deps")
.install("atom-ide-signature-help")
.then(() => {
signatureHelpManager.initialize(renderer)
})
}

/**
* called by Atom when deactivating an extension
*/
export function deactivate() {
if (subscriptions) {
subscriptions.dispose()
}
}

export function provideSignatureHelp(): SignatureHelpRegistry {
return signatureHelpManager.signatureHelpRegistry
}

export const config = {
showSignatureHelpOnTyping: {
title: "Show signature automatically",
description:
"If set to true, the signature help is shown as soon as you start typing. Otherwise you will have to activate it via keypress.",
type: "boolean",
default: true,
},
glowOnHover: {
title: "Glow on hover",
description: "Should signature glow when you hover on it?",
type: "boolean",
default: true,
},
}
2 changes: 1 addition & 1 deletion src/signature-help-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ProviderRegistry } from "atom-ide-base/commons-atom/ProviderRegistry"
import { ViewContainer } from "atom-ide-base/commons-ui/float-pane/ViewContainer"
import { makeOverlaySelectable, makeOverLayCopyable } from "atom-ide-base/commons-ui/float-pane/selectable-overlay"

export default class SignatureHelpManager {
export class SignatureHelpManager {
/**
* holds a reference to disposable items from this data tip manager
*/
Expand Down

0 comments on commit e39d52c

Please sign in to comment.