Skip to content

Commit 21f638b

Browse files
devvaannshabose
authored andcommitted
feat: prepare all required files for API docs
1 parent 3844ae5 commit 21f638b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2133
-1885
lines changed

src/JSUtils/Preferences.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
*
2020
*/
2121

22+
// @INCLUDE_IN_API_DOCS
23+
2224
/**
2325
2426
This class parses configuration values from a JSON object. The expected

src/JSUtils/ScopeManager.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
*
2020
*/
2121

22+
// @INCLUDE_IN_API_DOCS
23+
2224
/*global Phoenix*/
2325

2426
/*

src/JSUtils/Session.js

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,22 @@
1919
*
2020
*/
2121

22+
// @INCLUDE_IN_API_DOCS
23+
24+
2225
/*jslint regexp: true */
2326

2427
define(function (require, exports, module) {
2528

2629

27-
var StringMatch = require("utils/StringMatch"),
28-
TokenUtils = require("utils/TokenUtils"),
30+
var StringMatch = require("utils/StringMatch"),
31+
TokenUtils = require("utils/TokenUtils"),
2932
LanguageManager = require("language/LanguageManager"),
30-
HTMLUtils = require("language/HTMLUtils"),
31-
HintUtils = require("JSUtils/HintUtils"),
32-
ScopeManager = require("JSUtils/ScopeManager"),
33-
Acorn = require("thirdparty/acorn/dist/acorn"),
34-
Acorn_Loose = require("thirdparty/acorn/dist/acorn_loose");
33+
HTMLUtils = require("language/HTMLUtils"),
34+
HintUtils = require("JSUtils/HintUtils"),
35+
ScopeManager = require("JSUtils/ScopeManager"),
36+
Acorn = require("thirdparty/acorn/dist/acorn"),
37+
Acorn_Loose = require("thirdparty/acorn/dist/acorn_loose");
3538

3639
/**
3740
* Session objects encapsulate state associated with a hinting session
@@ -159,8 +162,8 @@ define(function (require, exports, module) {
159162
* none exists.
160163
*/
161164
Session.prototype.getNextCursorOnLine = function (cursor) {
162-
var doc = this.editor.document,
163-
line = doc.getLine(cursor.line);
165+
var doc = this.editor.document,
166+
line = doc.getLine(cursor.line);
164167

165168
if (cursor.ch < line.length) {
166169
return {
@@ -181,9 +184,9 @@ define(function (require, exports, module) {
181184
* cursor position
182185
*/
183186
Session.prototype._getPreviousToken = function (cursor) {
184-
var token = this.getToken(cursor),
185-
prev = token,
186-
doc = this.editor.document;
187+
var token = this.getToken(cursor),
188+
prev = token,
189+
doc = this.editor.document;
187190

188191
do {
189192
if (prev.start < cursor.ch) {
@@ -212,9 +215,9 @@ define(function (require, exports, module) {
212215
* cursor position
213216
*/
214217
Session.prototype.getNextToken = function (cursor, skipWhitespace) {
215-
var token = this.getToken(cursor),
216-
next = token,
217-
doc = this.editor.document;
218+
var token = this.getToken(cursor),
219+
next = token,
220+
doc = this.editor.document;
218221

219222
do {
220223
if (next.end > cursor.ch) {
@@ -242,11 +245,11 @@ define(function (require, exports, module) {
242245
* @return {string} - the query string for the current cursor position
243246
*/
244247
Session.prototype.getQuery = function () {
245-
var cursor = this.getCursor(),
246-
token = this.getToken(cursor),
247-
query = "",
248-
start = cursor.ch,
249-
end = start;
248+
var cursor = this.getCursor(),
249+
token = this.getToken(cursor),
250+
query = "",
251+
start = cursor.ch,
252+
end = start;
250253

251254
if (token) {
252255
var line = this.getLine(cursor.line);
@@ -309,8 +312,8 @@ define(function (require, exports, module) {
309312
if (token && token.string === ".") {
310313
return cursor;
311314
}
312-
// If something has been typed like 'foo.b' then we have to look back 2 tokens
313-
// to get past the 'b' token
315+
// If something has been typed like 'foo.b' then we have to look back 2 tokens
316+
// to get past the 'b' token
314317
token = this._getPreviousToken(cursor);
315318
if (token && token.string === ".") {
316319
return cursor;
@@ -346,10 +349,10 @@ define(function (require, exports, module) {
346349
* is true, otherwise undefined.
347350
*/
348351
Session.prototype.getFunctionInfo = function () {
349-
var inFunctionCall = false,
350-
cursor = this.getCursor(),
352+
var inFunctionCall = false,
353+
cursor = this.getCursor(),
351354
functionCallPos,
352-
token = this.getToken(cursor),
355+
token = this.getToken(cursor),
353356
lexical,
354357
self = this,
355358
foundCall = false;
@@ -365,7 +368,7 @@ define(function (require, exports, module) {
365368
var type = token.type,
366369
nextToken,
367370
localLexical,
368-
localCursor = {line: cursor.line, ch: token.end};
371+
localCursor = { line: cursor.line, ch: token.end };
369372

370373
if (type === "variable-2" || type === "variable" || type === "property") {
371374
nextToken = self.getNextToken(localCursor, true);
@@ -435,7 +438,7 @@ define(function (require, exports, module) {
435438

436439
if (found) {
437440
inFunctionCall = true;
438-
functionCallPos = {line: line, ch: col};
441+
functionCallPos = { line: line, ch: col };
439442
}
440443
}
441444
}
@@ -459,10 +462,10 @@ define(function (require, exports, module) {
459462
* always null for non-property lookups.
460463
*/
461464
Session.prototype.getType = function () {
462-
var propertyLookup = false,
463-
context = null,
464-
cursor = this.getCursor(),
465-
token = this.getToken(cursor);
465+
var propertyLookup = false,
466+
context = null,
467+
cursor = this.getCursor(),
468+
token = this.getToken(cursor);
466469

467470
if (token) {
468471
if (token.type === "property") {
@@ -504,14 +507,14 @@ define(function (require, exports, module) {
504507
}
505508

506509
/**
507-
* Get a list of hints for the current session using the current scope
510+
* Retrieves a list of hints for the current session based on the current scope
508511
* information.
509512
*
510-
* @param {string} query - the query prefix
511-
* @param {StringMatcher} matcher - the class to find query matches and sort the results
512-
* @return {hints: Array.<string>, needGuesses: boolean} - array of
513-
* matching hints. If needGuesses is true, then the caller needs to
514-
* request guesses and call getHints again.
513+
* @param {string} query - The query prefix used to filter hints.
514+
* @param {StringMatcher} matcher - The class used to find query matches and sort the results.
515+
* @return {{hints: Array<string>, needGuesses: boolean}} An object containing:
516+
* - `hints`: An array of matching hints.
517+
* - `needGuesses`: A boolean indicating whether the caller needs to request guesses and call getHints again.
515518
*/
516519
Session.prototype.getHints = function (query, matcher) {
517520

@@ -520,9 +523,9 @@ define(function (require, exports, module) {
520523
}
521524

522525
var MAX_DISPLAYED_HINTS = 500,
523-
type = this.getType(),
524-
builtins = this._getBuiltins(),
525-
needGuesses = false,
526+
type = this.getType(),
527+
builtins = this._getBuiltins(),
528+
needGuesses = false,
526529
hints;
527530

528531
/**
@@ -573,7 +576,7 @@ define(function (require, exports, module) {
573576
}
574577

575578
if (!type.property && !type.showFunctionType && hint.origin &&
576-
isBuiltin(hint.origin)) {
579+
isBuiltin(hint.origin)) {
577580
searchResult.builtin = 1;
578581
} else {
579582
searchResult.builtin = 0;
@@ -599,20 +602,20 @@ define(function (require, exports, module) {
599602
}
600603
}
601604

602-
StringMatch.multiFieldSort(hints, [ "matchGoodness", penalizeUnderscoreValueCompare ]);
605+
StringMatch.multiFieldSort(hints, ["matchGoodness", penalizeUnderscoreValueCompare]);
603606
} else { // identifiers, literals, and keywords
604607
hints = this.ternHints || [];
605608
hints = hints.concat(HintUtils.LITERALS);
606609
hints = hints.concat(HintUtils.KEYWORDS);
607610
hints = filterWithQueryAndMatcher(hints, matcher);
608-
StringMatch.multiFieldSort(hints, [ "matchGoodness", "depth", "builtin", penalizeUnderscoreValueCompare ]);
611+
StringMatch.multiFieldSort(hints, ["matchGoodness", "depth", "builtin", penalizeUnderscoreValueCompare]);
609612
}
610613

611614
if (hints.length > MAX_DISPLAYED_HINTS) {
612615
hints = hints.slice(0, MAX_DISPLAYED_HINTS);
613616
}
614617

615-
return {hints: hints, needGuesses: needGuesses};
618+
return { hints: hints, needGuesses: needGuesses };
616619
};
617620

618621
Session.prototype.setTernHints = function (newHints) {
@@ -656,9 +659,9 @@ define(function (require, exports, module) {
656659
var fnHint = this.fnType,
657660
cursor = this.getCursor(),
658661
token = this.getToken(this.functionCallPos),
659-
start = {line: this.functionCallPos.line, ch: token.start},
662+
start = { line: this.functionCallPos.line, ch: token.start },
660663
fragment = this.editor.document.getRange(start,
661-
{line: this.functionCallPos.line + 10, ch: 0});
664+
{ line: this.functionCallPos.line + 10, ch: 0 });
662665

663666
var ast;
664667
try {
@@ -737,7 +740,7 @@ define(function (require, exports, module) {
737740
}
738741
}
739742

740-
return {parameters: fnHint, currentIndex: currentArg};
743+
return { parameters: fnHint, currentIndex: currentArg };
741744
};
742745

743746
/**
@@ -763,7 +766,7 @@ define(function (require, exports, module) {
763766
// Alternatively we could strip the non-javascript text, and modify the offset,
764767
// and/or cursor, but then we have to remember how to reverse the translation
765768
// to support jump-to-definition
766-
var htmlStart = {line: 0, ch: 0};
769+
var htmlStart = { line: 0, ch: 0 };
767770
scriptBlocks.forEach(function (scriptBlock) {
768771
var start = scriptBlock.start,
769772
end = scriptBlock.end;
@@ -778,7 +781,7 @@ define(function (require, exports, module) {
778781

779782
return text;
780783
}
781-
// Javascript file, just return the text
784+
// Javascript file, just return the text
782785
return this.editor.document.getText();
783786

784787
};

src/command/CommandManager.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
*
2020
*/
2121

22+
// @INCLUDE_IN_API_DOCS
23+
2224
/**
2325
* Manages global application commands that can be called from menu items, key bindings, or subparts
2426
* of the application.
@@ -40,14 +42,16 @@ define(function (require, exports, module) {
4042

4143
/**
4244
* Map of all registered global commands
43-
* @type {Object.<commandID: string, Command>}
45+
* @type {Object} CommandMap
46+
* @property {Object.<string, Command>} commands - A map of command IDs to Command objects.
4447
*/
4548
let _commands = {};
4649

4750
/**
4851
* Temporary copy of commands map for restoring after testing
4952
* TODO (issue #1039): implement separate require contexts for unit tests
50-
* @type {Object.<commandID: string, Command>}
53+
* @type {Object} CommandMap
54+
* @property {Object.<string, Command>} commands - A map of command IDs to Command objects.
5155
*/
5256
let _commandsOriginal = {};
5357

src/command/DefaultMenus.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
/*global Phoenix*/
2323

24+
// @INCLUDE_IN_API_DOCS
25+
2426
/**
2527
* Initializes the default brackets menu items.
2628
*/

0 commit comments

Comments
 (0)