Skip to content

Commit e39d52c

Browse files
committed
feat: convert main to TypeScript
- Use module level variables - export functions directly - no null set is needed in deactivate - fix import and types
1 parent 516cf00 commit e39d52c

File tree

3 files changed

+51
-75
lines changed

3 files changed

+51
-75
lines changed

lib/main.js

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/main.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
}

src/signature-help-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ProviderRegistry } from "atom-ide-base/commons-atom/ProviderRegistry"
33
import { ViewContainer } from "atom-ide-base/commons-ui/float-pane/ViewContainer"
44
import { makeOverlaySelectable, makeOverLayCopyable } from "atom-ide-base/commons-ui/float-pane/selectable-overlay"
55

6-
export default class SignatureHelpManager {
6+
export class SignatureHelpManager {
77
/**
88
* holds a reference to disposable items from this data tip manager
99
*/

0 commit comments

Comments
 (0)