ajaxorg/ace · warning
Use of document.insertLines is deprecated. Use the insertFul
Error message
Use of document.insertLines is deprecated. Use the insertFullLines method instead.
What it means
A deprecation warning printed by Document.insertLines. The method still works — it delegates to insertFullLines — but the API was renamed to reflect that it inserts complete lines, and callers are expected to migrate.
Source
Thrown at src/document.js:201
// Handle a multi-line range.
lines = this.getLines(range.start.row, range.end.row);
lines[0] = (lines[0] || "").substring(range.start.column);
var l = lines.length - 1;
if (range.end.row - range.start.row == l)
lines[l] = lines[l].substring(0, range.end.column);
}
return lines;
}
// Deprecated methods retained for backwards compatibility.
/**
* @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}View on GitHub (pinned to 2c1eddc392)
Solutions
- Replace doc.insertLines(row, lines) with doc.insertFullLines(row, lines)
- If you want silent text insertion rather than whole-line semantics, use doc.insert(position, text) instead
- Audit wrapper libraries for passthrough calls to insertLines
- Acknowledge the warning as benign until migration is done — behavior is unchanged
Example fix
// before doc.insertLines(5, ['foo', 'bar']); // after doc.insertFullLines(5, ['foo', 'bar']);
Defensive patterns
Strategy: validation
Validate before calling
if (typeof doc.insertFullLines !== 'function') throw new Error('insertFullLines unavailable; upgrade ace');
doc.insertFullLines(row, lines); Type guard
function hasFullLinesApi(doc) { return doc && typeof doc.insertFullLines === 'function'; } Try / catch
try {
doc.insertFullLines(row, lines);
} catch (e) {
console.error('line insert failed', e);
} Prevention
- Migrate to insertFullLines/removeFullLines/insertMergedLines across the board
- Run tests with console warnings visible so deprecations surface in CI
- Avoid wrapping Document methods in your own facade that may lag the API
When it happens
Trigger: Calling session.doc.insertLines(row, lines) or document.insertLines directly in code written against the old Ace Document API.
Common situations: Old editor plugins and legacy codebases ported forward across Ace versions; tutorials or snippets predating the API rename.
Related errors
- Use of document.removeLines is deprecated. Use the removeFul
- Use of document.insertNewLine is deprecated. Use insertMerge
- This is an obsolete command. Please use `openCommandPalette`
- deprecated use session.addGutterDecoration
AI-assisted analysis of ajaxorg/ace@2c1eddc392 (2026-08-30).
Data as JSON: /api/errors/63028765d8c17a08.
Report an issue: GitHub.