Skip to content

Commit e15abb4

Browse files
authored
fix: Fixed jsDoc annotations
Merge pull request #4879 from mkslanc/documentation-improvements
2 parents 66cf041 + 3638ebb commit e15abb4

15 files changed

+157
-194
lines changed

src/ace.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ exports.config = require("./config");
3030

3131
/**
3232
* Embeds the Ace editor into the DOM, at the element provided by `el`.
33-
* @param {String | DOMElement} el Either the id of an element, or the element itself
33+
* @param {String | Element} el Either the id of an element, or the element itself
3434
* @param {Object } options Options for the editor
3535
*
3636
**/

src/anchor.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
3636

3737
/**
3838
* Returns an object identifying the `row` and `column` position of the current anchor.
39-
* @returns {Object}
39+
* @returns {Ace.Point}
4040
**/
4141
this.getPosition = function() {
4242
return this.$clipPositionToDocument(this.row, this.column);
@@ -68,6 +68,10 @@ var Anchor = exports.Anchor = function(doc, row, column) {
6868
* - `value`: An object describing the new Anchor position
6969
*
7070
**/
71+
/**
72+
* Internal function called when `"change"` event fired.
73+
* @param {Ace.Delta} delta
74+
*/
7175
this.onChange = function(delta) {
7276
if (delta.start.row == delta.end.row && delta.start.row != this.row)
7377
return;
@@ -158,6 +162,12 @@ var Anchor = exports.Anchor = function(doc, row, column) {
158162
this.detach = function() {
159163
this.document.off("change", this.$onChange);
160164
};
165+
166+
/**
167+
* When called, the `"change"` event listener is appended.
168+
* @param {Document} doc The document to associate with
169+
*
170+
**/
161171
this.attach = function(doc) {
162172
this.document = doc || this.document;
163173
this.document.on("change", this.$onChange);
@@ -167,6 +177,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
167177
* Clips the anchor position to the specified row and column.
168178
* @param {Number} row The row index to clip the anchor to
169179
* @param {Number} column The column index to clip the anchor to
180+
* @returns {Ace.Point}
170181
*
171182
**/
172183
this.$clipPositionToDocument = function(row, column) {

src/autocomplete/popup.js

+10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ var $singleLineEditor = function(el) {
2525
return editor;
2626
};
2727

28+
/**
29+
* This object is used in some places where needed to show popups - like prompt; autocomplete etc.
30+
* @class
31+
*/
32+
33+
/**
34+
* Creates and renders single line editor in popup window. If `parentNode` param is isset, then attaching it to this element.
35+
* @param {Element} parentNode
36+
* @constructor
37+
*/
2838
var AcePopup = function(parentNode) {
2939
var el = dom.createElement("div");
3040
var popup = new $singleLineEditor(el);

src/background_tokenizer.js

+8-14
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
7474

7575
/**
7676
* Sets a new tokenizer for this object.
77-
*
7877
* @param {Tokenizer} tokenizer The new tokenizer to use
79-
*
8078
**/
8179
this.setTokenizer = function(tokenizer) {
8280
this.tokenizer = tokenizer;
@@ -109,7 +107,6 @@ var BackgroundTokenizer = function(tokenizer, editor) {
109107
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
110108
* @param {Number} firstRow The starting row region
111109
* @param {Number} lastRow The final row region
112-
*
113110
**/
114111
this.fireUpdateEvent = function(firstRow, lastRow) {
115112
var data = {
@@ -121,9 +118,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
121118

122119
/**
123120
* Starts tokenizing at the row indicated.
124-
*
125121
* @param {Number} startRow The row to start at
126-
*
127122
**/
128123
this.start = function(startRow) {
129124
this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
@@ -136,7 +131,10 @@ var BackgroundTokenizer = function(tokenizer, editor) {
136131
// pretty long delay to prevent the tokenizer from interfering with the user
137132
this.running = setTimeout(this.$worker, 700);
138133
};
139-
134+
135+
/**
136+
* Sets pretty long delay to prevent the tokenizer from interfering with the user
137+
*/
140138
this.scheduleStart = function() {
141139
if (!this.running)
142140
this.running = setTimeout(this.$worker, 700);
@@ -165,7 +163,6 @@ var BackgroundTokenizer = function(tokenizer, editor) {
165163

166164
/**
167165
* Stops tokenizing.
168-
*
169166
**/
170167
this.stop = function() {
171168
if (this.running)
@@ -174,21 +171,18 @@ var BackgroundTokenizer = function(tokenizer, editor) {
174171
};
175172

176173
/**
177-
* Gives list of tokens of the row. (tokens are cached)
178-
*
174+
* Gives list of [[Token]]'s of the row. (tokens are cached)
179175
* @param {Number} row The row to get tokens at
180-
*
181-
*
182-
*
176+
* @returns {Token[]}
183177
**/
184178
this.getTokens = function(row) {
185179
return this.lines[row] || this.$tokenizeRow(row);
186180
};
187181

188182
/**
189-
* [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
190-
*
183+
* Returns the state of tokenization at the end of a row.
191184
* @param {Number} row The row to get state at
185+
* @returns {string}
192186
**/
193187
this.getState = function(row) {
194188
if (this.currentLine == row)

src/bidihandler.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ var BidiHandler = function(session) {
226226

227227
/**
228228
* Returns offset of character at position defined by column.
229-
* @param {Number} the screen column position
229+
* @param {Number} col the screen column position
230230
*
231-
* @return {int} horizontal pixel offset of given screen column
231+
* @return {Number} horizontal pixel offset of given screen column
232232
**/
233233
this.getPosLeft = function(col) {
234234
col -= this.wrapIndent;
@@ -258,10 +258,10 @@ var BidiHandler = function(session) {
258258

259259
/**
260260
* Returns 'selections' - array of objects defining set of selection rectangles
261-
* @param {Number} the start column position
262-
* @param {Number} the end column position
261+
* @param {Number} startCol the start column position
262+
* @param {Number} endCol the end column position
263263
*
264-
* @return {Array of Objects} Each object contains 'left' and 'width' values defining selection rectangle.
264+
* @return {Object[]} Each object contains 'left' and 'width' values defining selection rectangle.
265265
**/
266266
this.getSelections = function(startCol, endCol) {
267267
var map = this.bidiMap, levels = map.bidiLevels, level, selections = [], offset = 0,
@@ -298,7 +298,7 @@ var BidiHandler = function(session) {
298298

299299
/**
300300
* Converts character coordinates on the screen to respective document column number
301-
* @param {int} character horizontal offset
301+
* @param {Number} posX character horizontal offset
302302
*
303303
* @return {Number} screen column number corresponding to given pixel offset
304304
**/

src/document.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var Anchor = require("./anchor").Anchor;
1616
/**
1717
*
1818
* Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
19-
* @param {String | Array} text The starting text
19+
* @param {String | String[]} textOrLines text The starting text
2020
* @constructor
2121
**/
2222

@@ -190,7 +190,7 @@ var Document = function(textOrLines) {
190190
* Returns all the text within `range` as an array of lines.
191191
* @param {Range} range The range to work with.
192192
*
193-
* @returns {Array}
193+
* @returns {string[]}
194194
**/
195195
this.getLinesForRange = function(range) {
196196
var lines;
@@ -322,7 +322,7 @@ var Document = function(textOrLines) {
322322
/**
323323
* Inserts the elements in `lines` into the document as full lines (does not merge with existing line), starting at the row index given by `row`. This method also triggers the `"change"` event.
324324
* @param {Number} row The index of the row to insert at
325-
* @param {Array} lines An array of strings
325+
* @param {string[]} lines An array of strings
326326
* @returns {Object} Contains the final row and column, like this:
327327
* ```
328328
* {row: endRow, column: 0}
@@ -358,7 +358,7 @@ var Document = function(textOrLines) {
358358
/**
359359
* Inserts the elements in `lines` into the document, starting at the position index given by `row`. This method also triggers the `"change"` event.
360360
* @param {Number} row The index of the row to insert at
361-
* @param {Array} lines An array of strings
361+
* @param {string[]} lines An array of strings
362362
* @returns {Object} Contains the final row and column, like this:
363363
* ```
364364
* {row: endRow, column: 0}
@@ -514,7 +514,7 @@ var Document = function(textOrLines) {
514514

515515
/**
516516
* Applies all changes in `deltas` to the document.
517-
* @param {Array} deltas An array of delta objects (can include "insert" and "remove" actions)
517+
* @param {Delta[]} deltas An array of delta objects (can include "insert" and "remove" actions)
518518
**/
519519
this.applyDeltas = function(deltas) {
520520
for (var i=0; i<deltas.length; i++) {
@@ -524,7 +524,7 @@ var Document = function(textOrLines) {
524524

525525
/**
526526
* Reverts all changes in `deltas` from the document.
527-
* @param {Array} deltas An array of delta objects (can include "insert" and "remove" actions)
527+
* @param {Delta[]} deltas An array of delta objects (can include "insert" and "remove" actions)
528528
**/
529529
this.revertDeltas = function(deltas) {
530530
for (var i=deltas.length-1; i>=0; i--) {

src/edit_session.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ var SearchHighlight = require("./search_highlight").SearchHighlight;
102102
//}
103103

104104
/**
105-
* Sets up a new `EditSession` and associates it with the given `Document` and `TextMode`.
105+
* Sets up a new `EditSession` and associates it with the given `Document` and `Mode`.
106106
* @param {Document | String} text [If `text` is a `Document`, it associates the `EditSession` with it. Otherwise, a new `Document` is created, with the initial text]{: #textParam}
107-
* @param {TextMode} mode [The initial language mode to use for the document]{: #modeParam}
107+
* @param {Mode} mode [The initial language mode to use for the document]{: #modeParam}
108108
*
109109
* @constructor
110110
**/
@@ -683,7 +683,7 @@ EditSession.$uid = 0;
683683
*/
684684
/**
685685
* Sets annotations for the `EditSession`. This functions emits the `'changeAnnotation'` event.
686-
* @param {Array} annotations A list of annotations
686+
* @param {Annotation[]} annotations A list of annotations
687687
*
688688
**/
689689
this.setAnnotations = function(annotations) {
@@ -693,7 +693,7 @@ EditSession.$uid = 0;
693693

694694
/**
695695
* Returns the annotations for the `EditSession`.
696-
* @returns {Array}
696+
* @returns {Annotation[]}
697697
**/
698698
this.getAnnotations = function() {
699699
return this.$annotations || [];
@@ -1113,7 +1113,7 @@ EditSession.$uid = 0;
11131113

11141114
/**
11151115
* Reverts previous changes to your document.
1116-
* @param {Array} deltas An array of previous changes
1116+
* @param {Delta[]} deltas An array of previous changes
11171117
* @param {Boolean} dontSelect [If `true`, doesn't select the range of where the change occured]{: #dontSelect}
11181118
*
11191119
* @returns {Range}
@@ -1142,7 +1142,7 @@ EditSession.$uid = 0;
11421142

11431143
/**
11441144
* Re-implements a previously undone change to your document.
1145-
* @param {Array} deltas An array of previous changes
1145+
* @param {Delta[]} deltas An array of previous changes
11461146
* @param {Boolean} dontSelect {:dontSelect}
11471147
*
11481148
* @returns {Range}
@@ -2077,7 +2077,7 @@ EditSession.$uid = 0;
20772077
* Converts characters coordinates on the screen to characters coordinates within the document. [This takes into account code folding, word wrap, tab size, and any other visual modifications.]{: #conversionConsiderations}
20782078
* @param {Number} screenRow The screen row to check
20792079
* @param {Number} screenColumn The screen column to check
2080-
* @param {int} screen character x-offset [optional]
2080+
* @param {Number} offsetX screen character x-offset [optional]
20812081
*
20822082
* @returns {Object} The object returned has two properties: `row` and `column`.
20832083
*

src/ext/menu_tools/overlay_page.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dom.importCssString(cssText, "settings_menu.css", false);
2222
* @author <a href="mailto:matthewkastor@gmail.com">
2323
* Matthew Christopher Kastor-Inare III </a><br />
2424
* ☭ Hial Atropa!! ☭
25-
* @param {DOMElement} contentElement Any element which may be presented inside
25+
* @param {Element} contentElement Any element which may be presented inside
2626
* a div.
2727
*/
2828

src/keyboard/vim.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4503,7 +4503,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
45034503
/**
45044504
* @param {CodeMirror} cm CodeMirror object.
45054505
* @param {Pos} cur The position to start from.
4506-
* @param {int} repeat Number of words to move past.
4506+
* @param {Number} repeat Number of words to move past.
45074507
* @param {boolean} forward True to search forward. False to search
45084508
* backward.
45094509
* @param {boolean} wordEnd True to move to end of word. False to move to

src/lib/bidiutil.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,10 @@ exports.hasBidiCharacters = function(text, textCharTypes){
364364
/**
365365
* Returns visual index corresponding to logical index basing on logicalFromvisual
366366
* map provided by Unicode Bidi algorithm.
367-
* @param {int} logical index of character in text buffer
368-
* @param {Object} object containing logicalFromVisual map
367+
* @param {Number} logIdx logical index of character in text buffer
368+
* @param {Object} rowMap object containing logicalFromVisual map
369369
*
370-
* @return {int} visual index (on display) corresponding to logical index
370+
* @return {Number} visual index (on display) corresponding to logical index
371371
**/
372372
exports.getVisualFromLogicalIdx = function(logIdx, rowMap) {
373373
for (var i = 0; i < rowMap.logicalFromVisual.length; i++) {

src/mode/folding/sqlserver.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ oop.inherits(FoldMode, BaseFoldMode);
4747
};
4848

4949
/**
50-
* @returns {range} folding block for sequence that starts with 'CASE' or 'BEGIN' and ends with 'END'
50+
* @returns {Range} folding block for sequence that starts with 'CASE' or 'BEGIN' and ends with 'END'
5151
* @param {string} matchSequence - the sequence of charaters that started the fold widget, which should remain visible when the fold widget is folded
5252
*/
5353
this.getBeginEndBlock = function(session, row, column, matchSequence) {

src/multi_select.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ var EditSession = require("./edit_session").EditSession;
157157

158158
/**
159159
* Returns a concatenation of all the ranges.
160-
* @returns {Array}
160+
* @returns {Range[]}
161161
* @method Selection.getAllRanges
162162
**/
163163
this.getAllRanges = function() {

0 commit comments

Comments
 (0)