Skip to content

Planned Migration: CodeMirror v5 → v6 for Studio #3157

@robfrank

Description

@robfrank

Overview

This issue tracks the planned migration of ArcadeDB Studio from CodeMirror v5.65.19 to CodeMirror v6.x. This is a major version upgrade that requires significant code changes and should be treated as a dedicated project, not a simple dependency update.

Background

Why we're staying on v5 for now:

  • CodeMirror v5.65.19 is secure for our use case (we don't use the vulnerable Markdown mode affected by CVE-2025-6493)
  • v6 requires a complete API rewrite (~8-10 hours of development effort)
  • v5 meets all current Studio requirements

Why we need v6 eventually:

  • v5 is in maintenance mode (legacy software)
  • v6 is more accessible, mobile-friendly, and actively maintained
  • Better performance and modern architecture
  • Future security updates will only target v6

Related:

Current CodeMirror Usage in Studio

Files affected:

  • studio/src/main/js/studio-main.js (imports and initialization)
  • studio/src/main/js/components/QueryEditor.js (or similar - TBD during migration)
  • CSS files using CodeMirror classes
  • Webpack configuration for mode/addon bundling

Current features used:

  • SQL mode (codemirror/mode/sql/sql)
  • JavaScript mode (codemirror/mode/javascript/javascript)
  • Show-hint addon (codemirror/addon/hint/show-hint)
  • SQL-hint addon (codemirror/addon/hint/sql-hint)
  • Custom Cypher mode (needs investigation - likely custom implementation)

Migration Requirements

1. Package Changes

Remove:

"codemirror": "^5.65.19"

Add:

"codemirror": "^6.0.0",
"@codemirror/lang-sql": "^6.0.0",
"@codemirror/lang-javascript": "^6.0.0",
"@codemirror/autocomplete": "^6.0.0",
"@codemirror/state": "^6.0.0",
"@codemirror/view": "^6.0.0",
"@codemirror/commands": "^6.0.0",
"@codemirror/language": "^6.0.0"

2. API Migration

v5 initialization:

import CodeMirror from 'codemirror';
import 'codemirror/mode/sql/sql';
import 'codemirror/addon/hint/show-hint';

const editor = CodeMirror(element, {
  mode: 'text/x-sql',
  lineNumbers: true,
  // ...options
});

v6 initialization:

import { EditorView, basicSetup } from 'codemirror';
import { sql } from '@codemirror/lang-sql';
import { autocompletion } from '@codemirror/autocomplete';

const editor = new EditorView({
  doc: '',
  extensions: [
    basicSetup,
    sql(),
    autocompletion()
  ],
  parent: element
});

3. Custom Cypher Mode

Challenge: CodeMirror v6 does NOT have an official Cypher language mode.

Options:

  • Port the v5 Cypher mode to v6 Lezer grammar (high effort)
  • Use a community Cypher mode if available
  • Temporarily use generic syntax highlighting as fallback

Investigation needed: Determine if ArcadeDB has a custom Cypher mode in v5.

4. CSS Updates

  • v6 uses different CSS class names (.cm-editor instead of .CodeMirror)
  • Theme system is different (JavaScript-based instead of CSS-based)
  • All custom Studio styles need updating

5. Webpack Configuration

  • v6 has modular ES6 packages (no separate mode files to copy)
  • Update webpack rules for CodeMirror assets
  • Remove v5-specific file copying

Migration Plan

Phase 1: Investigation & Planning (2 hours)

  • Audit all CodeMirror usage in Studio codebase
  • Identify custom modes/addons (especially Cypher)
  • Document current editor configurations
  • Research v6 alternatives for custom functionality

Phase 2: Development (4-6 hours)

  • Install v6 packages
  • Migrate editor initialization code
  • Implement SQL mode with autocomplete
  • Implement JavaScript mode
  • Port or create Cypher mode for v6
  • Update CSS for v6 class names
  • Update Webpack configuration
  • Maintain feature parity with v5

Phase 3: Testing (2-3 hours)

  • Manual testing of SQL editor
  • Manual testing of Cypher editor (if applicable)
  • Manual testing of JavaScript editor
  • Test autocomplete functionality
  • Test syntax highlighting
  • Cross-browser testing
  • Mobile/responsive testing
  • Create/update Playwright tests for editor functionality

Phase 4: Deployment & Monitoring (1 hour)

  • Code review
  • Deploy to staging
  • Production deployment
  • Monitor for issues

Estimated Effort

Total: 8-12 hours of development + testing

Skills required:

  • Frontend development (JavaScript/ES6)
  • CodeMirror v6 API knowledge
  • Webpack configuration
  • CSS/styling

Success Criteria

  • All editor instances working with v6
  • SQL mode with autocomplete functional
  • JavaScript mode functional
  • Cypher mode functional (if applicable)
  • No visual regressions
  • All existing editor features maintained
  • Performance equal or better than v5
  • Playwright tests passing
  • Documentation updated

References

Timeline

Suggested: Q2 2026 (non-urgent, planned migration)

This should be scheduled when:

  • Dedicated frontend resource is available
  • Studio has no other high-priority changes in progress
  • Adequate testing time is available

Labels: enhancement, studio, technical-debt
Priority: Medium (not urgent, but important for long-term maintenance)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions