-
Notifications
You must be signed in to change notification settings - Fork 20
/
main.js
59 lines (48 loc) · 2.04 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* Ternific Copyright (c) 2014 Miguel Castillo.
*
* Licensed under MIT
*/
define(function (require, exports, module) {
"use strict";
var AppInit = brackets.getModule("utils/AppInit"),
EditorManager = brackets.getModule("editor/EditorManager"),
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"),
CodeHintManager = brackets.getModule("editor/CodeHintManager");
var Menu = require('Menu'),
Logger = require('Logger'),
TernManager = require('TernManager'),
TernificController = require("views/controllers/ternific");
window.ternificLogger = Logger;
// Load up string utils...
require("string");
ExtensionUtils.loadStyleSheet(module, "style/main.css");
ExtensionUtils.loadStyleSheet(module, "views/styles/ternific.css");
ExtensionUtils.loadStyleSheet(module, "libs/font-awesome/css/font-awesome.css");
var ternManager = new TernManager();
ternManager.onReady(function () {
/*
* Handle the activeEditorChange event fired by EditorManager.
* Uninstalls the change listener on the previous editor
* and installs a change listener on the new editor.
*
* @param {Event} event - editor change event (ignored)
* @param {Editor} current - the new current editor context
* @param {Editor} previous - the previous editor context
*/
function handleActiveEditorChange(event, current /*, previous*/) {
if (current) {
ternManager.registerDocument(current._codeMirror, current.document.file);
}
}
EditorManager.on("activeEditorChange.ternific", handleActiveEditorChange);
handleActiveEditorChange(null, EditorManager.getActiveEditor(), null);
CodeHintManager.registerHintProvider(ternManager.ternHints, ["javascript"], 1);
});
AppInit.appReady(function() {
Menu.init();
});
AppInit.htmlReady(function () {
new TernificController(ternManager);
});
});