cleanup based on codereview comments:

Update jsdoc
use ExtensionUtils.getModulePath instead of manually slicing up path
use FileUtils.readAsText instead of DocumentManager when we only need the text on disk
Call CollectionUtils.hasProperty instead of Object.prototype.hasOwnProperty...
Add comment explaining logic around finding location of called function for function type hinting
remove unnecessary calls to setCursorPos
remove stale comments in unittests
pull out hint invalidation check into a function and remove check for query.length === 0, not necessary anymore
This commit is contained in:
Erik Tierney committed 2013-04-18 16:38:40 -04:00
1 parent 372ce5af1f
commit 10f8896d46
5 files changed
+92 -39

No files matched your search

@@ -46,6 +46,9 @@ importScripts("thirdparty/requirejs/require.js");
/**
* Provide the contents of the requested file to tern
* @param {string} name - the name of the file
* @param {Function} next - the function to call with the text of the file
* once it has been read in.
*/
function getFile(name, next) {
// save the callback
@@ -73,6 +76,11 @@ importScripts("thirdparty/requirejs/require.js");
/**
* Create a new tern server.
*
* @param {Object} env - an Object with the environment, as read in from
* the json files in thirdparty/tern/defs
* @param {string} dir - the current directory
* @param {Array.<string>} files - a list of filenames tern should be aware of
*/
function initTernServer(env, dir, files) {
var ternOptions = {
@@ -89,6 +97,14 @@ importScripts("thirdparty/requirejs/require.js");
}
/**
* Build an object that can be used as a request to tern
* @param {string} dir - the current directory
* @param {string} file - the filename the request is in
* @param {string} query - the type of request being made
* @param {number} offset - the offset in the file the request is at
* @param {string} text - the text of the file
*/
function buildRequest(dir, file, query, offset, text) {
query = {type: query};
query.start = offset;