Skip to content

Commit

Permalink
update jsDoc's to be more precise
Browse files Browse the repository at this point in the history
  • Loading branch information
mkslanc committed Aug 4, 2022
1 parent 624a1a2 commit 8aadb8c
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 160 deletions.
13 changes: 12 additions & 1 deletion lib/ace/anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {

/**
* Returns an object identifying the `row` and `column` position of the current anchor.
* @returns {Object}
* @returns {Ace.Point}
**/
this.getPosition = function() {
return this.$clipPositionToDocument(this.row, this.column);
Expand Down Expand Up @@ -99,6 +99,10 @@ var Anchor = exports.Anchor = function(doc, row, column) {
* - `value`: An object describing the new Anchor position
*
**/
/**
* Internal function called when `"change"` event fired.
* @param {Ace.Delta} delta
*/
this.onChange = function(delta) {
if (delta.start.row == delta.end.row && delta.start.row != this.row)
return;
Expand Down Expand Up @@ -189,6 +193,12 @@ var Anchor = exports.Anchor = function(doc, row, column) {
this.detach = function() {
this.document.off("change", this.$onChange);
};

/**
* When called, the `"change"` event listener is appended.
* @param {Document} doc The document to associate with
*
**/
this.attach = function(doc) {
this.document = doc || this.document;
this.document.on("change", this.$onChange);
Expand All @@ -198,6 +208,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
* Clips the anchor position to the specified row and column.
* @param {Number} row The row index to clip the anchor to
* @param {Number} column The column index to clip the anchor to
* @returns {Ace.Point}
*
**/
this.$clipPositionToDocument = function(row, column) {
Expand Down
12 changes: 11 additions & 1 deletion lib/ace/autocomplete/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,17 @@ var $singleLineEditor = function(el) {
return editor;
};

var AcePopup = function(parentNode) {
/**
* This object is used in some places where needed to show popups - like prompt; autocomplete etc.
* @class
*/

/**
* Creates and renders single line editor in popup window. If `parentNode` param is isset, then attaching it to this element.
* @param {Element} parentNode
* @constructor
*/
var AcePopup = function(parentNode) {
var el = dom.createElement("div");
var popup = new $singleLineEditor(el);

Expand Down
22 changes: 8 additions & 14 deletions lib/ace/background_tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {

/**
* Sets a new tokenizer for this object.
*
* @param {Tokenizer} tokenizer The new tokenizer to use
*
**/
this.setTokenizer = function(tokenizer) {
this.tokenizer = tokenizer;
Expand Down Expand Up @@ -140,7 +138,6 @@ var BackgroundTokenizer = function(tokenizer, editor) {
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
* @param {Number} firstRow The starting row region
* @param {Number} lastRow The final row region
*
**/
this.fireUpdateEvent = function(firstRow, lastRow) {
var data = {
Expand All @@ -152,9 +149,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {

/**
* Starts tokenizing at the row indicated.
*
* @param {Number} startRow The row to start at
*
**/
this.start = function(startRow) {
this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
Expand All @@ -167,7 +162,10 @@ var BackgroundTokenizer = function(tokenizer, editor) {
// pretty long delay to prevent the tokenizer from interfering with the user
this.running = setTimeout(this.$worker, 700);
};


/**
* Sets pretty long delay to prevent the tokenizer from interfering with the user
*/
this.scheduleStart = function() {
if (!this.running)
this.running = setTimeout(this.$worker, 700);
Expand Down Expand Up @@ -196,7 +194,6 @@ var BackgroundTokenizer = function(tokenizer, editor) {

/**
* Stops tokenizing.
*
**/
this.stop = function() {
if (this.running)
Expand All @@ -205,21 +202,18 @@ var BackgroundTokenizer = function(tokenizer, editor) {
};

/**
* Gives list of tokens of the row. (tokens are cached)
*
* Gives list of [[Token]]'s of the row. (tokens are cached)
* @param {Number} row The row to get tokens at
*
*
*
* @returns {Token[]}
**/
this.getTokens = function(row) {
return this.lines[row] || this.$tokenizeRow(row);
};

/**
* [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
*
* Returns the state of tokenization at the end of a row.
* @param {Number} row The row to get state at
* @returns {string}
**/
this.getState = function(row) {
if (this.currentLine == row)
Expand Down
Loading

0 comments on commit 8aadb8c

Please sign in to comment.