diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index c83654e177e..56a36d8505b 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -52,6 +52,7 @@ jobs: fi # - run: npm run lint - run: node_modules/.bin/tsc --noImplicitAny --strict --noUnusedLocals --noImplicitReturns --noUnusedParameters --noImplicitThis ace.d.ts + - run: npm run typecheck - uses: codecov/codecov-action@v3 with: token: d8edca4b-8e97-41e5-b54e-34c7cf3b2d47 diff --git a/Makefile.dryice.js b/Makefile.dryice.js index a745e15fe76..734423fc83f 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -179,7 +179,7 @@ function buildTypes() { var aceCodeExtensionDefinitions = '/// '; // ace-builds package has different structure and can't use mode types defined for the ace-code. // ace-builds modes are declared along with other modules in the ace-modules.d.ts file below. - var definitions = fs.readFileSync(ACE_HOME + '/ace-internal.d.ts', 'utf8').replace(aceCodeModeDefinitions, '').replace(aceCodeExtensionDefinitions, ''); + var definitions = fs.readFileSync(ACE_HOME + '/ace.d.ts', 'utf8').replace(aceCodeModeDefinitions, '').replace(aceCodeExtensionDefinitions, ''); var paths = fs.readdirSync(BUILD_DIR + '/src-noconflict'); var moduleRef = '/// '; diff --git a/package.json b/package.json index e5d7df8a7fa..d5e9b724bc7 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "cover": "istanbul cover src/test/all.js", "lint": "eslint \"src/**/*.js\"", "fix": "eslint --fix \"src/**/*.js\"", + "typecheck": "tsc -p tsconfig.json", "changelog": "standard-version", "prepack": "node tool/esm_resolver_generator.js && node Makefile.dryice.js css --target build-styles && rm -rf styles && mv build-styles/css styles" }, diff --git a/src/ace.js b/src/ace.js index 21f67f98ea7..86ea484a156 100644 --- a/src/ace.js +++ b/src/ace.js @@ -9,8 +9,8 @@ var dom = require("./lib/dom"); var Range = require("./range").Range; -var EditSession = require("./edit_session").EditSession; var Editor = require("./editor").Editor; +var EditSession = require("./edit_session").EditSession; var UndoManager = require("./undomanager").UndoManager; var Renderer = require("./virtual_renderer").VirtualRenderer; @@ -86,5 +86,4 @@ exports.Editor = Editor; exports.EditSession = EditSession; exports.UndoManager = UndoManager; exports.VirtualRenderer = Renderer; -let version= exports.config.version; -exports.version = version; +exports.version = exports.config.version; diff --git a/src/autocomplete.js b/src/autocomplete.js index 6a28491faca..01d2762c8b7 100644 --- a/src/autocomplete.js +++ b/src/autocomplete.js @@ -1,6 +1,8 @@ "use strict"; /** * @typedef {import("./editor").Editor} Editor + * @typedef {import("../ace-internal").Ace.CompletionProviderOptions} CompletionProviderOptions + * @typedef {import("../ace-internal").Ace.CompletionOptions} CompletionOptions */ var HashHandler = require("./keyboard/hash_handler").HashHandler; var AcePopup = require("./autocomplete/popup").AcePopup; @@ -450,7 +452,7 @@ class Autocomplete { /** * This is the entry point for the autocompletion class, triggers the actions which collect and display suggestions * @param {Editor} editor - * @param {import("../ace-internal").Ace.CompletionOptions} options + * @param {CompletionOptions} options */ showPopup(editor, options) { if (this.editor) @@ -490,7 +492,7 @@ class Autocomplete { /** * @param {boolean} keepPopupPosition - * @param {import("../ace-internal").Ace.CompletionOptions} options + * @param {CompletionOptions} options */ updateCompletions(keepPopupPosition, options) { if (keepPopupPosition && this.base && this.completions) { @@ -783,7 +785,7 @@ class CompletionProvider { /** * @param {Editor} editor * @param {number} index - * @param {import("../ace-internal").Ace.CompletionProviderOptions} [options] + * @param {CompletionProviderOptions} [options] * @returns {boolean} */ insertByIndex(editor, index, options) { @@ -796,7 +798,7 @@ class CompletionProvider { /** * @param {Editor} editor * @param {Completion} data - * @param {import("../ace-internal").Ace.CompletionProviderOptions} [options] + * @param {CompletionProviderOptions} [options] * @returns {boolean} */ insertMatch(editor, data, options) { @@ -898,7 +900,7 @@ class CompletionProvider { * This is the entry point to the class, it gathers, then provides the completions asynchronously via callback. * The callback function may be called multiple times, the last invokation is marked with a `finished` flag * @param {Editor} editor - * @param {import("../ace-internal").Ace.CompletionProviderOptions} options + * @param {CompletionProviderOptions} options * @param {(err: Error | undefined, completions: FilteredList | [], finished: boolean) => void} callback */ provideCompletions(editor, options, callback) { diff --git a/src/autocomplete/popup.js b/src/autocomplete/popup.js index 079988ee2fd..fb4abbe8f31 100644 --- a/src/autocomplete/popup.js +++ b/src/autocomplete/popup.js @@ -17,7 +17,7 @@ var getAriaId = function (index) { * @param {HTMLElement} [el] * @return {Editor} */ -var $singleLineEditor = function (el) { +var $singleLineEditor = function(el) { var renderer = new Renderer(el); renderer.$maxLines = 4; @@ -64,8 +64,7 @@ class AcePopup { popup.setOption("displayIndentGuides", false); popup.setOption("dragDelay", 150); - var noop = function () { - }; + var noop = function(){}; popup.focus = noop; popup.$isFocused = true; @@ -82,7 +81,7 @@ class AcePopup { popup.session.highlight(""); popup.session.$searchHighlight.clazz = "ace_highlight-marker"; - popup.on("mousedown", function (e) { + popup.on("mousedown", function(e) { var pos = e.getDocumentPosition(); popup.selection.moveToPosition(pos); selectionMarker.start.row = selectionMarker.end.row = pos.row; @@ -96,14 +95,13 @@ class AcePopup { popup.setSelectOnHover = function (val) { if (!val) { hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine"); - } - else if (hoverMarker.id) { + } else if (hoverMarker.id) { popup.session.removeMarker(hoverMarker.id); hoverMarker.id = null; } }; popup.setSelectOnHover(false); - popup.on("mousemove", function (e) { + popup.on("mousemove", function(e) { if (!lastMouseEvent) { lastMouseEvent = e; return; @@ -116,15 +114,17 @@ class AcePopup { popup.isMouseOver = true; var row = lastMouseEvent.getDocumentPosition().row; if (hoverMarker.start.row != row) { - if (!hoverMarker.id) popup.setRow(row); + if (!hoverMarker.id) + popup.setRow(row); setHoverMarker(row); } }); - popup.renderer.on("beforeRender", function () { + popup.renderer.on("beforeRender", function() { if (lastMouseEvent && hoverMarker.start.row != -1) { lastMouseEvent.$pos = null; var row = lastMouseEvent.getDocumentPosition().row; - if (!hoverMarker.id) popup.setRow(row); + if (!hoverMarker.id) + popup.setRow(row); setHoverMarker(row, true); } }); @@ -156,17 +156,16 @@ class AcePopup { selected.setAttribute("aria-selected", "true"); } }); - var hideHoverMarker = function () { - setHoverMarker(-1); - }; - var setHoverMarker = function (row, suppressRedraw) { + var hideHoverMarker = function() { setHoverMarker(-1); }; + var setHoverMarker = function(row, suppressRedraw) { if (row !== hoverMarker.start.row) { hoverMarker.start.row = hoverMarker.end.row = row; - if (!suppressRedraw) popup.session._emit("changeBackMarker"); + if (!suppressRedraw) + popup.session._emit("changeBackMarker"); popup._emit("changeHoverMarker"); } }; - popup.getHoveredRow = function () { + popup.getHoveredRow = function() { return hoverMarker.start.row; }; @@ -177,22 +176,25 @@ class AcePopup { popup.on("hide", hideHoverMarker); popup.on("changeSelection", hideHoverMarker); - popup.session.doc.getLength = function () { + popup.session.doc.getLength = function() { return popup.data.length; }; - popup.session.doc.getLine = function (i) { + popup.session.doc.getLine = function(i) { var data = popup.data[i]; - if (typeof data == "string") return data; + if (typeof data == "string") + return data; return (data && data.value) || ""; }; var bgTokenizer = popup.session.bgTokenizer; - bgTokenizer.$tokenizeRow = function (row) { + bgTokenizer.$tokenizeRow = function(row) { /**@type {import("../../ace-internal").Ace.Completion &{name?, className?, matchMask?, message?}}*/ var data = popup.data[row]; var tokens = []; - if (!data) return tokens; - if (typeof data == "string") data = {value: data}; + if (!data) + return tokens; + if (typeof data == "string") + data = {value: data}; var caption = data.caption || data.value || data.name; function addToken(value, className) { @@ -219,25 +221,18 @@ class AcePopup { } addToken(caption.slice(lastIndex, caption.length), ""); - tokens.push({ - type: "completion-spacer", - value: " " - }); - if (data.meta) tokens.push({ - type: "completion-meta", - value: data.meta - }); - if (data.message) tokens.push({ - type: "completion-message", - value: data.message - }); + tokens.push({type: "completion-spacer", value: " "}); + if (data.meta) + tokens.push({type: "completion-meta", value: data.meta}); + if (data.message) + tokens.push({type: "completion-message", value: data.message}); return tokens; }; bgTokenizer.$updateOnChange = noop; bgTokenizer.start = noop; - popup.session.$computeWidth = function () { + popup.session.$computeWidth = function() { return this.screenWidth = 0; }; @@ -249,36 +244,38 @@ class AcePopup { popup.isMouseOver = false; popup.data = []; - popup.setData = function (list, filterText) { + popup.setData = function(list, filterText) { popup.filterText = filterText || ""; popup.setValue(lang.stringRepeat("\n", list.length), -1); popup.data = list || []; popup.setRow(0); }; - popup.getData = function (row) { + popup.getData = function(row) { return popup.data[row]; }; - popup.getRow = function () { + popup.getRow = function() { return selectionMarker.start.row; }; - popup.setRow = function (line) { + popup.setRow = function(line) { line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length - 1, line)); if (selectionMarker.start.row != line) { popup.selection.clearSelection(); selectionMarker.start.row = selectionMarker.end.row = line || 0; popup.session._emit("changeBackMarker"); popup.moveCursorTo(line || 0, 0); - if (popup.isOpen) popup._signal("select"); + if (popup.isOpen) + popup._signal("select"); } }; - popup.on("changeSelection", function () { - if (popup.isOpen) popup.setRow(popup.selection.lead.row); + popup.on("changeSelection", function() { + if (popup.isOpen) + popup.setRow(popup.selection.lead.row); popup.renderer.scrollCursorIntoView(); }); - popup.hide = function () { + popup.hide = function() { this.container.style.display = "none"; popup.anchorPos = null; popup.anchor = null; @@ -293,15 +290,17 @@ class AcePopup { * If the anchor is not specified it tries to align to bottom and right as much as possible. * If the popup does not have enough space to be rendered with the given anchors, it returns false without rendering the popup. * The forceShow flag can be used to render the popup in these cases, which slides the popup so it entirely fits on the screen. - * @param {any} pos + * @param {{top: number, left: number}} pos * @param {number} lineHeight * @param {"top" | "bottom" | undefined} anchor * @param {boolean} forceShow * @returns {boolean} */ - popup.tryShow = function (pos, lineHeight, anchor, forceShow) { - if (!forceShow && popup.isOpen && popup.anchorPos && popup.anchor && popup.anchorPos.top === pos.top - && popup.anchorPos.left === pos.left && popup.anchor === anchor) { + popup.tryShow = function(pos, lineHeight, anchor, forceShow) { + if (!forceShow && popup.isOpen && popup.anchorPos && popup.anchor && + popup.anchorPos.top === pos.top && popup.anchorPos.left === pos.left && + popup.anchor === anchor + ) { return true; } @@ -311,19 +310,14 @@ class AcePopup { var renderer = this.renderer; // var maxLines = Math.min(renderer.$maxLines, this.session.getLength()); var maxH = renderer.$maxLines * lineHeight * 1.4; - var dims = { - top: 0, - bottom: 0, - left: 0 - }; + var dims = { top: 0, bottom: 0, left: 0 }; var spaceBelow = screenHeight - pos.top - 3 * this.$borderSize - lineHeight; var spaceAbove = pos.top - 3 * this.$borderSize; if (!anchor) { if (spaceAbove <= spaceBelow || spaceBelow >= maxH) { anchor = "bottom"; - } - else { + } else { anchor = "top"; } } @@ -331,8 +325,7 @@ class AcePopup { if (anchor === "top") { dims.bottom = pos.top - this.$borderSize; dims.top = dims.bottom - maxH; - } - else if (anchor === "bottom") { + } else if (anchor === "bottom") { dims.top = pos.top + lineHeight + this.$borderSize; dims.bottom = dims.top + maxH; } @@ -346,12 +339,10 @@ class AcePopup { if (!fitsX) { if (anchor === "top") { renderer.$maxPixelHeight = spaceAbove; - } - else { + } else { renderer.$maxPixelHeight = spaceBelow; } - } - else { + } else { renderer.$maxPixelHeight = null; } @@ -360,8 +351,7 @@ class AcePopup { el.style.top = ""; el.style.bottom = (screenHeight - dims.bottom) + "px"; popup.isTopdown = false; - } - else { + } else { el.style.top = dims.top + "px"; el.style.bottom = ""; popup.isTopdown = true; @@ -370,7 +360,8 @@ class AcePopup { el.style.display = ""; var left = pos.left; - if (left + el.offsetWidth > screenWidth) left = screenWidth - el.offsetWidth; + if (left + el.offsetWidth > screenWidth) + left = screenWidth - el.offsetWidth; el.style.left = left + "px"; el.style.right = ""; @@ -387,34 +378,26 @@ class AcePopup { return true; }; - popup.show = function (pos, lineHeight, topdownOnly) { + popup.show = function(pos, lineHeight, topdownOnly) { this.tryShow(pos, lineHeight, topdownOnly ? "bottom" : undefined, true); }; - popup.goTo = function (where) { + popup.goTo = function(where) { var row = this.getRow(); var max = this.session.getLength() - 1; - switch (where) { - case "up": - row = row <= 0 ? max : row - 1; - break; - case "down": - row = row >= max ? -1 : row + 1; - break; - case "start": - row = 0; - break; - case "end": - row = max; - break; + switch(where) { + case "up": row = row <= 0 ? max : row - 1; break; + case "down": row = row >= max ? -1 : row + 1; break; + case "start": row = 0; break; + case "end": row = max; break; } this.setRow(row); }; - popup.getTextLeftOffset = function () { + popup.getTextLeftOffset = function() { return this.$borderSize + this.renderer.$padding + this.$imageSize; }; diff --git a/src/background_tokenizer.js b/src/background_tokenizer.js index 016b344187f..f52649caea8 100644 --- a/src/background_tokenizer.js +++ b/src/background_tokenizer.js @@ -1,11 +1,7 @@ "use strict"; /** * @typedef {import("./document").Document} Document - */ -/** - * @typedef {import("./editor").Editor} Editor - */ -/** + * @typedef {import("./edit_session").EditSession} EditSession * @typedef {import("./tokenizer").Tokenizer} Tokenizer */ var oop = require("./lib/oop"); @@ -21,9 +17,9 @@ class BackgroundTokenizer { /** * Creates a new `BackgroundTokenizer` object. * @param {Tokenizer} tokenizer The tokenizer to use - * @param {any} [editor] The editor to associate with + * @param {EditSession} [session] The editor session to associate with **/ - constructor(tokenizer, editor) { + constructor(tokenizer, session) { /**@type {false|number}*/ this.running = false; this.lines = []; diff --git a/src/clipboard.js b/src/clipboard.js index ff4ace683c9..73bb845a680 100644 --- a/src/clipboard.js +++ b/src/clipboard.js @@ -2,7 +2,8 @@ var $cancelT; module.exports = { - /** @type {string|false} */lineMode: false, + /** @type {string|false} */ + lineMode: false, pasteCancelled: function() { if ($cancelT && $cancelT > Date.now() - 50) return true; diff --git a/src/commands/incremental_search_commands.js b/src/commands/incremental_search_commands.js index cc73714a3b7..6c992f98fac 100644 --- a/src/commands/incremental_search_commands.js +++ b/src/commands/incremental_search_commands.js @@ -170,7 +170,6 @@ oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); var handleKeyboard$super = this.handleKeyboard; /** - * * @param data * @param hashId * @param key diff --git a/src/config.js b/src/config.js index ab7e9173004..62092e7200c 100644 --- a/src/config.js +++ b/src/config.js @@ -111,32 +111,33 @@ exports.dynamicModules = Object.create(null); exports.$loading = {}; exports.$loaded = {}; /** - * @param {string | [string, string]} moduleName + * @param {string | [string, string]} moduleId * @param {(module: any) => void} onLoad */ -exports.loadModule = function(moduleName, onLoad) { - var loadedModule, moduleType; +exports.loadModule = function(moduleId, onLoad) { + var loadedModule; if (Array.isArray(moduleName)) { - moduleType = moduleName[0]; - moduleName = moduleName[1]; + var moduleType = moduleId[0]; + var moduleName = moduleId[1]; + } else if (typeof moduleId == "string") { + var moduleName = moduleId; } - var load = function (module) { // require(moduleName) can return empty object if called after require([moduleName], callback) - if (module && !exports.$loading[/**@type {string}*/(moduleName)]) return onLoad && onLoad(module); + if (module && !exports.$loading[moduleName]) return onLoad && onLoad(module); - if (!exports.$loading[/**@type {string}*/(moduleName)]) exports.$loading[/**@type {string}*/(moduleName)] = []; + if (!exports.$loading[moduleName]) exports.$loading[moduleName] = []; - exports.$loading[/**@type {string}*/(moduleName)].push(onLoad); + exports.$loading[moduleName].push(onLoad); - if (exports.$loading[/**@type {string}*/(moduleName)].length > 1) return; + if (exports.$loading[moduleName].length > 1) return; var afterLoad = function() { loader(moduleName, function(err, module) { - if (module) exports.$loaded[/**@type {string}*/(moduleName)] = module; + if (module) exports.$loaded[moduleName] = module; exports._emit("load.module", {name: moduleName, module: module}); - var listeners = exports.$loading[/**@type {string}*/(moduleName)]; - exports.$loading[/**@type {string}*/(moduleName)] = null; + var listeners = exports.$loading[moduleName]; + exports.$loading[moduleName] = null; listeners.forEach(function(onLoad) { onLoad && onLoad(module); }); @@ -145,7 +146,7 @@ exports.loadModule = function(moduleName, onLoad) { if (!exports.get("packaged")) return afterLoad(); - net.loadScript(exports.moduleUrl(/**@type {string}*/(moduleName), moduleType), afterLoad); + net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad); reportErrorIfPathIsNotConfigured(); }; diff --git a/src/document.js b/src/document.js index 56571e3d45a..0d8d243f107 100644 --- a/src/document.js +++ b/src/document.js @@ -1,4 +1,11 @@ "use strict"; + +/** + * @typedef {import("../ace-internal").Ace.Delta} Delta + * @typedef {import("../ace-internal").Ace.Point} Point + * @typedef {import("../ace-internal").Ace.IRange} IRange + * @typedef {import("../ace-internal").Ace.NewLineMode} NewLineMode + */ var oop = require("./lib/oop"); var applyDelta = require("./apply_delta").applyDelta; var EventEmitter = require("./lib/event_emitter").EventEmitter; @@ -34,7 +41,6 @@ class Document { * Replaces all the lines in the current `Document` with the value of `text`. * * @param {String} text The text to use - **/ setValue(text) { var len = this.getLength() - 1; @@ -62,7 +68,6 @@ class Document { /** * @param {string} text - */ $detectNewLine(text) { var match = text.match(/^.*?(\r\n|\r|\n)/m); @@ -90,7 +95,7 @@ class Document { /** * [Sets the new line mode.]{: #Document.setNewLineMode.desc} - * @param {import("../ace-internal").Ace.NewLineMode} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param} + * @param {NewLineMode} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param} **/ setNewLineMode(newLineMode) { @@ -103,7 +108,7 @@ class Document { /** * [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode} - * @returns {import("../ace-internal").Ace.NewLineMode} + * @returns {NewLineMode} **/ getNewLineMode() { return this.$newLineMode; @@ -155,7 +160,7 @@ class Document { /** * Returns all the text within `range` as a single string. - * @param {import("../ace-internal").Ace.IRange} range The range to work with. + * @param {IRange} range The range to work with. * * @returns {String} **/ @@ -165,7 +170,7 @@ class Document { /** * Returns all the text within `range` as an array of lines. - * @param {import("../ace-internal").Ace.IRange} range The range to work with. + * @param {IRange} range The range to work with. * * @returns {string[]} **/ @@ -198,7 +203,6 @@ class Document { } /** - * * @param firstRow * @param lastRow * @returns {String[]} @@ -212,7 +216,7 @@ class Document { /** * @param position - * @returns {import("../ace-internal").Ace.Point} + * @returns {Point} * @deprecated */ @@ -223,9 +227,9 @@ class Document { /** * Inserts a block of `text` at the indicated `position`. - * @param {import("../ace-internal").Ace.Point} position The position to start inserting at; it's an object that looks like `{ row: row, column: column}` + * @param {Point} position The position to start inserting at; it's an object that looks like `{ row: row, column: column}` * @param {String} text A chunk of text to insert - * @returns {import("../ace-internal").Ace.Point} The position ({row, column}) of the last line of `text`. If the length of `text` is 0, this function simply returns `position`. + * @returns {Point} The position ({row, column}) of the last line of `text`. If the length of `text` is 0, this function simply returns `position`. **/ insert(position, text) { @@ -243,13 +247,9 @@ class Document { * 1. This does NOT handle newline characters (single-line text only). * 2. This is faster than the `insert` method for single-line text insertions. * - * @param {import("../ace-internal").Ace.Point} position The position to insert at; it's an object that looks like `{ row: row, column: column}` - * @param {String} text A chunk of text - * @returns {import("../ace-internal").Ace.Point} Returns an object containing the final row and column, like this: - * ``` - * {row: endRow, column: 0} - * ``` - + * @param {Point} position The position to insert at; it's an object that looks like `{ row: row, column: column}` + * @param {String} text A chunk of text without new lines + * @returns {Point} Returns the position of the end of the inserted text **/ insertInLine(position, text) { var start = this.clippedPos(position.row, position.column); @@ -269,7 +269,7 @@ class Document { * * @param {number} row * @param {number} column - * @return {import("../ace-internal").Ace.Point} + * @return {Point} */ clippedPos(row, column) { var length = this.getLength(); @@ -289,8 +289,8 @@ class Document { } /** - * @param {import("../ace-internal").Ace.Point} pos - * @return {import("../ace-internal").Ace.Point} + * @param {Point} pos + * @return {Point} */ clonePos(pos) { return {row: pos.row, column: pos.column}; @@ -299,15 +299,15 @@ class Document { /** * @param {number} row * @param {number} column - * @return {import("../ace-internal").Ace.Point} + * @return {Point} */ pos(row, column) { return {row: row, column: column}; } /** - * @param {import("../ace-internal").Ace.Point} position - * @return {import("../ace-internal").Ace.Point} + * @param {Point} position + * @return {Point} * @private */ $clipPosition(position) { @@ -352,9 +352,9 @@ class Document { /** * Inserts the elements in `lines` into the document, starting at the position index given by `row`. This method also triggers the `"change"` event. - * @param {import("../ace-internal").Ace.Position} position + * @param {Point} position * @param {string[]} lines An array of strings - * @returns {import("../ace-internal").Ace.Point} Contains the final row and column, like this: + * @returns {Point} Contains the final row and column, like this: * ``` * {row: endRow, column: 0} * ``` @@ -362,7 +362,6 @@ class Document { * ``` * {row: row, column: 0} * ``` - **/ insertMergedLines(position, lines) { var start = this.clippedPos(position.row, position.column); @@ -383,8 +382,8 @@ class Document { /** * Removes the `range` from the document. - * @param {import("../ace-internal").Ace.IRange} range A specified Range to remove - * @returns {import("../ace-internal").Ace.Point} Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`. + * @param {IRange} range A specified Range to remove + * @returns {Point} Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`. **/ remove(range) { @@ -404,7 +403,7 @@ class Document { * @param {Number} row The row to remove from * @param {Number} startColumn The column to start removing at * @param {Number} endColumn The column to stop removing at - * @returns {import("../ace-internal").Ace.Point} Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.
If `startColumn` is equal to `endColumn`, this function returns nothing. + * @returns {Point} Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.
If `startColumn` is equal to `endColumn`, this function returns nothing. **/ removeInLine(row, startColumn, endColumn) { @@ -461,7 +460,7 @@ class Document { /** * Removes the new line between `row` and the row immediately following it. This method also triggers the `"change"` event. * @param {Number} row The row to check - + * **/ removeNewLine(row) { if (row < this.getLength() - 1 && row >= 0) { @@ -476,13 +475,13 @@ class Document { /** * Replaces a range in the document with the new `text`. - * @param {Range | import("../ace-internal").Ace.IRange} range A specified Range to replace + * @param {Range | IRange} range A specified Range to replace * @param {String} text The new text to use as a replacement - * @returns {import("../ace-internal").Ace.Point} Returns an object containing the final row and column, like this: + * @returns {Point} Returns an object containing the final row and column, like this: * {row: endRow, column: 0} * If the text and range are empty, this function returns an object containing the current `range.start` value. * If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value. - + * **/ replace(range, text) { if (!(range instanceof Range)) @@ -510,8 +509,7 @@ class Document { /** * Applies all changes in `deltas` to the document. - * @param {import("../ace-internal").Ace.Delta[]} deltas An array of delta objects (can include "insert" and "remove" actions) - + * @param {Delta[]} deltas An array of delta objects (can include "insert" and "remove" actions) **/ applyDeltas(deltas) { for (var i=0; i=0; i--) { @@ -532,9 +529,8 @@ class Document { /** * Applies `delta` to the document. - * @param {import("../ace-internal").Ace.Delta} delta A delta object (can include "insert" and "remove" actions) + * @param {Delta} delta A delta object (can include "insert" and "remove" actions) * @param {boolean} [doNotValidate] - **/ applyDelta(delta, doNotValidate) { var isInsert = delta.action == "insert"; @@ -554,8 +550,7 @@ class Document { } /** - * @param {import("../ace-internal").Ace.Delta} delta - + * @param {Delta} delta */ $safeApplyDelta(delta) { var docLength = this.$lines.length; @@ -570,9 +565,8 @@ class Document { /** * - * @param {import("../ace-internal").Ace.Delta} delta + * @param {Delta} delta * @param {number} MAX - */ $splitAndapplyLargeDelta(delta, MAX) { // Split large insert deltas. This is necessary because: @@ -608,8 +602,7 @@ class Document { /** * Reverts `delta` from the document. - * @param {import("../ace-internal").Ace.Delta} delta A delta object (can include "insert" and "remove" actions) - + * @param {Delta} delta A delta object (can include "insert" and "remove" actions) **/ revertDelta(delta) { this.$safeApplyDelta({ @@ -634,7 +627,7 @@ class Document { * * @param {Number} index An index to convert * @param {Number} [startRow=0] The row from which to start the conversion - * @returns {import("../ace-internal").Ace.Point} A `{row, column}` object of the `index` position + * @returns {Point} A `{row, column}` object of the `index` position */ indexToPosition(index, startRow) { var lines = this.$lines || this.getAllLines(); @@ -659,7 +652,7 @@ class Document { * * Here, `y` is an index 15: 11 characters for the first row, and 5 characters until `y` in the second. * - * @param {import("../ace-internal").Ace.Point} pos The `{row, column}` to convert + * @param {Point} pos The `{row, column}` to convert * @param {Number} [startRow=0] The row from which to start the conversion * @returns {Number} The index position in the document */ diff --git a/src/edit_session.js b/src/edit_session.js index db0d7f65874..3a14f596977 100644 --- a/src/edit_session.js +++ b/src/edit_session.js @@ -1,12 +1,11 @@ "use strict"; /** + * @typedef {import("./layer/font_metrics").FontMetrics} FontMetrics * @typedef {import("./edit_session/fold_line").FoldLine} FoldLine - */ -/** * @typedef {import("../ace-internal").Ace.Point} Point - */ -/** - * @typedef {import("./layer/font_metrics").FontMetrics} FontMetrics + * @typedef {import("../ace-internal").Ace.Delta} Delta + * @typedef {import("../ace-internal").Ace.IRange} IRange + * @typedef {import("../ace-internal").Ace.SyntaxMode} SyntaxMode */ var oop = require("./lib/oop"); @@ -24,7 +23,7 @@ var UndoManager = require("./undomanager").UndoManager; /** * @typedef TextMode - * @type {import("../ace-internal").Ace.SyntaxMode} + * @type {SyntaxMode} */ /** @@ -36,7 +35,7 @@ class EditSession { /** * Sets up a new `EditSession` and associates it with the given `Document` and `Mode`. * @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} - * @param {import("../ace-internal").Ace.SyntaxMode} [mode] [The initial language mode to use for the document]{: #modeParam} + * @param {SyntaxMode} [mode] [The initial language mode to use for the document]{: #modeParam} **/ constructor(text, mode) { /**@type {Document}*/this.doc; @@ -160,7 +159,7 @@ class EditSession { /** * - * @param {import("../ace-internal").Ace.Delta} delta + * @param {Delta} delta */ onChange(delta) { this.$modified = true; @@ -203,28 +202,29 @@ class EditSession { /** * Returns a new instance of EditSession with state from JSON. * @method fromJSON - * @param {string} session The EditSession state. + * @param {string|object} session The EditSession state. * @returns {EditSession} */ - static fromJSON(session) { - session = JSON.parse(session); + static fromJSON(session) { + if (typeof session == "string") + session = JSON.parse(session); const undoManager = new UndoManager(); - undoManager.$undoStack = /**@type{Object}*/(session).history.undo; - undoManager.$redoStack = /**@type{Object}*/(session).history.redo; - undoManager.mark = /**@type{Object}*/(session).history.mark; - undoManager.$rev = /**@type{Object}*/(session).history.rev; + undoManager.$undoStack = session.history.undo; + undoManager.$redoStack = session.history.redo; + undoManager.mark = session.history.mark; + undoManager.$rev = session.history.rev; - const editSession = new EditSession(/**@type{Object}*/(session).value); - /**@type{Object}*/(session).folds.forEach(function(fold) { + const editSession = new EditSession(session.value); + session.folds.forEach(function(fold) { editSession.addFold("...", Range.fromPoints(fold.start, fold.end)); }); - editSession.setAnnotations(/**@type{Object}*/(session).annotations); - editSession.setBreakpoints(/**@type{Object}*/(session).breakpoints); - editSession.setMode(/**@type{Object}*/(session).mode); - editSession.setScrollLeft(/**@type{Object}*/(session).scrollLeft); - editSession.setScrollTop(/**@type{Object}*/(session).scrollTop); + editSession.setAnnotations(session.annotations); + editSession.setBreakpoints(session.breakpoints); + editSession.setMode(session.mode); + editSession.setScrollLeft(session.scrollLeft); + editSession.setScrollTop(session.scrollTop); editSession.setUndoManager(undoManager); - editSession.selection.fromJSON(/**@type{Object}*/(session).selection); + editSession.selection.fromJSON(session.selection); return editSession; } @@ -604,7 +604,6 @@ class EditSession { } /** - * * @param {RegExp} re */ highlight(re) { @@ -784,7 +783,7 @@ class EditSession { /** * Sets a new text mode for the `EditSession`. This method also emits the `'changeMode'` event. If a [[BackgroundTokenizer `BackgroundTokenizer`]] is set, the `'tokenizerUpdate'` event is also emitted. - * @param {import("../ace-internal").Ace.SyntaxMode | string} mode Set a new text mode + * @param {SyntaxMode | string} mode Set a new text mode * @param {() => void} [cb] optional callback **/ setMode(mode, cb) { @@ -830,7 +829,6 @@ class EditSession { } /** - * * @param mode * @param [$isPlaceholder] */ @@ -1033,7 +1031,7 @@ class EditSession { /** * {:Document.getTextRange.desc} - * @param {import("../ace-internal").Ace.IRange} [range] The range to work with + * @param {IRange} [range] The range to work with * * @returns {String} **/ @@ -1053,7 +1051,7 @@ class EditSession { /** * Removes the `range` from the document. - * @param {import("../ace-internal").Ace.IRange} range A specified Range to remove + * @param {IRange} range A specified Range to remove * @returns {Point} The new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`. **/ remove(range) { @@ -1075,7 +1073,7 @@ class EditSession { /** * Reverts previous changes to your document. - * @param {import("../ace-internal").Ace.Delta[]} deltas An array of previous changes + * @param {Delta[]} deltas An array of previous changes * @param {Boolean} [dontSelect] [If `true`, doesn't select the range of where the change occured]{: #dontSelect} **/ undoChanges(deltas, dontSelect) { @@ -1104,7 +1102,7 @@ class EditSession { /** * Re-implements a previously undone change to your document. - * @param {import("../ace-internal").Ace.Delta[]} deltas An array of previous changes + * @param {Delta[]} deltas An array of previous changes * @param {Boolean} [dontSelect] {:dontSelect} **/ redoChanges(deltas, dontSelect) { @@ -1141,7 +1139,7 @@ class EditSession { /** * - * @param {import("../ace-internal").Ace.Delta[]} deltas + * @param {Delta[]} deltas * @param {boolean} [isUndo] * @return {Range} */ @@ -1186,7 +1184,7 @@ class EditSession { /** * Replaces a range in the document with the new `text`. * - * @param {import("../ace-internal").Ace.IRange} range A specified Range to replace + * @param {IRange} range A specified Range to replace * @param {String} text The new text to use as a replacement * @returns {Point} An object containing the final row and column, like this: * ``` @@ -1410,7 +1408,6 @@ class EditSession { } /** - * * @param {Range} range * @returns {Range} */ @@ -1563,8 +1560,7 @@ class EditSession { } /** - * - * @param {import("../ace-internal").Ace.Delta} delta + * @param {Delta} delta */ $updateInternalDataOnChange(delta) { var useWrapMode = this.$useWrapMode; @@ -1675,7 +1671,6 @@ class EditSession { } /** - * * @param {number} firstRow * @param {number} lastRow */ @@ -1685,7 +1680,6 @@ class EditSession { } /** - * * @param {number} firstRow * @param {number} lastRow */ @@ -1734,7 +1728,6 @@ class EditSession { } /** - * * @param {number[]}tokens * @param {number} wrapLimit * @param {number} tabSize diff --git a/src/edit_session/bracket_match.js b/src/edit_session/bracket_match.js index ebe0c0deb76..53c182c417e 100644 --- a/src/edit_session/bracket_match.js +++ b/src/edit_session/bracket_match.js @@ -1,6 +1,7 @@ "use strict"; /** * @typedef {import("../edit_session").EditSession} EditSession + * @typedef {import("../edit_session").Point} Point */ var TokenIterator = require("../token_iterator").TokenIterator; var Range = require("../range").Range; @@ -9,7 +10,7 @@ function BracketMatch() { /** * - * @param {import("../../ace-internal").Ace.Point} position + * @param {Point} position * @param {string} [chr] * @this {EditSession} */ @@ -30,7 +31,7 @@ function BracketMatch() { }; /** - * @param {import("../../ace-internal").Ace.Point} pos + * @param {Point} pos * @return {null|Range} * @this {EditSession} */ @@ -80,7 +81,7 @@ function BracketMatch() { * * two Ranges if there is opening and closing brackets; * * one Range if there is only one bracket * - * @param {import("../../ace-internal").Ace.Point} pos + * @param {Point} pos * @param {boolean} [isBackwards] * @returns {null|Range[]} * @this {EditSession} @@ -126,9 +127,9 @@ function BracketMatch() { /** * * @param {string} bracket - * @param {import("../../ace-internal").Ace.Point} position + * @param {Point} position * @param {RegExp} [typeRe] - * @return {import("../../ace-internal").Ace.Point|null} + * @return {Point|null} * @this {EditSession} */ this.$findOpeningBracket = function(bracket, position, typeRe) { @@ -192,9 +193,9 @@ function BracketMatch() { /** * * @param {string} bracket - * @param {import("../../ace-internal").Ace.Point} position + * @param {Point} position * @param {RegExp} [typeRe] - * @return {import("../../ace-internal").Ace.Point|null} + * @return {Point|null} * @this {EditSession} */ this.$findClosingBracket = function(bracket, position, typeRe) { @@ -257,7 +258,7 @@ function BracketMatch() { /** * Returns [[Range]]'s for matching tags and tag names, if there are any - * @param {import("../../ace-internal").Ace.Point} pos + * @param {Point} pos * @returns {{closeTag: Range, closeTagName: Range, openTag: Range, openTagName: Range} | undefined} * @this {EditSession} */ diff --git a/src/edit_session/fold.js b/src/edit_session/fold.js index bcb3616593e..fe2b9d5dc6c 100644 --- a/src/edit_session/fold.js +++ b/src/edit_session/fold.js @@ -1,9 +1,9 @@ "use strict"; /** * @typedef {import("./fold_line").FoldLine} FoldLine - */ -/** * @typedef {import("../range").Range} Range + * @typedef {import("../../ace-internal").Ace.Point} Point + * @typedef {import("../../ace-internal").Ace.IRange} IRange */ var RangeList = require("../range_list").RangeList; @@ -98,7 +98,7 @@ class Fold extends RangeList { } /** - * @param {import("../../ace-internal").Ace.IRange} range + * @param {IRange} range */ restoreRange(range) { return restoreRange(range, this.start); @@ -107,8 +107,8 @@ class Fold extends RangeList { } /** - * @param {import("../../ace-internal").Ace.Point} point - * @param {import("../../ace-internal").Ace.Point} anchor + * @param {Point} point + * @param {Point} anchor */ function consumePoint(point, anchor) { point.row -= anchor.row; @@ -116,16 +116,16 @@ function consumePoint(point, anchor) { point.column -= anchor.column; } /** - * @param {import("../../ace-internal").Ace.IRange} range - * @param {import("../../ace-internal").Ace.Point} anchor + * @param {IRange} range + * @param {Point} anchor */ function consumeRange(range, anchor) { consumePoint(range.start, anchor); consumePoint(range.end, anchor); } /** - * @param {import("../../ace-internal").Ace.Point} point - * @param {import("../../ace-internal").Ace.Point} anchor + * @param {Point} point + * @param {Point} anchor */ function restorePoint(point, anchor) { if (point.row == 0) @@ -133,8 +133,8 @@ function restorePoint(point, anchor) { point.row += anchor.row; } /** - * @param {import("../../ace-internal").Ace.IRange} range - * @param {import("../../ace-internal").Ace.Point} anchor + * @param {IRange} range + * @param {Point} anchor */ function restoreRange(range, anchor) { restorePoint(range.start, anchor); diff --git a/src/edit_session/fold_line.js b/src/edit_session/fold_line.js index f105835e6bc..892fd128e73 100644 --- a/src/edit_session/fold_line.js +++ b/src/edit_session/fold_line.js @@ -44,7 +44,6 @@ class FoldLine { } /** - * * @param {Fold} fold */ addFold(fold) { diff --git a/src/edit_session/folding.js b/src/edit_session/folding.js index 627932d9f1c..a4c6b3959ce 100644 --- a/src/edit_session/folding.js +++ b/src/edit_session/folding.js @@ -9,6 +9,7 @@ var MouseEvent = require("../mouse/mouse_event").MouseEvent; /** * @typedef {import("../edit_session").EditSession & import("../../ace-internal").Ace.Folding} IFolding + * @typedef {import("../ace-internal").Ace.Delta } Delta */ /** @@ -46,7 +47,7 @@ function Folding() { /** * Returns all folds in the given range. Note, that this will return folds - * @param {Range| import("../../ace-internal").Ace.Delta} range + * @param {Range| Delta} range * @returns {Fold[]} **/ this.getFoldsInRange = function(range) { @@ -1005,7 +1006,7 @@ function Folding() { }; /** - * @param {import("../../ace-internal").Ace.Delta} delta + * @param {Delta} delta */ this.updateFoldWidgets = function(delta) { var firstRow = delta.start.row; diff --git a/src/editor.js b/src/editor.js index 3f8368aab82..b088521e0cb 100644 --- a/src/editor.js +++ b/src/editor.js @@ -2,9 +2,9 @@ /** * @typedef {import("./virtual_renderer").VirtualRenderer} VirtualRenderer - */ -/** * @typedef {import("./selection").Selection} Selection + * @typedef {import("../ace-internal").Ace.Point} Point + * @typedef {import("../ace-internal").Ace.SearchOptions} SearchOptions */ var oop = require("./lib/oop"); @@ -653,7 +653,7 @@ class Editor { */ $updateHighlightActiveLine() { var session = this.getSession(); - /**@type {import("../ace-internal").Ace.Point|false}*/ + /**@type {Point|false}*/ var highlight; if (this.$highlightActiveLine) { if (this.$selectionStyle != "line" || !this.selection.isMultiLine()) @@ -1462,7 +1462,7 @@ class Editor { * inline in the editor such as, for example, code completions. * * @param {String} text Text to be inserted as "ghost" text - * @param {import("../ace-internal").Ace.Point} [position] Position to insert text to + * @param {Point} [position] Position to insert text to */ setGhostText(text, position) { if (!this.session.widgetManager) { @@ -1850,7 +1850,7 @@ class Editor { * { row: newRowLocation, column: newColumnLocation } * ``` * @param {Range} range The range of text you want moved within the document - * @param {import("../ace-internal").Ace.Point} toPosition The location (row and column) where you want to move the text to + * @param {Point} toPosition The location (row and column) where you want to move the text to * @param {boolean} [copy] * * @returns {Range} The new range where the text was moved to. @@ -2113,7 +2113,7 @@ class Editor { /** * Gets the current position of the cursor. - * @returns {import("../ace-internal").Ace.Point} An object that looks something like this: + * @returns {Point} An object that looks something like this: * * ```json * { row: currRow, column: currCol } @@ -2127,7 +2127,7 @@ class Editor { /** * Returns the screen position of the cursor. - * @returns {import("../ace-internal").Ace.Point} + * @returns {Point} * @related EditSession.documentToScreenPosition **/ getCursorPositionScreen() { @@ -2171,7 +2171,7 @@ class Editor { /** * Moves the cursor to the position indicated by `pos.row` and `pos.column`. - * @param {import("../ace-internal").Ace.Point} pos An object with two properties, row and column + * @param {Point} pos An object with two properties, row and column * @related Selection.moveCursorToPosition **/ moveCursorToPosition(pos) { @@ -2480,7 +2480,7 @@ class Editor { /** * Replaces the first occurrence of `options.needle` with the value in `replacement`. * @param {String} [replacement] The text to replace with - * @param {Partial} [options] The [[Search `Search`]] options to use + * @param {Partial} [options] The [[Search `Search`]] options to use * @return {number} **/ replace(replacement, options) { @@ -2505,7 +2505,7 @@ class Editor { /** * Replaces all occurrences of `options.needle` with the value in `replacement`. * @param {String} [replacement] The text to replace with - * @param {Partial} [options] The [[Search `Search`]] options to use + * @param {Partial} [options] The [[Search `Search`]] options to use * @return {number} **/ replaceAll(replacement, options) { @@ -2550,7 +2550,7 @@ class Editor { /** * {:Search.getOptions} For more information on `options`, see [[Search `Search`]]. * @related Search.getOptions - * @returns {Partial} + * @returns {Partial} **/ getLastSearchOptions() { return this.$search.getOptions(); @@ -2559,7 +2559,7 @@ class Editor { /** * Attempts to find `needle` within the document. For more information on `options`, see [[Search `Search`]]. * @param {String|RegExp|Object} needle The text to search for (optional) - * @param {Partial} [options] An object defining various search properties + * @param {Partial} [options] An object defining various search properties * @param {Boolean} [animate] If `true` animate scrolling * @related Search.find **/ @@ -2604,7 +2604,7 @@ class Editor { /** * Performs another search for `needle` in the document. For more information on `options`, see [[Search `Search`]]. - * @param {Partial} [options] search options + * @param {Partial} [options] search options * @param {Boolean} [animate] If `true` animate scrolling * * @related Editor.find @@ -2615,7 +2615,7 @@ class Editor { /** * Performs a search for `needle` backwards. For more information on `options`, see [[Search `Search`]]. - * @param {Partial} [options] search options + * @param {Partial} [options] search options * @param {Boolean} [animate] If `true` animate scrolling * * @related Editor.find diff --git a/src/ext/code_lens.js b/src/ext/code_lens.js index b6fee2355a1..7a2c89a1228 100644 --- a/src/ext/code_lens.js +++ b/src/ext/code_lens.js @@ -1,8 +1,6 @@ "use strict"; /** * @typedef {import("../edit_session").EditSession} EditSession - */ -/** * @typedef {import("../virtual_renderer").VirtualRenderer & {$textLayer: import("../layer/text").Text &{$lenses}}} VirtualRenderer */ diff --git a/src/ext/command_bar.js b/src/ext/command_bar.js index 8c60280b69d..4ee68c31e07 100644 --- a/src/ext/command_bar.js +++ b/src/ext/command_bar.js @@ -1,5 +1,6 @@ /** * @typedef {import("../editor").Editor} Editor + * @typedef {import("../../ace-internal").Ace.TooltipCommand} TooltipCommand */ var Tooltip = require("../tooltip").Tooltip; var EventEmitter = require("../lib/event_emitter").EventEmitter; @@ -90,7 +91,7 @@ class CommandBarTooltip { * toolbar, the remaining elements are added to the overflow menu. * * @param {string} id - * @param {import("../../ace-internal").Ace.TooltipCommand} command + * @param {TooltipCommand} command */ registerCommand(id, command) { var registerForMainTooltip = Object.keys(this.commands).length < this.maxElementsOnTooltip; @@ -288,7 +289,7 @@ class CommandBarTooltip { /** * @param {string} id - * @param {import("../../ace-internal").Ace.TooltipCommand} command + * @param {TooltipCommand} command * @param {boolean} forMainTooltip */ $createCommand(id, command, forMainTooltip) { diff --git a/src/keyboard/hash_handler.js b/src/keyboard/hash_handler.js index edd8b2d6b0b..d445f5f2924 100644 --- a/src/keyboard/hash_handler.js +++ b/src/keyboard/hash_handler.js @@ -1,5 +1,9 @@ "use strict"; +/** + * @typedef {import("../../ace-internal").Ace.Command} Command + * @typedef {import("../../ace-internal").Ace.CommandLike} CommandLike +*/ /** @type {any} */var keyUtil = require("../lib/keys"); var useragent = require("../lib/useragent"); @@ -7,7 +11,7 @@ var KEY_MODS = keyUtil.KEY_MODS; class MultiHashHandler { /** - * @param {Record | import("../../ace-internal").Ace.Command[]} [config] + * @param {Record | Command[]} [config] * @param {string} [platform] */ constructor(config, platform) { @@ -15,13 +19,13 @@ class MultiHashHandler { } /** - * @param {Record | import("../../ace-internal").Ace.Command[]} config + * @param {Record | Command[]} config * @param {string} [platform] * @param {boolean} [$singleCommand] */ $init(config, platform, $singleCommand) { this.platform = platform || (useragent.isMac ? "mac" : "win"); - /**@type {Record}*/ + /**@type {Record}*/ this.commands = {}; this.commandKeyBinding = {}; this.addCommands(config); @@ -29,7 +33,7 @@ class MultiHashHandler { } /** - * @param {import("../../ace-internal").Ace.Command} command + * @param {Command} command */ addCommand(command) { if (this.commands[command.name]) @@ -42,7 +46,7 @@ class MultiHashHandler { } /** - * @param {import("../../ace-internal").Ace.Command | string} command + * @param {Command | string} command * @param {boolean} [keepCommand] */ removeCommand(command, keepCommand) { @@ -71,7 +75,7 @@ class MultiHashHandler { /** * @param {string | { win?: string; mac?: string; position?:number}} key - * @param {import("../../ace-internal").Ace.CommandLike | string} command + * @param {CommandLike | string} command * @param {number} [position] */ bindKey(key, command, position) { @@ -138,7 +142,7 @@ class MultiHashHandler { } /** - * @param {Record | import("../../ace-internal").Ace.Command[]} [commands] + * @param {Record | Command[]} [commands] */ addCommands(commands) { commands && Object.keys(commands).forEach(function(name) { @@ -163,7 +167,7 @@ class MultiHashHandler { } /** - * @param {Record} commands + * @param {Record} commands */ removeCommands(commands) { Object.keys(commands).forEach(function(name) { @@ -172,7 +176,7 @@ class MultiHashHandler { } /** - * @param {Record} keyList + * @param {Record} keyList */ bindKeys(keyList) { Object.keys(keyList).forEach(function(key) { @@ -218,7 +222,7 @@ class MultiHashHandler { /** * @param {number} hashId * @param {string} keyString - * @returns {import("../../ace-internal").Ace.Command} + * @returns {Command} */ findKeyCommand(hashId, keyString) { var key = KEY_MODS[hashId] + keyString; @@ -276,7 +280,7 @@ function getPosition(command) { class HashHandler extends MultiHashHandler { /** - * @param {Record | import("../../ace-internal").Ace.Command[]} [config] + * @param {Record | Command[]} [config] * @param {string} [platform] */ constructor(config, platform) { diff --git a/src/keyboard/keybinding.js b/src/keyboard/keybinding.js index 7ea0d2b7058..5de3ab8251c 100644 --- a/src/keyboard/keybinding.js +++ b/src/keyboard/keybinding.js @@ -1,6 +1,7 @@ "use strict"; /** * @typedef {import("../editor").Editor} Editor + * @typedef {import("../../ace-internal").Ace.KeyboardHandler} KeyboardHandler */ var keyUtil = require("../lib/keys"); var event = require("../lib/event"); @@ -13,13 +14,13 @@ class KeyBinding { constructor(editor) { this.$editor = editor; this.$data = {editor: editor}; - /**@type {(import("../../ace-internal").Ace.KeyboardHandler)[]}*/ + /**@type {(KeyboardHandler)[]}*/ this.$handlers = []; this.setDefaultHandler(editor.commands); } /** - * @param {import("../../ace-internal").Ace.KeyboardHandler} kb + * @param {KeyboardHandler} kb */ setDefaultHandler(kb) { this.removeKeyboardHandler(this.$defaultHandler); @@ -28,7 +29,7 @@ class KeyBinding { } /** - * @param {import("../../ace-internal").Ace.KeyboardHandler} kb + * @param {KeyboardHandler} kb */ setKeyboardHandler(kb) { var h = this.$handlers; @@ -42,7 +43,7 @@ class KeyBinding { } /** - * @param {import("../../ace-internal").Ace.KeyboardHandler & {attach?: (editor: any) => void, detach?: (editor: any) => void;}} [kb] + * @param {KeyboardHandler & {attach?: (editor: any) => void, detach?: (editor: any) => void;}} [kb] * @param {number} [pos] */ addKeyboardHandler(kb, pos) { @@ -66,7 +67,7 @@ class KeyBinding { } /** - * @param {import("../../ace-internal").Ace.KeyboardHandler & {attach?: (editor: any) => void, detach?: (editor: any) => void;}} kb + * @param {KeyboardHandler & {attach?: (editor: any) => void, detach?: (editor: any) => void;}} kb * @returns {boolean} */ removeKeyboardHandler(kb) { @@ -79,7 +80,7 @@ class KeyBinding { } /** - * @return {import("../../ace-internal").Ace.KeyboardHandler} + * @return {KeyboardHandler} */ getKeyboardHandler() { return this.$handlers[this.$handlers.length - 1]; diff --git a/src/layer/gutter.js b/src/layer/gutter.js index bfecc0a0899..4b87b803bf1 100644 --- a/src/layer/gutter.js +++ b/src/layer/gutter.js @@ -1,6 +1,7 @@ "use strict"; /** * @typedef {import("../edit_session").EditSession} EditSession + * @typedef {import("../../ace-internal").Ace.LayerConfig} LayerConfig */ var dom = require("../lib/dom"); var oop = require("../lib/oop"); @@ -113,7 +114,7 @@ class Gutter{ } /** - * @param {import("../../ace-internal").Ace.LayerConfig} config + * @param {LayerConfig} config */ update(config) { this.config = config; @@ -166,7 +167,7 @@ class Gutter{ } /** - * @param {import("../../ace-internal").Ace.LayerConfig} config + * @param {LayerConfig} config */ $updateGutterWidth(config) { var session = this.session; @@ -234,7 +235,7 @@ class Gutter{ } /** - * @param {import("../../ace-internal").Ace.LayerConfig} config + * @param {LayerConfig} config */ scrollLines(config) { var oldConfig = this.config; @@ -280,7 +281,7 @@ class Gutter{ } /** - * @param {import("../../ace-internal").Ace.LayerConfig} config + * @param {LayerConfig} config * @param {number} firstRow * @param {number} lastRow */ @@ -311,7 +312,7 @@ class Gutter{ /** * @param {any} cell - * @param {import("../../ace-internal").Ace.LayerConfig} config + * @param {LayerConfig} config * @param {import("../../ace-internal").Ace.IRange | undefined} fold * @param {number} row */ diff --git a/src/layer/lines.js b/src/layer/lines.js index ad54099d1aa..ae0cb71e262 100644 --- a/src/layer/lines.js +++ b/src/layer/lines.js @@ -1,6 +1,7 @@ "use strict"; /** * @typedef {import("../edit_session").EditSession} EditSession + * @typedef {import("../../ace-internal").Ace.LayerConfig} LayerConfig */ var dom = require("../lib/dom"); @@ -20,15 +21,15 @@ class Lines { } /** - * @param {import("../../ace-internal").Ace.LayerConfig} config + * @param {LayerConfig} config */ moveContainer(config) { dom.translate(this.element, 0, -((config.firstRowScreen * config.lineHeight) % this.canvasHeight) - config.offset * this.$offsetCoefficient); } /** - * @param {import("../../ace-internal").Ace.LayerConfig} oldConfig - * @param {import("../../ace-internal").Ace.LayerConfig} newConfig + * @param {LayerConfig} oldConfig + * @param {LayerConfig} newConfig */ pageChanged(oldConfig, newConfig) { return ( @@ -39,7 +40,7 @@ class Lines { /** * @param {number} row - * @param {Partial} config + * @param {Partial} config * @param {EditSession} session */ computeLineTop(row, config, session) { @@ -51,7 +52,7 @@ class Lines { /** * @param {number} row - * @param {import("../../ace-internal").Ace.LayerConfig} config + * @param {LayerConfig} config * @param {EditSession} session */ computeLineHeight(row, config, session) { diff --git a/src/layer/marker.js b/src/layer/marker.js index 21e3da1c981..935e1b8a4c4 100644 --- a/src/layer/marker.js +++ b/src/layer/marker.js @@ -1,6 +1,7 @@ "use strict"; /** * @typedef {import("../edit_session").EditSession} EditSession + * @typedef {import("../../ace-internal").Ace.LayerConfig} LayerConfig */ var Range = require("../range").Range; var dom = require("../lib/dom"); @@ -56,7 +57,7 @@ class Marker { } /** - * @param {import("../../ace-internal").Ace.LayerConfig} config + * @param {LayerConfig} config */ update(config) { if (!config) return; @@ -102,7 +103,7 @@ class Marker { /** * @param {number} row - * @param {Partial} layerConfig + * @param {Partial} layerConfig */ $getTop(row, layerConfig) { return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight; @@ -114,7 +115,7 @@ class Marker { * @param {undefined} stringBuilder * @param {Range} range * @param {string} clazz - * @param {Partial} layerConfig + * @param {Partial} layerConfig * @param {string} [extraStyle] */ drawTextMarker(stringBuilder, range, clazz, layerConfig, extraStyle) { @@ -145,7 +146,7 @@ class Marker { * @param {undefined} stringBuilder * @param {Range} range * @param {string} clazz - * @param {import("../../ace-internal").Ace.LayerConfig} config + * @param {LayerConfig} config * @param {string} [extraStyle] */ drawMultiLineMarker(stringBuilder, range, clazz, config, extraStyle) { @@ -207,7 +208,7 @@ class Marker { * @param {undefined} stringBuilder * @param {Range} range * @param {string} clazz - * @param {Partial} config + * @param {Partial} config * @param {number} [extraLength] * @param {string} [extraStyle] */ @@ -234,7 +235,7 @@ class Marker { * @param {undefined} stringBuilder * @param {Range} range * @param {string} clazz - * @param {Partial} config + * @param {Partial} config * @param {number} extraLength * @param {string} extraStyle */ @@ -257,7 +258,7 @@ class Marker { * @param {undefined} stringBuilder * @param {Range} range * @param {string} clazz - * @param {Partial} config + * @param {Partial} config * @param {undefined} [extraStyle] */ drawFullLineMarker(stringBuilder, range, clazz, config, extraStyle) { @@ -278,7 +279,7 @@ class Marker { * @param {undefined} stringBuilder * @param {Range} range * @param {string} clazz - * @param {Partial} config + * @param {Partial} config * @param {undefined} [extraStyle] */ drawScreenLineMarker(stringBuilder, range, clazz, config, extraStyle) { diff --git a/src/line_widgets.js b/src/line_widgets.js index ba920c64aa7..55db6f6ccc9 100644 --- a/src/line_widgets.js +++ b/src/line_widgets.js @@ -1,12 +1,9 @@ "use strict"; /** * @typedef {import("./edit_session").EditSession} EditSession - */ -/** * @typedef {import("./editor").Editor} Editor - */ -/** * @typedef {import("./virtual_renderer").VirtualRenderer} VirtualRenderer + * @typedef {import("../ace-internal").Ace.LineWidget} LineWidget */ var dom = require("./lib/dom"); @@ -190,8 +187,8 @@ class LineWidgets { /** * - * @param {import("../ace-internal").Ace.LineWidget} w - * @return {import("../ace-internal").Ace.LineWidget} + * @param {LineWidget} w + * @return {LineWidget} */ $registerLineWidget(w) { if (!this.session.lineWidgets) @@ -212,8 +209,8 @@ class LineWidgets { /** * - * @param {import("../ace-internal").Ace.LineWidget} w - * @return {import("../ace-internal").Ace.LineWidget} + * @param {LineWidget} w + * @return {LineWidget} */ addLineWidget(w) { this.$registerLineWidget(w); @@ -270,7 +267,7 @@ class LineWidgets { } /** - * @param {import("../ace-internal").Ace.LineWidget} w + * @param {LineWidget} w */ removeLineWidget(w) { w._inDocument = false; @@ -303,7 +300,7 @@ class LineWidgets { /** * * @param {number} row - * @return {import("../ace-internal").Ace.LineWidget[]} + * @return {LineWidget[]} */ getWidgetsAtRow(row) { var lineWidgets = this.session.lineWidgets; @@ -317,7 +314,7 @@ class LineWidgets { } /** - * @param {import("../ace-internal").Ace.LineWidget} w + * @param {LineWidget} w */ onWidgetChanged(w) { this.session._changedWidgets.push(w); diff --git a/src/marker_group.js b/src/marker_group.js index 39f8d28c25b..07b431724bd 100644 --- a/src/marker_group.js +++ b/src/marker_group.js @@ -1,8 +1,6 @@ "use strict"; /** * @typedef {import("./edit_session").EditSession} EditSession - */ -/** * @typedef {{range: import("./range").Range, className: string}} MarkerGroupItem */ /** diff --git a/src/mouse/default_handlers.js b/src/mouse/default_handlers.js index 1b0c9c4d63a..d04954df8a9 100644 --- a/src/mouse/default_handlers.js +++ b/src/mouse/default_handlers.js @@ -1,8 +1,6 @@ "use strict"; /** * @typedef {import("./mouse_handler").MouseHandler} MouseHandler - */ -/** * @typedef {import("./mouse_event").MouseEvent} MouseEvent */ var useragent = require("../lib/useragent"); diff --git a/src/multi_select.js b/src/multi_select.js index 9b265b614c4..9df7770084b 100644 --- a/src/multi_select.js +++ b/src/multi_select.js @@ -1,5 +1,7 @@ /** * @typedef {import("./anchor").Anchor} Anchor + * @typedef {import("../ace-internal").Ace.Point} Point + * @typedef {import("../ace-internal").Ace.ScreenCoordinates} ScreenCoordinates */ var RangeList = require("./range_list").RangeList; @@ -150,7 +152,7 @@ Selection.prototype.addRange = function(range, $blockChangeEvents) { /** * Removes a Range containing pos (if it exists). - * @param {import("../ace-internal").Ace.Point} pos The position to remove, as a `{row, column}` object + * @param {Point} pos The position to remove, as a `{row, column}` object * @this {Selection} **/ this.substractPoint = function(pos) { @@ -297,11 +299,10 @@ Selection.prototype.addRange = function(range, $blockChangeEvents) { }; /** - * * Gets list of ranges composing rectangular block on the screen * - * @param {import("../ace-internal").Ace.ScreenCoordinates} screenCursor The cursor to use - * @param {import("../ace-internal").Ace.ScreenCoordinates} screenAnchor The anchor to use + * @param {ScreenCoordinates} screenCursor The cursor to use + * @param {ScreenCoordinates} screenAnchor The anchor to use * @param {Boolean} [includeEmptyLines] If true, this includes ranges inside the block which are empty due to clipping * @returns {Range[]} * @this {Selection} @@ -939,10 +940,7 @@ var Editor = require("./editor").Editor; }).call(Editor.prototype); -/** - * @param {import("../ace-internal").Ace.Point} p1 - * @param {import("../ace-internal").Ace.Point} p2 - */ +/** @param {Point} p1 @param {Point} p2 */ function isSamePoint(p1, p2) { return p1.row == p2.row && p1.column == p2.column; } diff --git a/src/occur.js b/src/occur.js index 6c5ed7ca986..734cd07b86e 100644 --- a/src/occur.js +++ b/src/occur.js @@ -1,6 +1,8 @@ "use strict"; /** * @typedef {import("./editor").Editor} Editor + * @typedef {import("../ace-internal").Ace.Point} Point + * @typedef {import("../ace-internal").Ace.SearchOptions} SearchOptions */ var oop = require("./lib/oop"); @@ -66,7 +68,7 @@ class Occur extends Search { /** * @param {Editor} editor - * @param {Partial} options + * @param {Partial} options */ displayOccurContent(editor, options) { // this.setSession(session || new EditSession("")) @@ -97,8 +99,8 @@ class Occur extends Search { * the document or the beginning if the doc {row: 0, column: 0} if not * found. * @param {EditSession} session The occur session - * @param {import("../ace-internal").Ace.Point} pos The position in the original document - * @return {import("../ace-internal").Ace.Point} position in occur doc + * @param {Point} pos The position in the original document + * @return {Point} position in occur doc **/ originalToOccurPosition(session, pos) { var lines = session.$occurMatchingLines; @@ -115,8 +117,8 @@ class Occur extends Search { * Translates the position from the occur document to the original document * or `pos` if not found. * @param {EditSession} session The occur session - * @param {import("../ace-internal").Ace.Point} pos The position in the occur session document - * @return {import("../ace-internal").Ace.Point} position + * @param {Point} pos The position in the occur session document + * @return {Point} position **/ occurToOriginalPosition(session, pos) { var lines = session.$occurMatchingLines; @@ -127,7 +129,7 @@ class Occur extends Search { /** * @param {EditSession} session - * @param {Partial} options + * @param {Partial} options */ matchingLines(session, options) { options = oop.mixin({}, options); diff --git a/src/range.js b/src/range.js index c483d57207a..321ad67d2d6 100644 --- a/src/range.js +++ b/src/range.js @@ -2,6 +2,8 @@ /** * @typedef {import("./edit_session").EditSession} EditSession + * @typedef {import("../ace-internal").Ace.IRange} IRange + * @typedef {import("../ace-internal").Ace.Point} Point */ /** * This object is used in various places to indicate a region within the editor. To better visualize how this works, imagine a rectangle. Each quadrant of the rectangle is analogous to a range, as ranges contain a starting row and starting column, and an ending row, and ending column. @@ -16,12 +18,12 @@ class Range { * @constructor **/ constructor(startRow, startColumn, endRow, endColumn) { - /**@type {import("../ace-internal").Ace.Point}*/ + /**@type {Point}*/ this.start = { row: startRow, column: startColumn }; - /**@type {import("../ace-internal").Ace.Point}*/ + /**@type {Point}*/ this.end = { row: endRow, column: endColumn @@ -30,7 +32,7 @@ class Range { /** * Returns `true` if and only if the starting row and column, and ending row and column, are equivalent to those given by `range`. - * @param {import("../ace-internal").Ace.IRange} range A range to check against + * @param {IRange} range A range to check against * @return {Boolean} **/ isEqual(range) { @@ -70,7 +72,7 @@ class Range { /** * Compares `this` range (A) with another range (B). - * @param {import("../ace-internal").Ace.IRange} range A range to compare with + * @param {IRange} range A range to compare with * @related [[Range.compare]] * @returns {Number} This method returns one of the following numbers: * * `-2`: (B) is in front of (A), and doesn't intersect with (A) @@ -111,7 +113,7 @@ class Range { /** * Compares the row and column of `p` with the starting and ending [[Point]]'s of the calling range (by calling [[Range.compare]]). - * @param {import("../ace-internal").Ace.Point} p A point to compare with + * @param {Point} p A point to compare with * @related [[Range.compare]] * @returns {Number} **/ @@ -121,7 +123,7 @@ class Range { /** * Checks the start and end [[Point]]'s of `range` and compares them to the calling range. Returns `true` if the `range` is contained within the caller's range. - * @param {import("../ace-internal").Ace.IRange} range A range to compare with + * @param {IRange} range A range to compare with * @returns {Boolean} * @related [[Range.comparePoint]] **/ @@ -131,7 +133,7 @@ class Range { /** * Returns `true` if passed in `range` intersects with the one calling this method. - * @param {import("../ace-internal").Ace.IRange} range A range to compare with + * @param {IRange} range A range to compare with * @returns {Boolean} **/ intersects(range) { @@ -161,7 +163,7 @@ class Range { /** * Sets the starting row and column for the range. - * @param {Number|import("../ace-internal").Ace.Point} row A row to set + * @param {Number|Point} row A row to set * @param {Number} [column] A column to set * **/ @@ -177,7 +179,7 @@ class Range { /** * Sets the starting row and column for the range. - * @param {Number|import("../ace-internal").Ace.Point} row A row to set + * @param {Number|Point} row A row to set * @param {Number} [column] A column to set * **/ @@ -442,8 +444,8 @@ class Range { /** * Creates and returns a new `Range` based on the `start` [[Point]] and `end` [[Point]] of the given parameters. - * @param {import("../ace-internal").Ace.Point} start A starting point to use - * @param {import("../ace-internal").Ace.Point} end An ending point to use + * @param {Point} start A starting point to use + * @param {Point} end An ending point to use * @returns {Range} **/ Range.fromPoints = function(start, end) { @@ -452,8 +454,8 @@ Range.fromPoints = function(start, end) { /** * Compares `p1` and `p2` [[Point]]'s, useful for sorting - * @param {import("../ace-internal").Ace.Point} p1 - * @param {import("../ace-internal").Ace.Point} p2 + * @param {Point} p1 + * @param {Point} p2 * @returns {Number} */ Range.comparePoints = function(p1, p2) { diff --git a/src/range_list.js b/src/range_list.js index 2120c97a446..463aea29a9e 100644 --- a/src/range_list.js +++ b/src/range_list.js @@ -1,6 +1,7 @@ "use strict"; /** * @typedef {import("./edit_session").EditSession} EditSession + * @typedef {import("../ace-internal").Ace.Point} Point */ var Range = require("./range").Range; var comparePoints = Range.comparePoints; @@ -13,7 +14,7 @@ class RangeList { } /** - * @param {import("../ace-internal").Ace.Point} pos + * @param {Point} pos * @param {boolean} [excludeEdges] * @param {number} [startIndex] * @return {number} @@ -67,7 +68,7 @@ class RangeList { } /** - * @param {import("../ace-internal").Ace.Point} pos + * @param {Point} pos */ substractPoint(pos) { var i = this.pointIndex(pos); @@ -121,14 +122,14 @@ class RangeList { } /** - * @param {import("../ace-internal").Ace.Point} pos + * @param {Point} pos */ containsPoint(pos) { return this.pointIndex(pos) >= 0; } /** - * @param {import("../ace-internal").Ace.Point} pos + * @param {Point} pos */ rangeAtPoint(pos) { var i = this.pointIndex(pos); diff --git a/src/search_highlight.js b/src/search_highlight.js index 4fb2faec625..6a5e864c74d 100644 --- a/src/search_highlight.js +++ b/src/search_highlight.js @@ -1,8 +1,6 @@ "use strict"; /** * @typedef {import("./layer/marker").Marker} Marker - */ -/** * @typedef {import("./edit_session").EditSession} EditSession */ var lang = require("./lib/lang"); diff --git a/src/selection.js b/src/selection.js index 45e357288b6..6ab284305af 100644 --- a/src/selection.js +++ b/src/selection.js @@ -6,9 +6,8 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter; var Range = require("./range").Range; /** * @typedef {import("./edit_session").EditSession} EditSession - */ -/** * @typedef {import("./anchor").Anchor} Anchor + * @typedef {import("../ace-internal").Ace.Point} Point */ class Selection { @@ -69,7 +68,7 @@ class Selection { /** * Returns an object containing the `row` and `column` current position of the cursor. - * @returns {import("../ace-internal").Ace.Point} + * @returns {Point} **/ getCursor() { return this.lead.getPosition(); @@ -90,7 +89,7 @@ class Selection { /** * Returns an object containing the `row` and `column` of the calling selection anchor. * - * @returns {import("../ace-internal").Ace.Point} + * @returns {Point} * @related Anchor.getPosition **/ getAnchor() { @@ -207,7 +206,7 @@ class Selection { /** * Moves the selection cursor to the row and column indicated by `pos`. - * @param {import("../ace-internal").Ace.Point} pos An object containing the row and column + * @param {Point} pos An object containing the row and column **/ selectToPosition(pos) { this.$moveSelection(function() { @@ -376,7 +375,7 @@ class Selection { /** * * Returns `true` if moving the character next to the cursor in the specified direction is a soft tab. - * @param {import("../ace-internal").Ace.Point} cursor the current cursor position + * @param {Point} cursor the current cursor position * @param {Number} tabSize the tab size * @param {Number} direction 1 for right, -1 for left */ @@ -433,7 +432,7 @@ class Selection { else { var tabSize = this.session.getTabSize(); /** - * @type {import("../ace-internal").Ace.Point} + * @type {Point} */ var cursor = this.lead; if (this.wouldMoveIntoSoftTab(cursor, tabSize, 1) && !this.session.getNavigateWithinSoftTabs()) { @@ -749,7 +748,7 @@ class Selection { /** * Moves the selection to the position indicated by its `row` and `column`. - * @param {import("../ace-internal").Ace.Point} position The position to move to + * @param {Point} position The position to move to **/ moveCursorToPosition(position) { this.moveCursorTo(position.row, position.column); diff --git a/src/tooltip.js b/src/tooltip.js index 511aae9d280..da6badf4092 100644 --- a/src/tooltip.js +++ b/src/tooltip.js @@ -1,11 +1,7 @@ "use strict"; /** * @typedef {import("./editor").Editor} Editor - */ -/** * @typedef {import("./mouse/mouse_event").MouseEvent} MouseEvent - */ -/** * @typedef {import("./edit_session").EditSession} EditSession */ diff --git a/src/undomanager.js b/src/undomanager.js index a5e2d71efe1..92c40fd3800 100644 --- a/src/undomanager.js +++ b/src/undomanager.js @@ -1,14 +1,9 @@ "use strict"; /** * @typedef {import("./edit_session").EditSession} EditSession - */ - -/** * @typedef {import("../ace-internal").Ace.Delta} Delta - */ - -/** * @typedef {import("../ace-internal").Ace.Point} Point + * @typedef {import("../ace-internal").Ace.IRange} IRange */ /** @@ -602,8 +597,8 @@ function xform(d1, c1) { /** * - * @param {import("../ace-internal").Ace.IRange} d1 - * @param {import("../ace-internal").Ace.IRange} d2 + * @param {IRange} d1 + * @param {IRange} d2 * @param {number} dir */ function shift(d1, d2, dir) { diff --git a/src/virtual_renderer.js b/src/virtual_renderer.js index 3122de203b0..4ef7553caac 100644 --- a/src/virtual_renderer.js +++ b/src/virtual_renderer.js @@ -1,7 +1,8 @@ "use strict"; /** - * * @typedef {import("./edit_session").EditSession} EditSession + * @typedef {import("../ace-internal").Ace.Point} Point + * @typedef {import("../ace-internal").Ace.Theme} Theme */ var oop = require("./lib/oop"); var dom = require("./lib/dom"); @@ -1303,8 +1304,8 @@ class VirtualRenderer { /** * - * @param {import("../ace-internal").Ace.Point} anchor - * @param {import("../ace-internal").Ace.Point} lead + * @param {Point} anchor + * @param {Point} lead * @param {number} [offset] */ scrollSelectionIntoView(anchor, lead, offset) { @@ -1316,7 +1317,7 @@ class VirtualRenderer { /** * * Scrolls the cursor into the first visibile area of the editor - * @param {import("../ace-internal").Ace.Point} [cursor] + * @param {Point} [cursor] * @param {number} [offset] * @param {{ top?: any; bottom?: any; }} [$viewMargin] */ @@ -1417,7 +1418,7 @@ class VirtualRenderer { /** * - * @param {import("../ace-internal").Ace.Point} cursor + * @param {Point} cursor * @param {number} [alignment] * @returns {number} */ @@ -1630,7 +1631,7 @@ class VirtualRenderer { * * @param {number} x * @param {number} y - * @returns {import("../ace-internal").Ace.Point} + * @returns {Point} */ screenToTextCoordinates(x, y) { @@ -1749,7 +1750,7 @@ class VirtualRenderer { /** * @param {string} text - * @param {import("../ace-internal").Ace.Point} [position] + * @param {Point} [position] */ setGhostText(text, position) { var cursor = this.session.selection.cursor; @@ -1847,7 +1848,7 @@ class VirtualRenderer { /** * [Sets a new theme for the editor. `theme` should exist, and be a directory path, like `ace/theme/textmate`.]{: #VirtualRenderer.setTheme} - * @param {String | import("../ace-internal").Ace.Theme} [theme] The path to a theme + * @param {String | Theme} [theme] The path to a theme * @param {() => void} [cb] optional callback **/ @@ -1866,7 +1867,7 @@ class VirtualRenderer { } /** - * @param {import("../ace-internal").Ace.Theme} module + * @param {Theme} module */ function afterLoad(module) { if (_self.$themeId != theme) diff --git a/tsconfig.json b/tsconfig.json index 977a3d93d14..2f50ebab64c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,7 +20,8 @@ "src/keyboard/sublime.js", "src/keyboard/vscode.js", "src/mode", - "./ace-internal.d.ts" + "./ace-internal.d.ts", + "src/**/* *" ], "include": [ "./src/**/*",