Skip to content

Comments

feat: add Ace compatibility shims for plugins#1893

Merged
bajrangCoder merged 1 commit intoAcode-Foundation:mainfrom
bajrangCoder:new/codemirror-ace-compat-apis
Feb 21, 2026
Merged

feat: add Ace compatibility shims for plugins#1893
bajrangCoder merged 1 commit intoAcode-Foundation:mainfrom
bajrangCoder:new/codemirror-ace-compat-apis

Conversation

@bajrangCoder
Copy link
Member

Add editor.getSelectionRange(), editor.scrollToRow(), and ace.require('ace/ext/modelist') compatibility mapping.

Add editor.getSelectionRange(), editor.scrollToRow(), and ace.require('ace/ext/modelist') compatibility mapping.
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 21, 2026

Greptile Summary

This PR adds three Ace editor API compatibility shims to support legacy Ace-based plugins:

  • editor.getSelectionRange(): Returns selection range with 0-based row numbers (Ace convention), converting from CodeMirror's 1-based line numbers
  • editor.scrollToRow(row): Scrolls to a 0-based row index, with special handling for Infinity to jump to document end
  • ace.require('ace/ext/modelist'): Compatibility wrapper that maps CodeMirror's modelist functions (getModeForPath, getModes, getModesByName) to Ace's expected format with ace/mode/ prefixes

All implementations include proper error handling and comprehensive test coverage.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Well-structured compatibility shims with proper error handling, correct row number conversions between 0-based (Ace) and 1-based (CodeMirror) conventions, and comprehensive test coverage for all new functionality
  • No files require special attention

Important Files Changed

Filename Overview
src/lib/editorManager.js Added getSelectionRange() and scrollToRow() Ace compatibility shims with proper 0-based row conversion
src/main.js Implemented ace.require('ace/ext/modelist') compatibility wrapper for mode detection
src/test/ace.test.js Added basic tests for new compatibility shims - validates function existence and basic behavior

Last reviewed commit: 9e9d617

@bajrangCoder bajrangCoder merged commit a49fa02 into Acode-Foundation:main Feb 21, 2026
5 checks passed
@bajrangCoder bajrangCoder deleted the new/codemirror-ace-compat-apis branch February 21, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant