Minor fixes in code hint test/debug code to address review comments.

This commit is contained in:
Kevin Dangoor committed 2013-11-11 15:44:04 -05:00
1 parent 7fc2bd15cb
commit 3f2ad065a0
4 files changed
+35 -34

No files matched your search

@@ -1106,7 +1106,7 @@ define(function (require, exports, module) {
// Set the initial configuration for the worker
_ternWorker.postMessage({
type: MessageIds.SET_CONFIG,
config: brackets.configureJSCodeHints.config
config: config
});
}
/**
@@ -1300,7 +1300,7 @@ define(function (require, exports, module) {
*
* During debugging, you can turn this automatic resetting behavior off
* by running this in the console:
* brackets.configureJSCodeHints({ noReset: true })
* brackets._configureJSCodeHints({ noReset: true })
*
* This function is also used in unit testing with the "force" flag to
* reset the worker for each test to start with a clean environment.
@@ -1308,7 +1308,8 @@ define(function (require, exports, module) {
* @param {Session} session
* @param {Document} document
* @param {boolean} force true to force a reset regardless of how long since the last one
* @return {Promise} resolved when the new worker is ready (the new worker is passed to the callback)
* @return {Promise} Promise resolved when the worker is ready.
* The new (or current, if there was no reset) worker is passed to the callback.
*/
function _maybeReset(session, document, force) {
var newWorker;
@@ -1508,7 +1509,7 @@ define(function (require, exports, module) {
* Update the configuration in the worker.
*/
function _setConfig(configUpdate) {
config = brackets.configureJSCodeHints.config;
config = brackets._configureJSCodeHints.config;
postMessage({
type: MessageIds.SET_CONFIG,
config: configUpdate
@@ -777,7 +777,7 @@ define(function (require, exports, module) {
brackets._jsCodeHintsHelper = quickEditHelper;
// Configuration function used for debugging
brackets.configureJSCodeHints = setConfig;
brackets._configureJSCodeHints = setConfig;
ExtensionUtils.loadStyleSheet(module, "styles/brackets-js-hints.css");
@@ -482,33 +482,33 @@ var config = {};
var fnType = "";
try {
ternServer.request(request, function (error, data) {
ternServer.request(request, function (ternError, data) {
if (error) {
_log("Error for Tern request: \n" + JSON.stringify(request) + "\n" + error);
return;
}
var file = ternServer.findFile(fileInfo.name);
// convert query from partial to full offsets
var newOffset = offset;
if (fileInfo.type === MessageIds.TERN_FILE_INFO_TYPE_PART) {
newOffset = {line: offset.line + fileInfo.offsetLines, ch: offset.ch};
}
request = buildRequest(createEmptyUpdate(fileInfo.name), "type", newOffset);
var expr = Tern.findQueryExpr(file, request.query);
Infer.resetGuessing();
var type = Infer.expressionType(expr);
type = type.getFunctionType() || type.getType();
if (type) {
fnType = getParameters(type);
if (ternError) {
_log("Error for Tern request: \n" + JSON.stringify(request) + "\n" + ternError);
error = ternError.toString();
} else {
error = "No parameter type found";
_log(error);
var file = ternServer.findFile(fileInfo.name);
// convert query from partial to full offsets
var newOffset = offset;
if (fileInfo.type === MessageIds.TERN_FILE_INFO_TYPE_PART) {
newOffset = {line: offset.line + fileInfo.offsetLines, ch: offset.ch};
}
request = buildRequest(createEmptyUpdate(fileInfo.name), "type", newOffset);
var expr = Tern.findQueryExpr(file, request.query);
Infer.resetGuessing();
var type = Infer.expressionType(expr);
type = type.getFunctionType() || type.getType();
if (type) {
fnType = getParameters(type);
} else {
ternError = "No parameter type found";
_log(ternError);
}
}
});
} catch (e) {
@@ -22,7 +22,7 @@
*/
/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50, regexp: true */
/*global define, describe, xdescribe, it, xit, expect, beforeEach, afterEach, waitsFor, runs, $, brackets, waitsForDone, beforeFirst, afterLast, spyOn */
/*global define, describe, it, xit, expect, beforeEach, afterEach, waitsFor, runs, $, brackets, waitsForDone, beforeFirst, afterLast, spyOn */
define(function (require, exports, module) {
"use strict";
@@ -447,13 +447,13 @@ define(function (require, exports, module) {
describe("JavaScript Code Hinting Basic", function () {
beforeFirst(function () {
brackets.configureJSCodeHints({
brackets._configureJSCodeHints({
noReset: true
});
});
afterLast(function () {
brackets.configureJSCodeHints({
brackets._configureJSCodeHints({
noReset: false
});
});
@@ -1441,7 +1441,7 @@ define(function (require, exports, module) {
});
});
// bug: wait for tern
// bug: wait for fix in tern
xit("should read methods created in submodule", function () {
var start = { line: 19, ch: 15 };