ajaxorg/ace · warning

Use of document.removeLines is deprecated. Use the removeFul

Error message

Use of document.removeLines is deprecated. Use the removeFullLines method instead.

What it means

A deprecation warning printed by Document.removeLines. The method delegates to removeFullLines and behaves identically; the rename clarified that entire rows are removed.

Source

Thrown at src/document.js:213

     * @param row
     * @param lines
     
     * @deprecated
     */
    insertLines(row, lines) {
        console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
        return this.insertFullLines(row, lines);
    }

    /**
     * @param firstRow
     * @param lastRow
     * @returns {String[]}
     
     * @deprecated
     */
    removeLines(firstRow, lastRow) {
        console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
        return this.removeFullLines(firstRow, lastRow);
    }

    /**
     * @param position
     * @returns {Point}
     
     * @deprecated
     */
    insertNewLine(position) {
        console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
        return this.insertMergedLines(position, ["", ""]);
    }

    /**
     * Inserts a block of `text` at the indicated `position`.
     * @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

View on GitHub (pinned to 2c1eddc392)

Solutions

  1. Replace doc.removeLines(firstRow, lastRow) with doc.removeFullLines(firstRow, lastRow)
  2. If you actually want to delete a text range, use doc.remove(range) with an Ace Range instead
  3. Search the codebase for 'removeLines(' and migrate all call sites at once
  4. Safe to ignore short-term — it is only a console.warn

Example fix

// before
doc.removeLines(3, 5);
// after
doc.removeFullLines(3, 5);
Defensive patterns

Strategy: validation

Validate before calling

if (typeof doc.removeFullLines !== 'function') throw new Error('removeFullLines unavailable; upgrade ace');
doc.removeFullLines(firstRow, lastRow);

Type guard

function hasRemoveFullLines(doc) { return doc && typeof doc.removeFullLines === 'function'; }

Try / catch

try {
  doc.removeFullLines(firstRow, lastRow);
} catch (e) {
  console.error('line remove failed', e);
}

Prevention

When it happens

Trigger: Calling session.doc.removeLines(firstRow, lastRow) in code using the legacy Document API.

Common situations: Legacy plugins or copied snippets manipulating document lines directly; long-lived codebases upgraded across Ace versions.

Related errors


AI-assisted analysis of ajaxorg/ace@2c1eddc392 (2026-08-30). Data as JSON: /api/errors/7343d0cc578dd4d9. Report an issue: GitHub.