Skip to content

Instantly share code, notes, and snippets.

@PeterTillema
Last active June 28, 2023 00:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PeterTillema/8e037add8416c891f72560b8ba153fb3 to your computer and use it in GitHub Desktop.
Save PeterTillema/8e037add8416c891f72560b8ba153fb3 to your computer and use it in GitHub Desktop.
/**
* MIT License
*
* Copyright (c) 2021 Peter Tillema
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/***********************************************************************
* Configuration options
***********************************************************************/
/**
* @record
*/
function OptionsObj() {}
/**
* @type {(string|DocObj|undefined)}
*/
OptionsObj.prototype.value;
/**
* @type {(string|Object|undefined)}
*/
OptionsObj.prototype.mode;
/**
* @type {(?string|undefined)}
*/
OptionsObj.prototype.lineSeparator;
/**
* @type {(string|undefined)}
*/
OptionsObj.prototype.theme;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.indentUnit;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.smartIndent;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.tabSize;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.indentWithTabs;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.electricChars;
/**
* @type {(RegExp|undefined)}
*/
OptionsObj.prototype.specialChars;
/**
* @type {(undefined|function(RegExp): Element)}
*/
OptionsObj.prototype.specialCharPlaceholder;
/**
* @type {(string|undefined)}
*/
OptionsObj.prototype.direction;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.rtlMoveVisually;
/**
* @type {(string|undefined)}
*/
OptionsObj.prototype.keyMap;
/**
* @type {(Object<string, function(CodeMirrorInstance)>|undefined)}
*/
OptionsObj.prototype.extraKeys;
/**
* @type {(undefined|(function(CodeMirror, string, Event): {
* unit: (string|(function(CodeMirror, PosObj): {from: PosObj, to: PosObj})),
* extend: boolean,
* addNew: boolean,
* moveOnDrag: boolean
* }))}
*/
OptionsObj.prototype.configureMouse;
/**
* @type {(boolean|null)}
*/
OptionsObj.prototype.lineWrapping;
/**
* @type {(boolean|null)}
*/
OptionsObj.prototype.lineNumbers;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.firstLineNumber;
/**
* @type {(undefined|function(number): string)}
*/
OptionsObj.prototype.lineNumberFormatter;
/**
* @type {(Array<string|{className: string, style: ?string}>|undefined)}
*/
OptionsObj.prototype.gutters;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.fixedGutter;
/**
* @type {(string|undefined)}
*/
OptionsObj.prototype.scrollbarStyle;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.coverGutterNextToScrollbar;
/**
* @type {(string|undefined)}
*/
OptionsObj.prototype.inputStyle;
/**
* @type {(boolean|string|undefined)}
*/
OptionsObj.prototype.readOnly;
/**
* @type {(string|undefined)}
*/
OptionsObj.prototype.screenReaderLabel;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.showCursorWhenSelecting;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.lineWiseCopyCut;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.pasteLinesPerSelection;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.selectionsMayTouch;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.undoDepth;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.historyEventDelay;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.tabindex;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.autofocus;
/**
* @type {(?Object|undefined)}
*/
OptionsObj.prototype.phrases;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.dragDrop;
/**
* @type {(Array<string>)}
*/
OptionsObj.prototype.allowDropFileTypes;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.cursorBlinkRate;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.cursorScrollMargin;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.cursorHeight;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.singleCursorHeightPerLine;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.resetSelectionOnContextMenu;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.workTime;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.workDelay;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.pollInterval;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.flattenSpans;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.addModeClass;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.maxHighlightLength;
/**
* @type {(number|undefined)}
*/
OptionsObj.prototype.viewportMargin;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.spellcheck;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.autocorrect;
/**
* @type {(boolean|undefined)}
*/
OptionsObj.prototype.autocapitalize;
/***********************************************************************
* LineHandle
***********************************************************************/
/**
* @constructor
*/
function LineHandle() {}
/**
* @type {string}
*/
LineHandle.prototype.text;
/***********************************************************************
* LineWidget
***********************************************************************/
/**
* @constructor
*/
function LineWidget() {}
/**
* @type {number}
*/
LineWidget.prototype.line = 0;
/**
*/
LineWidget.prototype.clear = function() {};
/**
*/
LineWidget.prototype.changed = function() {};
/***********************************************************************
* CodeMirror instance
***********************************************************************/
/**
* @constructor
*/
let CodeMirrorInstance = function() {};
/**
* @returns {boolean}
*/
CodeMirrorInstance.prototype.hasFocus = function() {};
/**
* @param {{line: number, ch: number}} start
* @param {number} amount
* @param {string} unit
* @param {boolean} visually
* @returns {{line: number, ch: number, hitside: (boolean|undefined)}}
*/
CodeMirrorInstance.prototype.findPosH = function(start, amount, unit, visually) {};
/**
* @param {{line: number, ch: number}} start
* @param {number} amount
* @param {boolean} visually
* @returns {{line: number, ch: number, hitside: (boolean|undefined)}}
*/
CodeMirrorInstance.prototype.findPosV = function(start, amount, visually) {};
/**
* @param {{line: number, ch: number}} pos
* @returns {{anchor: {line: number, ch: number}, head: {line: number, ch: number}}}
*/
CodeMirrorInstance.prototype.findWordAt = function(pos) {};
/**
* @param {string} option
* @param {*} value
*/
CodeMirrorInstance.prototype.setOption = function(option, value) {};
/**
* @param {string} option
* @returns {*}
*/
CodeMirrorInstance.prototype.getOption = function(option) {};
/**
* @param {Object} map
* @param {boolean} bottom
*/
CodeMirrorInstance.prototype.addKeyMap = function(map, bottom) {};
/**
* @param {Object} map
*/
CodeMirrorInstance.prototype.removeKeyMap = function(map) {};
/**
* @param {string|Object} mode
* @param {{opaque: (boolean|undefined), priority: (number|undefined)}=} options
*/
CodeMirrorInstance.prototype.addOverlay = function(mode, options) {};
/**
* @param {string|Object} mode
*/
CodeMirrorInstance.prototype.removeOverlay = function(mode) {};
/**
* @param {string} type
* @param {function(...)} func
*/
CodeMirrorInstance.prototype.on = function(type, func) {};
/**
* @param {string} type
* @param {function(...)} func
*/
CodeMirrorInstance.prototype.off = function(type, func) {};
/**
* @returns {DocObj}
*/
CodeMirrorInstance.prototype.getDoc = function() {};
/**
* @param {DocObj} doc
* @returns {DocObj}
*/
CodeMirrorInstance.prototype.swapDoc = function(doc) {};
/**
* @param {{line: number, ch: number}} pos
* @param {Element} node
* @param {boolean} scrollIntoView
*/
CodeMirrorInstance.prototype.addWidget = function(pos, node, scrollIntoView) {};
/**
* @param {number|string} width
* @param {number|string} height
*/
CodeMirrorInstance.prototype.setSize = function(width, height) {};
/**
* @param {number} x
* @param {number} y
*/
CodeMirrorInstance.prototype.scrollTo = function(x, y) {};
/**
* @returns {{
* left, top, width, height, clientWidth, clientHeight
* }}
*/
CodeMirrorInstance.prototype.getScrollInfo = function() {};
/**
* @param {{line: number, ch: number}|{left, top, right, bottom}|{from, to}|null} what
* @param {number=} margin
*/
CodeMirrorInstance.prototype.scrollIntoView = function(what, margin) {};
/**
* @param {boolean|{line: number, ch: number}} where
* @param {string} mode
* @returns {{
* left, top, bottom
* }}
*/
CodeMirrorInstance.prototype.cursorCoords = function(where, mode) {};
/**
* @param {{line: number, ch: number}} pos
* @param {string} mode
* @returns {{
* left, right, top, bottom
* }}
*/
CodeMirrorInstance.prototype.charCoords = function(pos, mode) {};
/**
* @param {{line: number, ch: number}} object
* @param {string=} mode
* @returns {{line: number, ch: number}}
*/
CodeMirrorInstance.prototype.coordsChar = function(object, mode) {};
/**
* @param {number} height
* @param {string=} mode
* @returns {number}
*/
CodeMirrorInstance.prototype.lineAtHeight = function(height, mode) {};
/**
* @param {number|LineHandle} line
* @param {string=} mode
* @param {boolean=} includeWidgets
* @returns {number}
*/
CodeMirrorInstance.prototype.heightAtLine = function(line, mode, includeWidgets) {};
/**
* @returns {number}
*/
CodeMirrorInstance.prototype.defaultTextHeight = function() {};
/**
* @returns {number}
*/
CodeMirrorInstance.prototype.defaultCharWidth = function() {};
/**
* @returns {{
* from: number,
* to: number
* }}
*/
CodeMirrorInstance.prototype.getViewport = function() {};
/**
*/
CodeMirrorInstance.prototype.refresh = function() {};
/**
* @param {{line: number, ch: number}} pos
* @returns {Object}
*/
CodeMirrorInstance.prototype.getModeAt = function(pos) {};
/**
* @param {{line: number, ch: number}} pos
* @param {boolean=} precise
* @returns {{
* start, end, string, type, state
* }}
*/
CodeMirrorInstance.prototype.getTokenAt = function(pos, precise) {};
/**
* @param {number} line
* @param {boolean=} precise
* @returns {Array<{
* start, end, string, type, state
* }>}
*/
CodeMirrorInstance.prototype.getLineTokens = function(line, precise) {};
/**
* @param {{line: number, ch: number}} pos
* @returns {string}
*/
CodeMirrorInstance.prototype.getTokenTypeAt = function(pos) {};
/**
* @param {{line: number, ch: number}} pos
* @param {string} type
* @returns {Array<helperObj>}
*/
CodeMirrorInstance.prototype.getHelpers = function(pos, type) {};
/**
* @param {{line: number, ch: number}} pos
* @param {string} type
* @returns {helperObj}
*/
CodeMirrorInstance.prototype.getHelper = function(pos, type) {};
/**
* @param {number=} line
* @param {boolean=} precise
* @returns {Object}
*/
CodeMirrorInstance.prototype.getStateAfter = function(line, precise) {};
/**
* @param {function(...*): *} func
* @returns {*}
*/
CodeMirrorInstance.prototype.operation = function(func) {};
/**
*/
CodeMirrorInstance.prototype.startOperation = function() {};
/**
*/
CodeMirrorInstance.prototype.endOperation = function() {};
/**
* @param {number} line
* @param {(string|number)=}dir
*/
CodeMirrorInstance.prototype.indentLine = function(line, dir) {};
/**
* @param {boolean} value
*/
CodeMirrorInstance.prototype.toggleOverwrite = function(value) {};
/**
* @returns {boolean}
*/
CodeMirrorInstance.prototype.isReadOnly = function() {};
/**
* @returns {string}
*/
CodeMirrorInstance.prototype.lineSeparator = function() {};
/**
* @param {string} name
*/
CodeMirrorInstance.prototype.execCommand = function(name) {};
/**
*/
CodeMirrorInstance.prototype.focus = function() {};
/**
* @param {string} text
* @returns {string}
*/
CodeMirrorInstance.prototype.phase = function(text) {};
/**
* @returns {Element}
*/
CodeMirrorInstance.prototype.getInputField = function() {};
/**
* @returns {Element}
*/
CodeMirrorInstance.prototype.getWrapperElement = function() {};
/**
* @returns {Element}
*/
CodeMirrorInstance.prototype.getScrollerElement = function() {};
/**
* @returns {Element}
*/
CodeMirrorInstance.prototype.getGutterElement = function() {};
/**
* @type {StringStream}
*/
CodeMirrorInstance.StringStream = null;
/**
* @type {Object}
*/
CodeMirrorInstance.prototype.state = {};
/***********************************************************************
* CodeMirror Document instance
***********************************************************************/
/**
* @constructor
* @extends CodeMirrorInstance
*/
let DocObj = function() {}
/**
* @param {string=} separator
* @returns {string}
*/
DocObj.prototype.getValue = function(separator) {};
/**
* @param {string} content
*/
DocObj.prototype.setValue = function(content) {};
/**
* @param {{line: number, ch: number}} from
* @param {{line: number, ch: number}} to
* @param {string=} separator
* @returns {string}
*/
DocObj.prototype.getRange = function(from, to, separator) {};
/**
*
* @param {string} replacement
* @param {{line: number, ch: number}} from
* @param {{line: number, ch: number}} to
* @param {string=} origin
*/
DocObj.prototype.replaceRange = function(replacement, from, to, origin) {};
/**
* @param {number} n
* @return {string}
*/
DocObj.prototype.getLine = function(n) {};
/**
* @returns {number}
*/
DocObj.prototype.lineCount = function() {};
/**
* @returns {number}
*/
DocObj.prototype.firstLine = function() {};
/**
* @returns {number}
*/
DocObj.prototype.lastLine = function() {};
/**
* @param {number} num
* @returns {LineHandle}
*/
DocObj.prototype.getLineHandle = function(num) {};
/**
* @param {LineHandle} handle
* @returns {number}
*/
DocObj.prototype.getLineNumber = function(handle) {};
/**
* @param {number|LineHandle} line
* @returns {number}
*/
DocObj.prototype.getLineHandleVisualStart = function(line) {};
/**
* @param {number|function(LineHandle)} start
* @param {number=} end
* @param {function(LineHandle)=} f
*/
DocObj.prototype.eachLine = function(start, end, f) {};
/**
*/
DocObj.prototype.markClean = function() {};
/**
* @param {boolean=} closeEvent
* @returns number
*/
DocObj.prototype.changeGeneration = function(closeEvent) {};
/**
* @param {number=} generation
* @returns {boolean}
*/
DocObj.prototype.isClean = function(generation) {};
/**
* @param {string=} lineSep
* @returns {string}
*/
DocObj.prototype.getSelection = function(lineSep) {};
/**
* @param {string=} lineSep
* @returns {Array<string>}
*/
DocObj.prototype.getSelections = function(lineSep) {};
/**
* @param {string} replacement
* @param {string=} select
*/
DocObj.prototype.replaceSelection = function(replacement, select) {};
/**
* @param {Array<string>} replacements
* @param {string=} select
*/
DocObj.prototype.replaceSelections = function(replacements, select) {};
/**
* @param {string=} start
* @returns {{line: number, ch: number}}
*/
DocObj.prototype.getCursor = function(start) {};
/**
* @returns {Array<{anchor: {line: number, ch: number}, head: {line: number, ch: number}}>}
*/
DocObj.prototype.listSelections = function() {};
/**
* @returns {boolean}
*/
DocObj.prototype.somethingSelected = function() {};
/**
* @param {{line: number, ch: number}|number} pos
* @param {number=} ch
* @param {{scroll: (boolean|undefined), origin: (string|undefined), bias: (number|undefined)}=} options
*/
DocObj.prototype.setCursor = function(pos, ch, options) {};
/**
* @param {{line: number, ch: number}} anchor
* @param {{line: number, ch: number}} head
* @param {{scroll: (boolean|undefined), origin: (string|undefined), bias: (number|undefined)}=} options
*/
DocObj.prototype.setSelection = function(anchor, head, options) {};
/**
* @param {Array<{anchor: {line: number, ch: number}, head: {line: number, ch: number}}>} ranges
* @param {number=} primary
* @param {{scroll: (boolean|undefined), origin: (string|undefined), bias: (number|undefined)}=} options
*/
DocObj.prototype.setSelections = function(ranges, primary, options) {};
/**
* @param {{line: number, ch: number}} anchor
* @param {{line: number, ch: number}=} head
*/
DocObj.prototype.addSelection = function(anchor, head) {};
/**
* @param {{line: number, ch: number}} from
* @param {{line: number, ch: number}=} to
* @param {{scroll: (boolean|undefined), origin: (string|undefined), bias: (number|undefined)}=} options
*/
DocObj.prototype.extendSelection = function(from, to, options) {};
/**
* @param {Array<{line: number, ch: number}>} heads
* @param {{scroll: (boolean|undefined), origin: (string|undefined), bias: (number|undefined)}=} options
*/
DocObj.prototype.extendSelections = function(heads, options) {};
/**
* @param {function({line: number, ch: number}): {line: number, ch: number}} f
* @param {{scroll: (boolean|undefined), origin: (string|undefined), bias: (number|undefined)}=} options
*/
DocObj.prototype.extendSelectionBy = function(f, options) {};
/**
* @param {boolean} value
*/
DocObj.prototype.setExtending = function(value) {};
/**
* @returns {boolean}
*/
DocObj.prototype.getExtending = function() {};
/**
* @returns {CodeMirror}
*/
DocObj.prototype.getEditor = function() {};
/**
* @param {boolean} copyHistory
* @returns {DocObj}
*/
DocObj.prototype.copy = function(copyHistory) {};
/**
* @param {{
* sharedHist: (boolean|undefined),
* from: (number|undefined),
* to: (number|undefined),
* mode: (string|Object|undefined)
* }} options
* @returns {DocObj}
*/
DocObj.prototype.linkedDoc = function(options) {};
/**
* @param {DocObj} doc
*/
DocObj.prototype.unlinkDoc = function(doc) {};
/**
* @param {function(DocObj, boolean)} func
*/
DocObj.prototype.iterLinkedDocs = function(func) {};
/**
*/
DocObj.prototype.undo = function() {};
/**
*/
DocObj.prototype.redo = function() {};
/**
*/
DocObj.prototype.undoSelection = function() {};
/**
*/
DocObj.prototype.redoSelection = function() {};
/**
* @returns {{undo: number, redo: number}}
*/
DocObj.prototype.historySize = function() {};
/**
*/
DocObj.prototype.clearHistory = function() {};
/**
* @returns {Object}
*/
DocObj.prototype.getHistory = function() {};
/**
* @param {Object} history
*/
DocObj.prototype.setHistory = function(history) {};
/**
* @param {{line: number, ch: number}} from
* @param {{line: number, ch: number}} to
* @param {{
* className: (string|undefined),
* inclusiveLeft: (boolean|undefined),
* inclusiveRight: (boolean|undefined),
* selectLeft: (boolean|undefined),
* selectRight: (boolean|undefined),
* atomic: (boolean|undefined),
* collapsed: (boolean|undefined),
* clearOnEnter: (boolean|undefined),
* clearWhenEmpty: (boolean|undefined),
* replacedWith: (Element|undefined),
* handleMouseEvents: (boolean|undefined),
* readOnly: (boolean|undefined),
* addToHistory: (boolean|undefined),
* startStyle: (string|undefined),
* endStyle: (string|undefined),
* css: (string|undefined),
* attributes: (Object|undefined),
* shared: (boolean|undefined)
* }=} options
* @returns {TextMarker}
*/
DocObj.prototype.markText = function(from, to, options) {};
/**
* @param {{line: number, ch: number}} pos
* @param {{
* widget: (Element|undefined),
* insertLeft: (boolean|undefined),
* shared: (boolean|undefined),
* handleMouseEvents: (boolean|undefined)
* }=} options
* @returns {TextMarker}
*/
DocObj.prototype.setBookmark = function(pos, options) {};
/**
* @param {{line: number, ch: number}} from
* @param {{line: number, ch: number}} to
* @returns {Array<TextMarker>}
*/
DocObj.prototype.findMarks = function(from, to) {};
/**
* @param {{line: number, ch: number}} pos
* @returns {Array<TextMarker>}
*/
DocObj.prototype.findMarksAt = function(pos) {};
/**
* @returns {Array<TextMarker>}
*/
DocObj.prototype.getAllMarks = function() {};
/**
* @param {number|LineHandle} line
* @param {string} gutterID
* @param {Element} value
* @returns {LineHandle}
*/
DocObj.prototype.setGutterMarker = function(line, gutterID, value) {};
/**
* @param {string} gutterID
*/
DocObj.prototype.clearGutter = function(gutterID) {};
/**
* @param {number|LineHandle} line
* @param {string} where
* @param {string} class2
* @returns {LineHandle}
*/
DocObj.prototype.addLineClass = function(line, where, class2) {};
/**
* @param {number|LineHandle} line
* @param {string} where
* @param {string} class2
* @returns {LineHandle}
*/
DocObj.prototype.removeLineClass = function(line, where, class2) {};
/**
* @param {number|LineHandle} line
* @returns {{
* line, handle, text, gutterMarkers, textClass, bgClass, wrapClass, widgets
* }}
*/
DocObj.prototype.lineInfo = function(line) {};
/**
* @param {number|LineHandle} line
* @param {Element} node
* @param {{
* coverGutter: (boolean|undefined),
* noHScroll: (boolean|undefined),
* above: (boolean|undefined),
* handleMouseEvents: (boolean|undefined),
* insertAt: (number|undefined),
* className: (string|undefined)
* }=} options
* @returns {LineWidget}
*/
DocObj.prototype.addLineWidget = function(line, node, options) {};
/**
* @returns {Object}
*/
DocObj.prototype.getMode = function() {};
/**
* @param {number} index
* @returns {{line: number, ch: number}}
*/
DocObj.prototype.posFromIndex = function(index) {};
/**
* @param {{line: number, ch: number}} object
* @returns {number}
*/
DocObj.prototype.indexFromPos = function(object) {};
/***********************************************************************
* CodeMirror instance from Textarea
***********************************************************************/
/**
* @constructor
* @extends {DocObj}
*/
let CodeMirrorFromTextAreaObj = function() {};
/**
*/
CodeMirrorFromTextAreaObj.prototype.save = function(){};
/**
*/
CodeMirrorFromTextAreaObj.prototype.toTextArea = function() {};
/**
* @returns {HTMLTextAreaElement}
*/
CodeMirrorFromTextAreaObj.prototype.getTextArea = function() {};
/***********************************************************************
* Helper Object
***********************************************************************/
/** @typedef {*} */
let helperObj;
/***********************************************************************
* Pos Object
***********************************************************************/
/**
* @record
*/
function PosObj() {}
/**
* @type {number}
*/
PosObj.prototype.line;
/**
* @type {number}
*/
PosObj.prototype.ch;
/**
* @type {string}
*/
PosObj.prototype.sticky;
/***********************************************************************
* Commands Object
***********************************************************************/
/**
* @record
*/
function CommandsObj() {}
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.selectAll = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.singleSelection = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.killLine = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.deleteLine = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.delLineLeft = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.delWrappedLineLeft = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.delWrappedLineRight = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.undo = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.redo = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.undoSelection = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.redoSelection = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goDocStart = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goDocEnd = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goLineStart = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goLineStartSmart = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goLineEnd = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goLineRight = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goLineLeft = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goLineLeftSmart = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goLineUp = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goLineDown = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goPageUp = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goPageDown = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goCharLeft = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goCharRight = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goColumnLeft = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goColumnRight = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goWordLeft = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goWordRight = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goGroupLeft = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.goGroupRight = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.delCharBefore = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.delCharAfter = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.delWordBefore = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.delWordAfter = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.delGroupBefore = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.delGroupAfter = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.indentAuto = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.indentMore = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.indentLess = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.insertTab = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.insertSoftTab = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.defaultTab = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.transposeChars = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.newlineAndIndent = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.toggleOverwrite = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.save = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.find = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.findNext = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.findPrev = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.replace = function(cm) {};
/**
* @param {DocObj} cm
*/
CommandsObj.prototype.replaceAll = function(cm) {};
/***********************************************************************
* TextMarker Object
***********************************************************************/
/**
* @constructor
*/
let TextMarker = function() {};
/**
*/
TextMarker.prototype.clear = function() {};
/**
* @returns {{line: number, ch: number}}
*/
TextMarker.prototype.find = function() {};
/**
*/
TextMarker.prototype.changed = function() {};
/***********************************************************************
* StringStream Object
***********************************************************************/
/**
* @constructor
*/
let StringStream = function() {};
/**
* @typedef {number}
*/
StringStream.pos;
/**
* @return boolean
*/
StringStream.prototype.eol = function() {};
/**
* @return boolean
*/
StringStream.prototype.sol = function() {};
/**
* @return string
*/
StringStream.prototype.peek = function() {};
/**
* @return string
*/
StringStream.prototype.next = function() {};
/**
* @param {string|RegExp|function(string):boolean} match
* @return string
*/
StringStream.prototype.eat = function(match) {};
/**
* @param {string|RegExp|function(string):boolean} match
* @return boolean
*/
StringStream.prototype.eatWhile = function(match) {};
/**
* @return boolean
*/
StringStream.prototype.eatSpace = function() {};
/**
* @return void
*/
StringStream.prototype.skipToEnd = function() {};
/**
* @param {string} str
* @return boolean
*/
StringStream.prototype.skipTo = function(str) {};
/**
* @param {string|RegExp} pattern
* @param {boolean} consume
* @param {?boolean=} casefold
* @return boolean|Array<string>
*/
StringStream.prototype.match = function(pattern, consume, casefold) {};
/**
* @param {number} n
* @return void
*/
StringStream.prototype.backUp = function(n) {};
/**
* @return number
*/
StringStream.prototype.column = function() {};
/**
* @return number
*/
StringStream.prototype.indentation = function() {};
/**
* @return string
*/
StringStream.prototype.current = function() {};
/**
* @param {number} n
* @return ?string
*/
StringStream.prototype.lookAhead = function(n) {};
/***********************************************************************
* CodeMirror Mode functions
***********************************************************************/
/**
* @typedef {{
* startState: function():Object,
* token: function(StringStream, Object):string,
* indent: function(Object, string):number
* }}
*/
let CodeMirrorMode;
/***********************************************************************
* CodeMirror Object
***********************************************************************/
/**
* @constructor
* @param {(Element|function(Element))} element
* @param {(OptionsObj|Object<string, *>)=} options
* @returns {!CodeMirrorInstance}
*/
function CodeMirror(element, options) {}
/**
* @type {string}
*/
CodeMirror.prototype.version = "0";
/**
* @param {HTMLTextAreaElement} textArea
* @param {(OptionsObj|Object<string,*>)=} config
* @returns {CodeMirrorFromTextAreaObj}
*/
CodeMirror.fromTextArea = function(textArea, config) {};
/**
* @const {OptionsObj}
*/
CodeMirror.prototype.defaults;
/**
* @param {string} name
* @param {*} value
*/
CodeMirror.defineExtension = function(name, value) {};
/**
* @param {string} name
* @param {*} value
*/
CodeMirror.defineDocExtension = function(name, value) {};
/**
* @param {string} name
* @param {*} def
* @param {function(CodeMirrorInstance, *, *)} updateFunc
*/
CodeMirror.defineOption = function(name, def, updateFunc) {};
/**
* @param {function(CodeMirrorInstance)} func
*/
CodeMirror.defineInitHook = function(func) {};
/**
* @param {string} type
* @param {string} name
* @param {helperObj} value
*/
CodeMirror.registerHelper = function(type, name, value) {};
/**
* @param {string} type
* @param {string} name
* @param {function((string|Object), CodeMirror)} predicate
* @param {helperObj} value
*/
CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {};
/**
* @param {number} line
* @param {number=} ch
* @param {string=} sticky
* @constructor
* @returns {PosObj}
*/
CodeMirror.Pos = function(line, ch, sticky) {};
/**
* @param {Object} change
* @returns {{line: number, ch: number}}
*/
CodeMirror.changeEnd = function(change) {};
/**
* @param {string} line
* @param {number} index
* @param {number} tabSize
* @returns {number}
*/
CodeMirror.countColumn = function(line, index, tabSize) {};
/**
* @constructor
*/
CodeMirror.Pass = function() {};
/**
* @param {string} name
* @param {function((OptionsObj|Object<string, *>), Object):CodeMirrorMode} mode
*/
CodeMirror.defineMode = function(name, mode) {};
/**
* @param {string} mime_type
* @param {string|Object} data
*/
CodeMirror.defineMIME = function(mime_type, data) {};
/**
* @type {CommandsObj}
*/
CodeMirror.commands = null;
/**
* @type {{toString: (function(): string)}}
*/
CodeMirror.Init = {toString: function(){return "CodeMirror.Init"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment