mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
type capitalization typos and additional JSDoc annotations
This commit is contained in:
1 parent
3d66c59b7e
commit
c8b53c7153
7 files changed
+190
-89
No files matched your search
@@ -36,8 +36,8 @@ define(function (require, exports, module) {
|
||||
* Create a hint token with name value that occurs at the given list of
|
||||
* positions.
|
||||
*
|
||||
* @param {String} value - name of the new hint token
|
||||
* @param {?Array<Number>} positions - optional list of positions at which
|
||||
* @param {string} value - name of the new hint token
|
||||
* @param {?Array<number>} positions - optional list of positions at which
|
||||
* the token occurs
|
||||
* @return {Object} - a new hint token
|
||||
*/
|
||||
@@ -53,8 +53,8 @@ define(function (require, exports, module) {
|
||||
/**
|
||||
* Is the string key perhaps a valid JavaScript identifier?
|
||||
*
|
||||
* @param {String} key - the string to test
|
||||
* @return {Boolean} - could key be a valid identifier?
|
||||
* @param {string} key - the string to test
|
||||
* @return {boolean} - could key be a valid identifier?
|
||||
*/
|
||||
function maybeIdentifier(key) {
|
||||
return (/[0-9a-z_.\$]/i).test(key) ||
|
||||
@@ -66,7 +66,7 @@ define(function (require, exports, module) {
|
||||
* Is the token's class hintable? (A very conservative test.)
|
||||
*
|
||||
* @param {Object} token - the token to test for hintability
|
||||
* @return {Boolean} - could the token be hintable?
|
||||
* @return {boolean} - could the token be hintable?
|
||||
*/
|
||||
function hintable(token) {
|
||||
switch (token.className) {
|
||||
@@ -82,8 +82,8 @@ define(function (require, exports, module) {
|
||||
/**
|
||||
* Divide a path into directory and filename parts
|
||||
*
|
||||
* @param {String} path - a URI with directories separated by /
|
||||
* @return {Object<dir: String, file: String>} - a pair of strings that
|
||||
* @param {string} path - a URI with directories separated by /
|
||||
* @return {Object<dir: string, file: string>} - a pair of strings that
|
||||
* correspond to the directory and filename of the given path.
|
||||
*/
|
||||
function splitPath(path) {
|
||||
@@ -98,8 +98,8 @@ define(function (require, exports, module) {
|
||||
* Get a JS-hints-specific event name. Used to prevent event namespace
|
||||
* pollution.
|
||||
*
|
||||
* @param {String} name - the unqualified event name
|
||||
* @return {String} - the qualified event name
|
||||
* @param {string} name - the unqualified event name
|
||||
* @return {string} - the qualified event name
|
||||
*/
|
||||
function eventName(name) {
|
||||
var EVENT_TAG = "brackets-js-hints";
|
||||
@@ -114,7 +114,7 @@ define(function (require, exports, module) {
|
||||
* @param {Scope} scope - scope object used to determine the scope level of
|
||||
* each identifier token in the previous list.
|
||||
* @return {Array<Object>} - the input array; to each object in the array a
|
||||
* new level {Number} property has been added to indicate its scope
|
||||
* new level {number} property has been added to indicate its scope
|
||||
* level.
|
||||
*/
|
||||
function annotateWithScope(identifiers, scope) {
|
||||
@@ -137,7 +137,7 @@ define(function (require, exports, module) {
|
||||
* @param {Association} association - an object that maps property
|
||||
* names to the number of times it occurs in a particular context
|
||||
* @return {Array<Object>} - the input array; to each object in the array a
|
||||
* new level {Number} property has been added to indicate the number
|
||||
* new level {number} property has been added to indicate the number
|
||||
* of times the property has occurred in the association context.
|
||||
*/
|
||||
function annotateWithAssociation(properties, association) {
|
||||
@@ -154,7 +154,7 @@ define(function (require, exports, module) {
|
||||
*
|
||||
* @param {Array<Object>} globals - list of identifier tokens
|
||||
* @return {Array<Object>} - the input array; to each object in the array a
|
||||
* new global {Boolean} property has been added to indicate that it is
|
||||
* new global {boolean} property has been added to indicate that it is
|
||||
* a global variable.
|
||||
*/
|
||||
function annotateGlobals(globals) {
|
||||
@@ -169,10 +169,10 @@ define(function (require, exports, module) {
|
||||
* if string literals, annotate with an appropriate delimiter.
|
||||
*
|
||||
* @param {Array<Object>} literals - list of hint tokens
|
||||
* @param {String} kind - the kind of literals in the list (e.g., "string")
|
||||
* @param {string} kind - the kind of literals in the list (e.g., "string")
|
||||
* @return {Array<Object>} - the input array; to each object in the array a
|
||||
* new literal {Boolean} property has been added to indicate that it
|
||||
* is a literal hint, and also a new kind {String} property to indicate
|
||||
* new literal {boolean} property has been added to indicate that it
|
||||
* is a literal hint, and also a new kind {string} property to indicate
|
||||
* the literal kind. For string literals, a delimiter property is also
|
||||
* added to indicate what the default delimiter should be (viz. a
|
||||
* single or double quotation mark).
|
||||
@@ -197,7 +197,7 @@ define(function (require, exports, module) {
|
||||
*
|
||||
* @param {Array<Object>} keyword - list of keyword tokens
|
||||
* @return {Array<Object>} - the input array; to each object in the array a
|
||||
* new keyword {Boolean} property has been added to indicate that the
|
||||
* new keyword {boolean} property has been added to indicate that the
|
||||
* hint is a keyword.
|
||||
*/
|
||||
function annotateKeywords(keywords) {
|
||||
@@ -211,10 +211,10 @@ define(function (require, exports, module) {
|
||||
* Annotate a list of tokens with a path name
|
||||
*
|
||||
* @param {Array<Object>} tokens - list of hint tokens
|
||||
* @param {String} dir - directory with which to annotate the hints
|
||||
* @param {String} file - file name with which to annotate the hints
|
||||
* @param {string} dir - directory with which to annotate the hints
|
||||
* @param {string} file - file name with which to annotate the hints
|
||||
* @return {Array<Object>} - the input array; to each object in the array a
|
||||
* new path {String} property has been added, equal to dir + file.
|
||||
* new path {string} property has been added, equal to dir + file.
|
||||
*/
|
||||
function annotateWithPath(tokens, dir, file) {
|
||||
var path = dir + file;
|
||||
|
||||
@@ -476,8 +476,8 @@ define(function (require, exports, module) {
|
||||
/*
|
||||
* Is the symbol declared in this scope?
|
||||
*
|
||||
* @param {String} sym - a symbol name
|
||||
* @return {Boolean} - whether a symbol with that name is declared in this
|
||||
* @param {string} sym - a symbol name
|
||||
* @return {boolean} - whether a symbol with that name is declared in this
|
||||
* immediate scope
|
||||
*/
|
||||
Scope.prototype.member = function (sym) {
|
||||
@@ -487,8 +487,8 @@ define(function (require, exports, module) {
|
||||
/*
|
||||
* Is the symbol declared in this scope or a parent scope?
|
||||
*
|
||||
* @param {String} sym - a symbol name
|
||||
* @return {Boolean} - whether a symbol with that name is declared in this
|
||||
* @param {string} sym - a symbol name
|
||||
* @return {boolean} - whether a symbol with that name is declared in this
|
||||
* immediate scope or a parent scope
|
||||
*/
|
||||
Scope.prototype.contains = function (sym) {
|
||||
@@ -510,8 +510,8 @@ define(function (require, exports, module) {
|
||||
/*
|
||||
* Does this scope, or its children, contain the given position?
|
||||
*
|
||||
* @param {Number} pos - the position to test for inclusion in the scope
|
||||
* @return {Boolean} - is the position included in the scope?
|
||||
* @param {number} pos - the position to test for inclusion in the scope
|
||||
* @return {boolean} - is the position included in the scope?
|
||||
*/
|
||||
Scope.prototype.containsPosition = function (pos) {
|
||||
return this.range.start <= pos && pos <= this.range.end;
|
||||
@@ -520,8 +520,8 @@ define(function (require, exports, module) {
|
||||
/*
|
||||
* Does this scope, but not its children, contain the given position?
|
||||
*
|
||||
* @param {Number} pos - the position to test for inclusion in the scope
|
||||
* @return {Boolean} - is the position directly included in the scope?
|
||||
* @param {number} pos - the position to test for inclusion in the scope
|
||||
* @return {boolean} - is the position directly included in the scope?
|
||||
*/
|
||||
Scope.prototype.containsPositionImmediate = function (pos) {
|
||||
if (this.containsPosition(pos)) {
|
||||
@@ -542,7 +542,7 @@ define(function (require, exports, module) {
|
||||
/*
|
||||
* Find the child scope of the current scope for a given position
|
||||
*
|
||||
* @param {Number} pos - the position at which to find a child scope
|
||||
* @param {number} pos - the position at which to find a child scope
|
||||
* @return {?Scope} - the child scope for the given position, or null
|
||||
* if none exists
|
||||
*/
|
||||
@@ -586,7 +586,7 @@ define(function (require, exports, module) {
|
||||
*
|
||||
* @param {Function} addItem - the item accumulation function
|
||||
* @param {Object} init - an initial value for the accumulation function
|
||||
* @param {String} listName - the name of a Scope property
|
||||
* @param {string} listName - the name of a Scope property
|
||||
* @return {Object} - the result of of accumulating the given property for
|
||||
* the current scope along with all of its children
|
||||
*/
|
||||
|
||||
@@ -55,8 +55,8 @@ define(function (require, exports, module) {
|
||||
/**
|
||||
* Initialize state for a given directory and file name
|
||||
*
|
||||
* @param {String} dir - the directory name to initialize
|
||||
* @param {String} file - the file name to initialize
|
||||
* @param {string} dir - the directory name to initialize
|
||||
* @param {string} file - the file name to initialize
|
||||
*/
|
||||
function initFileState(dir, file) {
|
||||
// initialize outerScope, etc. at dir
|
||||
@@ -103,8 +103,8 @@ define(function (require, exports, module) {
|
||||
* instead of the whole path, a set of file states is returned, one for
|
||||
* each (known) file in the directory.
|
||||
*
|
||||
* @param {String} dir - the directory name for which state is desired
|
||||
* @param {String} file - the file name for which state is desired
|
||||
* @param {string} dir - the directory name for which state is desired
|
||||
* @param {string} file - the file name for which state is desired
|
||||
* @return {Object} - a file state object (as documented within
|
||||
* intializeFileState above), or a set of file state objects if
|
||||
* file is omitted.
|
||||
@@ -122,11 +122,11 @@ define(function (require, exports, module) {
|
||||
/**
|
||||
* Request a new outer scope object from the parser worker, if necessary
|
||||
*
|
||||
* @param {String} dir - the directory name for which the outer scope is to
|
||||
* @param {string} dir - the directory name for which the outer scope is to
|
||||
* be refreshed
|
||||
* @param {String} file - the file name for which the outer scope is to be
|
||||
* @param {string} file - the file name for which the outer scope is to be
|
||||
* refreshed
|
||||
* @param {String} text - the text of the file for which the outer scope is
|
||||
* @param {string} text - the text of the file for which the outer scope is
|
||||
* to be refreshed
|
||||
*/
|
||||
function refreshOuterScope(dir, file, text) {
|
||||
@@ -168,11 +168,11 @@ define(function (require, exports, module) {
|
||||
* information, resolved when a suitable global scope object becomes
|
||||
* available.
|
||||
*
|
||||
* @param {String} dir - the directory name for which the inner scope is to
|
||||
* @param {string} dir - the directory name for which the inner scope is to
|
||||
* be refreshed
|
||||
* @param {String} file - the file name for which the inner scope is to be
|
||||
* @param {string} file - the file name for which the inner scope is to be
|
||||
* refreshed
|
||||
* @param {Number} offset - offset into the text at which the inner scope
|
||||
* @param {number} offset - offset into the text at which the inner scope
|
||||
* is to be refreshed
|
||||
* @param {Object + jQuery.Promise} - inner scope information, or a promise
|
||||
* for such information, including the local scope object and lists of
|
||||
@@ -201,7 +201,7 @@ define(function (require, exports, module) {
|
||||
* operation
|
||||
*
|
||||
* @param {Object} sets - a set of sets
|
||||
* @param {String} propName - the property to pick out from each set
|
||||
* @param {string} propName - the property to pick out from each set
|
||||
* @param {Function} add - the function that combines properties from
|
||||
* each set
|
||||
* @return {Object}- the result of combining each set's property using
|
||||
@@ -228,7 +228,7 @@ define(function (require, exports, module) {
|
||||
* Combine properties from files in the current file's directory into
|
||||
* a single list.
|
||||
*
|
||||
* @param {String} dir - the directory name of the files for which
|
||||
* @param {string} dir - the directory name of the files for which
|
||||
* property lists should be merged
|
||||
* @param {Array<Object>} - the combined list of property tokens
|
||||
*/
|
||||
@@ -264,7 +264,7 @@ define(function (require, exports, module) {
|
||||
* Combine association set objects from all of the files in a given
|
||||
* directory
|
||||
*
|
||||
* @param {String} dir - the directory name of the files for which
|
||||
* @param {string} dir - the directory name of the files for which
|
||||
* association sets should be merged
|
||||
* @param {Object} - the combined association set object
|
||||
*/
|
||||
@@ -370,7 +370,7 @@ define(function (require, exports, module) {
|
||||
*
|
||||
* @param {Document} document - the document for which scope info is
|
||||
* desired
|
||||
* @param {Number} offset - the offset into the document at which scope
|
||||
* @param {number} offset - the offset into the document at which scope
|
||||
* info is desired
|
||||
* @param {Object + jQuery.Promise} - the inner scope info, or a promise
|
||||
* for such info. (See refreshInnerScope above.)
|
||||
@@ -390,7 +390,7 @@ define(function (require, exports, module) {
|
||||
*
|
||||
* @param {Document} document - the document for which the last requested
|
||||
* inner scope may or may not be dirty
|
||||
* @return {Boolean} - is the inner scope dirty?
|
||||
* @return {boolean} - is the inner scope dirty?
|
||||
*/
|
||||
function isScopeDirty(document) {
|
||||
var path = document.file.fullPath,
|
||||
@@ -406,8 +406,8 @@ define(function (require, exports, module) {
|
||||
* Mark a file as dirty, which may cause a later outer scope request to
|
||||
* trigger a reparse request.
|
||||
*
|
||||
* @param {String} dir - the directory name of the file to be marked dirty
|
||||
* @param {String} file - the file name of the file to be marked dirty
|
||||
* @param {string} dir - the directory name of the file to be marked dirty
|
||||
* @param {string} file - the file name of the file to be marked dirty
|
||||
*/
|
||||
function markFileDirty(dir, file) {
|
||||
var state = getFileState(dir, file);
|
||||
|
||||
@@ -33,6 +33,9 @@ define(function (require, exports, module) {
|
||||
/**
|
||||
* Session objects encapsulate state associated with a hinting session
|
||||
* and provide methods for updating and querying the session.
|
||||
*
|
||||
* @constructor
|
||||
* @param {Editor} editor - the editor context for the session
|
||||
*/
|
||||
function Session(editor) {
|
||||
this.editor = editor;
|
||||
@@ -41,6 +44,10 @@ define(function (require, exports, module) {
|
||||
|
||||
/**
|
||||
* Update the scope information assocated with the current session
|
||||
*
|
||||
* @param {Object} scopeInfo - scope information, including the scope and
|
||||
* lists of identifiers, globals, literals and properties, and a set
|
||||
* of associations
|
||||
*/
|
||||
Session.prototype.setScopeInfo = function (scopeInfo) {
|
||||
this.scope = scopeInfo.scope;
|
||||
@@ -53,6 +60,9 @@ define(function (require, exports, module) {
|
||||
|
||||
/**
|
||||
* Get the name of the file associated with the current session
|
||||
*
|
||||
* @return {string} - the full pathname of the file associated with the
|
||||
* current session
|
||||
*/
|
||||
Session.prototype.getPath = function () {
|
||||
return this.path;
|
||||
@@ -61,7 +71,7 @@ define(function (require, exports, module) {
|
||||
/**
|
||||
* Get the current cursor position.
|
||||
*
|
||||
* @return Object<line: number, ch, number>
|
||||
* @return Object<line: number, ch, number> - the current cursor position
|
||||
*/
|
||||
Session.prototype.getCursor = function () {
|
||||
return this.editor.getCursorPos();
|
||||
@@ -69,6 +79,9 @@ define(function (require, exports, module) {
|
||||
|
||||
/**
|
||||
* Get the offset of the current cursor position
|
||||
*
|
||||
* @return {number} - the offset into the current document of the current
|
||||
* cursor
|
||||
*/
|
||||
Session.prototype.getOffset = function () {
|
||||
var cursor = this.getCursor();
|
||||
@@ -79,6 +92,10 @@ define(function (require, exports, module) {
|
||||
/**
|
||||
* Get the token at the given cursor position, or at the current cursor
|
||||
* if none is given.
|
||||
*
|
||||
* @param {?Object<line: number, ch, number>} cursor - the cursor position
|
||||
* at which to retrieve a token
|
||||
* @param {Object} - the CodeMirror token at the given cursor position
|
||||
*/
|
||||
Session.prototype.getToken = function (cursor) {
|
||||
var cm = this.editor._codeMirror;
|
||||
@@ -92,6 +109,10 @@ define(function (require, exports, module) {
|
||||
|
||||
/**
|
||||
* Get the next cursor position on the line, or null if there isn't one.
|
||||
*
|
||||
* @return {?Object<line: number, ch, number>} - the cursor position
|
||||
* immediately following the current cursor position, or null if
|
||||
* none exists.
|
||||
*/
|
||||
Session.prototype.getNextCursorOnLine = function () {
|
||||
var cursor = this.getCursor(),
|
||||
@@ -109,7 +130,12 @@ define(function (require, exports, module) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the token before the one at the given cursor
|
||||
* Get the token before the one at the given cursor position
|
||||
*
|
||||
* @param {Object<line: number, ch, number>} cursor - cursor position after
|
||||
* which a token should be retrieved
|
||||
* @return {Object} - the CodeMirror token before the one at the given
|
||||
* cursor position
|
||||
*/
|
||||
Session.prototype._getPreviousToken = function (cursor) {
|
||||
var token = this.getToken(cursor),
|
||||
@@ -135,7 +161,10 @@ define(function (require, exports, module) {
|
||||
|
||||
/**
|
||||
* Calculate a query string relative to the current cursor position
|
||||
* and token.
|
||||
* and token. E.g., from a state "identi<cursor>er", the query string is
|
||||
* "identi".
|
||||
*
|
||||
* @return {string} - the query string for the current cursor position
|
||||
*/
|
||||
Session.prototype.getQuery = function () {
|
||||
var cursor = this.getCursor(),
|
||||
@@ -154,6 +183,11 @@ define(function (require, exports, module) {
|
||||
/**
|
||||
* Find the context of a property lookup. For example, for a lookup
|
||||
* foo(bar, baz(quux)).prop, foo is the context.
|
||||
*
|
||||
* @param {Object<line: number, ch, number>} cursor - the cursor position
|
||||
* at which context information is to be retrieved
|
||||
* @param {number} depth - the current depth of the parenthesis stack, or
|
||||
* undefined if the depth is 0.
|
||||
*/
|
||||
Session.prototype.getContext = function (cursor, depth) {
|
||||
var token = this.getToken(cursor);
|
||||
@@ -181,6 +215,13 @@ define(function (require, exports, module) {
|
||||
/**
|
||||
* Get the type of the current session, i.e., whether it is a property
|
||||
* lookup and, if so, what the context of the lookup is.
|
||||
*
|
||||
* @return {Object<property: boolean, context: string>} - a pair consisting
|
||||
* of a {boolean} "property" that indicates whether or not the type of
|
||||
* the session is a property lookup, and a {string} "context" that
|
||||
* indicates the object context (as described in getContext above) of
|
||||
* the property lookup, or null if there is none. The context is
|
||||
* always null for non-property lookups.
|
||||
*/
|
||||
Session.prototype.getType = function () {
|
||||
var propertyLookup = false,
|
||||
@@ -212,19 +253,34 @@ define(function (require, exports, module) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a list of hints for the current session using the current scope information.
|
||||
* Get a list of hints for the current session using the current scope
|
||||
* information.
|
||||
*
|
||||
* @return {Array<Object>} - the sorted list of hints for the current
|
||||
* session.
|
||||
*/
|
||||
Session.prototype.getHints = function () {
|
||||
|
||||
/*
|
||||
* Comparator for sorting tokens according to minimum distance from
|
||||
* a given position
|
||||
*
|
||||
* @param {number} pos - the position to which a token's occurrences
|
||||
* are compared
|
||||
* @param {Function} - the comparator function
|
||||
*/
|
||||
function compareByPosition(pos) {
|
||||
|
||||
/*
|
||||
* Compute the minimum distance between a token, with which is
|
||||
* associated a sorted list of positions, and a given offset.
|
||||
*
|
||||
* @param {number} pos - the position to which a token's occurrences
|
||||
* are compared.
|
||||
* @param {Object} token - a hint token, annotated with a list of
|
||||
* occurrence positions
|
||||
* @return number - the least distance of an occurrence of token to
|
||||
* pos, or Infinity if there are no occurrences
|
||||
*/
|
||||
function minDistToPos(pos, token) {
|
||||
var arr = token.positions,
|
||||
@@ -264,9 +320,14 @@ define(function (require, exports, module) {
|
||||
return function (a, b) {
|
||||
|
||||
/*
|
||||
* Lookup the cached minimum distance from an occurrence of the
|
||||
* token to the given position, calculating and storing it if
|
||||
* needed.
|
||||
* Look up the cached minimum distance from an occurrence of
|
||||
* the token to the given position, calculating and storing it
|
||||
* if needed.
|
||||
*
|
||||
* @param {Object} token - the token from which the minimum
|
||||
* distance to position pos is required
|
||||
* @return {number} - the least distance of an occurrence of
|
||||
* token to position pos
|
||||
*/
|
||||
function getDistToPos(token) {
|
||||
var dist;
|
||||
@@ -302,6 +363,11 @@ define(function (require, exports, module) {
|
||||
/*
|
||||
* Comparator for sorting tokens lexicographically according to scope,
|
||||
* assuming the scope level has already been annotated.
|
||||
*
|
||||
* @param {Object} a - a token
|
||||
* @param {Object} b - another token
|
||||
* @param {number} - comparator value that indicates whether a is more
|
||||
* tightly scoped than b
|
||||
*/
|
||||
function compareByScope(a, b) {
|
||||
var adepth = a.level;
|
||||
@@ -324,6 +390,11 @@ define(function (require, exports, module) {
|
||||
|
||||
/*
|
||||
* Comparator for sorting tokens by name
|
||||
*
|
||||
* @param {Object} a - a token
|
||||
* @param {Object} a - another token
|
||||
* @return {number} - comparator value that indicates whether the name
|
||||
* of token a is lexicographically lower than the name of token b
|
||||
*/
|
||||
function compareByName(a, b) {
|
||||
if (a.value === b.value) {
|
||||
@@ -336,8 +407,11 @@ define(function (require, exports, module) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Comparator for sorting tokens by path, such that
|
||||
* a <= b if a.path === path
|
||||
* Comparator for sorting tokens by path, such that a <= b if
|
||||
* a.path === path
|
||||
*
|
||||
* @param {string} path - the target path name
|
||||
* @return {Function} - the comparator function
|
||||
*/
|
||||
function compareByPath(path) {
|
||||
return function (a, b) {
|
||||
@@ -359,6 +433,9 @@ define(function (require, exports, module) {
|
||||
|
||||
/*
|
||||
* Comparator for sorting properties w.r.t. an association object.
|
||||
*
|
||||
* @param {Object} assoc - an association object
|
||||
* @return {Function} - the comparator function
|
||||
*/
|
||||
function compareByAssociation(assoc) {
|
||||
return function (a, b) {
|
||||
@@ -379,7 +456,13 @@ define(function (require, exports, module) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Forms the lexicographical composition of comparators
|
||||
* Forms the lexicographical composition of comparators, i.e.,
|
||||
* "a lex(c1,c2) b" iff "a c1 b or (a = b and a c2 b)"
|
||||
*
|
||||
* @param {Function} compare1 - a comparator
|
||||
* @param {Function} compare2 - another comparator
|
||||
* @return {Function} - the lexicographic composition of comparator1
|
||||
* and comparator2
|
||||
*/
|
||||
function lexicographic(compare1, compare2) {
|
||||
return function (a, b) {
|
||||
@@ -393,7 +476,12 @@ define(function (require, exports, module) {
|
||||
}
|
||||
|
||||
/*
|
||||
* A comparator for identifiers
|
||||
* A comparator for identifiers: the lexicographic combination of
|
||||
* scope, position and name.
|
||||
*
|
||||
* @param {number} pos - the target position by which identifiers are
|
||||
* compared
|
||||
* @return {Function} - the comparator function
|
||||
*/
|
||||
function compareIdentifiers(pos) {
|
||||
return lexicographic(compareByScope,
|
||||
@@ -402,7 +490,16 @@ define(function (require, exports, module) {
|
||||
}
|
||||
|
||||
/*
|
||||
* A comparator for properties
|
||||
* A comparator for properties: the lexicographic combination of
|
||||
* association, path name, position, and name.
|
||||
*
|
||||
* @param {Object} assoc - the association by which properties are
|
||||
* compared
|
||||
* @param {string} path - the path name by which properties are
|
||||
* compared
|
||||
* @param {number} pos - the target position by which properties are
|
||||
* compared
|
||||
* @return {Function} - the comparator function
|
||||
*/
|
||||
function compareProperties(assoc, path, pos) {
|
||||
return lexicographic(compareByAssociation(assoc),
|
||||
@@ -414,6 +511,10 @@ define(function (require, exports, module) {
|
||||
/*
|
||||
* Clone a list of hints. (Used so that later annotations are not
|
||||
* preserved when scope information changes.)
|
||||
*
|
||||
* @param {Array<Object>} hints - an array of hint tokens
|
||||
* @return {Array<Object>} - a new array of objects that are clones of
|
||||
* the objects in the input array
|
||||
*/
|
||||
function copyHints(hints) {
|
||||
function cloneToken(token) {
|
||||
|
||||
@@ -50,7 +50,7 @@ define(function (require, exports, module) {
|
||||
* object according to the CodeHintManager's API for code hint providers.
|
||||
*
|
||||
* @param {Array<Object>} hints - hints to be included in the response
|
||||
* @param {String} query - querystring with which to filter the hint list
|
||||
* @param {string} query - querystring with which to filter the hint list
|
||||
* @return {Object} - hint response as defined by the CodeHintManager API
|
||||
*/
|
||||
function getHintResponse(hints, query) {
|
||||
@@ -63,7 +63,7 @@ define(function (require, exports, module) {
|
||||
* Filter a list of tokens using the query string in the closure.
|
||||
*
|
||||
* @param {Array<Object>} tokens - list of hints to filter
|
||||
* @param {Number} limit - maximum numberof tokens to return
|
||||
* @param {number} limit - maximum numberof tokens to return
|
||||
* @return {Array<Object>} - filtered list of hints
|
||||
*/
|
||||
function filterWithQuery(tokens, limit) {
|
||||
@@ -75,7 +75,7 @@ define(function (require, exports, module) {
|
||||
* @param {Array} arr - array to filter
|
||||
* @param {Function} test - test to determine if an element should
|
||||
* be included in the results
|
||||
* @param {Number} limit - the maximum number of elements to return
|
||||
* @param {number} limit - the maximum number of elements to return
|
||||
*/
|
||||
function filterArrayPrefix(arr, test, limit) {
|
||||
var i = 0,
|
||||
@@ -124,7 +124,7 @@ define(function (require, exports, module) {
|
||||
* highlighted.
|
||||
*
|
||||
* @param {Array<Object>} hints - the list of hints to format
|
||||
* @param {String} query - querystring used for highlighting matched
|
||||
* @param {string} query - querystring used for highlighting matched
|
||||
* poritions of each hint
|
||||
* @param {Array<jQuery.Object>} - array of hints formatted as jQuery
|
||||
* objects
|
||||
@@ -219,8 +219,8 @@ define(function (require, exports, module) {
|
||||
* Determine whether hints are available for a given editor context
|
||||
*
|
||||
* @param {Editor} editor - the current editor context
|
||||
* @param {String} key - charCode of the last pressed key
|
||||
* @param {Boolean} - can the provider provide hints for this session?
|
||||
* @param {string} key - charCode of the last pressed key
|
||||
* @param {boolean} - can the provider provide hints for this session?
|
||||
*/
|
||||
JSHints.prototype.hasHints = function (editor, key) {
|
||||
if ((key === null) || HintUtils.maybeIdentifier(key)) {
|
||||
@@ -253,7 +253,7 @@ define(function (require, exports, module) {
|
||||
* Return a list of hints, possibly deferred, for the current editor
|
||||
* context
|
||||
*
|
||||
* @param {String} key - charCode of the last pressed key
|
||||
* @param {string} key - charCode of the last pressed key
|
||||
* @return {Object + jQuery.Deferred} - hint response (immediate or
|
||||
* deferred) as defined by the CodeHintManager API
|
||||
*/
|
||||
@@ -324,7 +324,7 @@ define(function (require, exports, module) {
|
||||
* Inserts the hint selected by the user into the current editor.
|
||||
*
|
||||
* @param {jQuery.Object} hint - hint object to insert into current editor
|
||||
* @return {Boolean} - should a new hinting session be requested
|
||||
* @return {boolean} - should a new hinting session be requested
|
||||
* immediately after insertion?
|
||||
*/
|
||||
JSHints.prototype.insertHint = function ($hintObj) {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* Loads a file that contains an AMD module definition using the web worker
|
||||
* importScripts global function.
|
||||
*
|
||||
* @param {String} url - the URL of the module to load
|
||||
* @param {string} url - the URL of the module to load
|
||||
* @return {Object} - the module imported from the aforementioned URL
|
||||
*/
|
||||
function require(url) {
|
||||
@@ -45,7 +45,7 @@ function require(url) {
|
||||
* function expects require, exports and module arguments; in the latter
|
||||
* case, the wrapper function expects only an exports arguments.
|
||||
*
|
||||
* @param {?Array<String>} bindings - an optional list of resources
|
||||
* @param {?Array<string>} bindings - an optional list of resources
|
||||
* required by the module
|
||||
* @param {Function} wrapper - the function that defines the module
|
||||
*/
|
||||
@@ -81,7 +81,7 @@ function require(url) {
|
||||
/**
|
||||
* Send a log message back from the worker to the main thread
|
||||
*
|
||||
* @param {String} msg - the log message
|
||||
* @param {string} msg - the log message
|
||||
*/
|
||||
function _log(msg) {
|
||||
self.postMessage({log: msg });
|
||||
@@ -92,7 +92,7 @@ function require(url) {
|
||||
* list of their positions in the file.
|
||||
*
|
||||
* @param {Function} walk - the function used to walk over an implicit scope
|
||||
* @param {String} keyProp - the property of the implicit scope to walk over
|
||||
* @param {string} keyProp - the property of the implicit scope to walk over
|
||||
* @param {Array<Object>} - a list of hint tokens for the implicit scope,
|
||||
* including the positions at which they occur.
|
||||
*/
|
||||
@@ -154,7 +154,7 @@ function require(url) {
|
||||
/**
|
||||
* Parse JSLint globals annotations from an array of JavaScript comments
|
||||
*
|
||||
* @param {Array<String>} comments - list of JavaScript comments
|
||||
* @param {Array<string>} comments - list of JavaScript comments
|
||||
* @return {Array<Object>} - a list of global hint objects as described by
|
||||
* JSLint annotations found in the comments.
|
||||
*/
|
||||
@@ -195,9 +195,9 @@ function require(url) {
|
||||
* Send the scope and associated parse information back to the caller.
|
||||
* Called by the parse function below.
|
||||
*
|
||||
* @param {String} dir - the directory name of the parsed file
|
||||
* @param {String} file - the file name of the parsed file
|
||||
* @param {Number} length - the length of the parsed file
|
||||
* @param {string} dir - the directory name of the parsed file
|
||||
* @param {string} file - the file name of the parsed file
|
||||
* @param {number} length - the length of the parsed file
|
||||
* @param {Object} parseObj - scope and token data from the parsed file
|
||||
*/
|
||||
function respond(dir, file, length, parseObj) {
|
||||
@@ -234,10 +234,10 @@ function require(url) {
|
||||
* called asynchronously; the respond function above is called with the
|
||||
* results of parsing.
|
||||
*
|
||||
* @param {String} dir - the directory name of the file to parse
|
||||
* @param {String} file - the file name of the file to parse
|
||||
* @param {String} text - the text of the file to parse
|
||||
* @param {Number} retries - the number of times an unparseable text should
|
||||
* @param {string} dir - the directory name of the file to parse
|
||||
* @param {string} file - the file name of the file to parse
|
||||
* @param {string} text - the text of the file to parse
|
||||
* @param {number} retries - the number of times an unparseable text should
|
||||
* be retried, after blanking whatever lines are causing the parsing
|
||||
* errors.
|
||||
*/
|
||||
|
||||
@@ -45,7 +45,7 @@ define(function (require, exports, module) {
|
||||
* will never be set as the currentDocument or added to the working set.
|
||||
*
|
||||
* @param {Document} doc - the document to be contained by the new Editor
|
||||
* @param {String} mode - the CodeMirror mode of the new Editor
|
||||
* @param {string} mode - the CodeMirror mode of the new Editor
|
||||
* @return {Editor} - the mock editor object
|
||||
*/
|
||||
function createMockEditor(doc, mode) {
|
||||
@@ -70,9 +70,9 @@ define(function (require, exports, module) {
|
||||
* return some
|
||||
*
|
||||
* @param {Object} provider - a CodeHintProvider object
|
||||
* @param {String} key - the charCode of a key press that triggers the
|
||||
* @param {string} key - the charCode of a key press that triggers the
|
||||
* CodeHint provider
|
||||
* @return {Boolean} - whether the provider has hints in the context of
|
||||
* @return {boolean} - whether the provider has hints in the context of
|
||||
* the test editor
|
||||
*/
|
||||
function expectHints(provider, key) {
|
||||
@@ -89,7 +89,7 @@ define(function (require, exports, module) {
|
||||
* return any
|
||||
*
|
||||
* @param {Object} provider - a CodeHintProvider object
|
||||
* @param {String} key - the charCode of a key press that triggers the
|
||||
* @param {string} key - the charCode of a key press that triggers the
|
||||
* CodeHint provider
|
||||
*/
|
||||
function expectNoHints(provider, key) {
|
||||
@@ -105,8 +105,8 @@ define(function (require, exports, module) {
|
||||
* Return the index at which hint occurs in hintList
|
||||
*
|
||||
* @param {Array<Object>} hintList - the list of hints
|
||||
* @param {String} hint - the hint to search for
|
||||
* @return {Number} - the index into hintList at which the hint occurs,
|
||||
* @param {string} hint - the hint to search for
|
||||
* @return {number} - the index into hintList at which the hint occurs,
|
||||
* or -1 if it does not
|
||||
*/
|
||||
function _indexOf(hintList, hint) {
|
||||
@@ -158,7 +158,7 @@ define(function (require, exports, module) {
|
||||
*
|
||||
* @param {Object + jQuery.Deferred} hintObj - a hint response object,
|
||||
* possibly deferred
|
||||
* @param {Array<String>} absentHints - a list of hints that should not
|
||||
* @param {Array<string>} absentHints - a list of hints that should not
|
||||
* be present in the hint response
|
||||
*/
|
||||
function hintsAbsent(hintObj, absentHints) {
|
||||
@@ -176,7 +176,7 @@ define(function (require, exports, module) {
|
||||
*
|
||||
* @param {Object + jQuery.Deferred} hintObj - a hint response object,
|
||||
* possibly deferred
|
||||
* @param {Array<String>} absentHints - a list of hints that should be
|
||||
* @param {Array<string>} absentHints - a list of hints that should be
|
||||
* present in the hint response
|
||||
*/
|
||||
function hintsPresent(hintObj, expectedHints) {
|
||||
@@ -194,7 +194,7 @@ define(function (require, exports, module) {
|
||||
*
|
||||
* @param {Object + jQuery.Deferred} hintObj - a hint response object,
|
||||
* possibly deferred
|
||||
* @param {Array<String>} absentHints - a list of hints that should be
|
||||
* @param {Array<string>} absentHints - a list of hints that should be
|
||||
* present in the given order in the hint response
|
||||
*/
|
||||
function hintsPresentOrdered(hintObj, expectedHints) {
|
||||
@@ -217,7 +217,7 @@ define(function (require, exports, module) {
|
||||
*
|
||||
* @param {Object + jQuery.Deferred} hintObj - a hint response object,
|
||||
* possibly deferred
|
||||
* @param {Array<String>} absentHints - a list of hints that should be
|
||||
* @param {Array<string>} absentHints - a list of hints that should be
|
||||
* present in the hint response, and no more.
|
||||
*/
|
||||
function hintsPresentExact(hintObj, expectedHints) {
|
||||
@@ -237,7 +237,7 @@ define(function (require, exports, module) {
|
||||
* @param {Object} provider - a CodeHint provider object
|
||||
* @param {Object} hintObj - a hint response object from that provider,
|
||||
* possibly deferred
|
||||
* @param {Number} index - the index into the hint list at which a hint
|
||||
* @param {number} index - the index into the hint list at which a hint
|
||||
* is to be selected
|
||||
*/
|
||||
function selectHint(provider, hintObj, index) {
|
||||
|
||||
Reference in new issue
Block a user