Only init a Session for html & js files

This commit is contained in:
Erik Tierney committed 2013-05-14 11:00:43 -04:00
1 parent 3bc2bd8bd8
commit 72b3669769
2 files changed
+9 -2

No files matched your search

@@ -28,6 +28,8 @@ define(function (require, exports, module) {
"use strict";
var LANGUAGE_ID = "javascript",
HTML_LANGUAGE_ID = "html",
SUPPORTED_LANGUAGES = [LANGUAGE_ID, HTML_LANGUAGE_ID],
SINGLE_QUOTE = "'",
DOUBLE_QUOTE = "\"",
TERN_ADD_FILES_MSG = "AddFiles",
@@ -168,6 +170,9 @@ define(function (require, exports, module) {
});
}
function isSupportedLanguage(languageId) {
return SUPPORTED_LANGUAGES.indexOf(languageId) !== -1;
}
var KEYWORD_NAMES = [
"break", "case", "catch", "continue", "debugger", "default", "delete",
"do", "else", "finally", "for", "function", "if", "in", "instanceof",
@@ -194,6 +199,7 @@ define(function (require, exports, module) {
exports.splitPath = splitPath;
exports.eventName = eventName;
exports.annotateLiterals = annotateLiterals;
exports.isSupportedLanguage = isSupportedLanguage;
exports.KEYWORDS = KEYWORDS;
exports.LITERALS = LITERALS;
exports.LANGUAGE_ID = LANGUAGE_ID;
@@ -206,4 +212,5 @@ define(function (require, exports, module) {
exports.TERN_GET_FILE_MSG = TERN_GET_FILE_MSG;
exports.TERN_CALLED_FUNC_TYPE_MSG = TERN_CALLED_FUNC_TYPE_MSG;
exports.TERN_PRIME_PUMP_MSG = TERN_PRIME_PUMP_MSG;
exports.SUPPORTED_LANGUAGES = SUPPORTED_LANGUAGES;
});
@@ -470,7 +470,7 @@ define(function (require, exports, module) {
cachedHints = null;
cachedType = null;
if (editor) {
if (editor && HintUtils.isSupportedLanguage(LanguageManager.getLanguageForPath(editor.document.file.fullPath).getId())) {
initializeSession(editor, true);
} else {
session = null;
@@ -552,7 +552,7 @@ define(function (require, exports, module) {
installEditorListeners(EditorManager.getActiveEditor());
var jsHints = new JSHints();
CodeHintManager.registerHintProvider(jsHints, [HintUtils.LANGUAGE_ID, "html"], 0);
CodeHintManager.registerHintProvider(jsHints, HintUtils.SUPPORTED_LANGUAGES, 0);
// for unit testing
exports.getSession = getSession;