Code Editor Features
The Integrated Development Environment provides a comprehensive code editor with essential features that support efficient code development, error detection, and file management. Understanding available editor capabilities including syntax highlighting, code validation, find and replace functionality, undo and redo operations, and save management enables developers to work productively while maintaining code quality and preventing data loss throughout development activities.
The code editor operates consistently across Controllers, Classes, Triggers, Active Pages, and Templates, providing uniform editing experiences regardless of file type being edited while supporting language-specific syntax highlighting appropriate to each file's content.
Syntax Highlighting
Purpose and Functionality
Syntax highlighting provides automatic visual differentiation of code elements through color-coding and text styling, improving code readability and reducing syntax errors during development. The editor analyzes code content and applies appropriate styling to language keywords, operators, strings, comments, and other syntactic elements.
Language Recognition: The editor recognizes multiple programming and markup languages including C# for Controllers, Classes, and Triggers, HTML for Active Pages, Templates, and Content Pages, CSS for stylesheet sections within pages and templates, and JavaScript for script sections within pages and templates.
Automatic Application: Syntax highlighting applies automatically as code is typed or when files are opened, requiring no manual activation or configuration. Highlighting updates in real-time as code is edited, reflecting current syntax structure immediately.
Readability Improvement: Color-coded syntax elements enable quick visual parsing of code structure, identification of language keywords and operators, recognition of string literals and comments, detection of mismatched brackets or quotes, and overall comprehension of code organization and flow.
Highlighted Elements
Keywords: Programming language keywords such as if, else, for, while, class, public, private, return, and other reserved words appear in distinctive colors indicating their special syntactic meaning and preventing accidental use as variable names.
Strings: String literals enclosed in quotes appear in specific colors distinguishing them from surrounding code. String highlighting helps identify text values, detect missing closing quotes, and verify string content boundaries.
Comments: Code comments appear in distinctive colors and may use italic styling to clearly differentiate documentation and explanatory text from executable code. Comment highlighting prevents accidental inclusion of commented code in active logic.
Operators: Mathematical, logical, and comparison operators including +, -, *, /, &&, ||, ==, !=, and others may receive highlighting distinguishing them from surrounding code elements.
Numbers: Numeric literals including integers, decimals, and other numeric constants may appear in distinctive colors highlighting their role as literal values in expressions and assignments.
HTML Tags and Attributes: In HTML content, element tags, attribute names, and attribute values receive distinctive colors enabling quick identification of markup structure, verification of tag closure, and detection of malformed HTML.
Highlighting Limitations
No IntelliSense or Autocomplete: While syntax highlighting improves code readability, the editor does not provide IntelliSense-style autocomplete suggestions, method signature hints, or context-aware code completion. Developers must know correct syntax, method names, and API references without editor assistance.
Basic Error Detection: Syntax highlighting provides visual feedback for obvious syntax errors such as unclosed quotes or mismatched brackets through color irregularities, but does not perform comprehensive error analysis or provide detailed error indicators during editing.
Manual Verification Required: Developers remain responsible for verifying correct syntax, proper API usage, and logical correctness. Syntax highlighting supports visual verification but does not guarantee code correctness or prevent compilation errors.
Code Validation on Save
Automatic Validation Process
When Controllers, Classes, Triggers, or Active Pages with associated Controllers are saved, the IDE performs automatic code compilation and validation. The C# compiler checks syntax correctness, verifies type compatibility, validates method signatures, confirms entity and field references, and identifies other compilation issues that prevent code execution.
Save-Triggered Validation: Validation occurs automatically every time files containing C# code are saved through save buttons or keyboard shortcuts. No manual validation triggering is necessary; saving always initiates the validation process.
Compilation Requirement: Code must compile successfully before it can execute in the Magentrix platform. Compilation errors prevent code deployment and execution, requiring error resolution before functionality becomes available to users.
No Real-Time Validation: Unlike some development environments that validate code continuously as it is typed, the Magentrix IDE validates only when files are saved. Syntax errors remain undetected until save operations occur, requiring disciplined save practices for timely error discovery.
Validation Results Display
Validation results appear at the bottom of the editor workspace immediately after save operations complete. The results area displays either success confirmation or a list of compilation errors preventing successful compilation.
Success Indication: When code compiles without errors, a success message or indicator confirms that the code is syntactically correct and ready for execution. Successful compilation does not guarantee logical correctness or expected behavior, only that syntax and types are valid.
Error List Display: When compilation errors occur, the results area displays a list of errors with specific information about each issue. Error lists enable systematic review and resolution of all compilation problems identified during validation.
Error Information
Each compilation error displayed in the validation results includes specific details enabling quick identification and correction of issues.
Line Numbers: Error messages include the line number where the error was detected, enabling immediate navigation to the problematic code location. Line numbers correspond to the line numbering displayed in the editor margin.
Error Descriptions: Each error includes a description explaining the nature of the problem such as "Syntax error," "Type mismatch," "Undefined variable," "Missing semicolon," or other specific error classifications. Descriptions communicate what the compiler detected as incorrect.
Error Context: Error messages may include context information such as the specific identifier that is undefined, the types involved in a mismatch, or the syntactic element that is malformed. Context information helps distinguish between similar errors in different code locations.
Error Resolution Process
Address compilation errors systematically by reviewing each error message in the results area, navigating to the specified line number in the code editor, analyzing the error description and context to understand the issue, correcting the identified problem through appropriate code modifications, and saving again to re-validate and verify error resolution.
Iterative Resolution: Multiple save-validate cycles may be necessary when errors cascade from earlier issues or when initial corrections introduce new problems. Continue iterating until validation succeeds without errors.
Error Prioritization: Address errors in order from first to last line number when possible, as later errors may result from earlier problems. Fixing earlier errors may automatically resolve subsequent errors that depended on earlier code.
Compiler Behavior: The compiler may stop reporting errors after encountering a certain number of issues or after critical errors that prevent further analysis. Resolving displayed errors and re-saving may reveal additional errors not initially reported.
Common Validation Errors
Syntax Errors: Missing semicolons, unmatched brackets or parentheses, incorrect method declaration syntax, malformed statements, and other structural violations generate syntax errors requiring correction to valid language syntax.
Type Mismatches: Attempting to assign incompatible types to variables, passing incorrect parameter types to methods, returning wrong types from methods, or comparing incompatible types generates type mismatch errors requiring type alignment or appropriate conversions.
Undefined References: References to undefined variables, methods, properties, classes, entities, or fields generate undefined reference errors. Verify that identifiers are spelled correctly with proper case-sensitivity and that all necessary using statements are included.
Entity and Field Name Errors: Incorrect entity or field names, particularly case-sensitivity mistakes, cause errors when code attempts to access non-existent schema elements. Use the Entity Browser to verify correct names before coding references.
Find and Replace Functionality
Purpose and Functionality
Find and replace tools enable efficient code searching and bulk text modifications within individual files. These features support quick location of specific code elements, navigation between multiple occurrences of identifiers, systematic renaming of variables or methods, and bulk text pattern modifications without manual searching and editing.
Single File Scope: Find and replace operates within the currently active file in the editor. Cross-file search requiring searching across multiple Controllers, Classes, Triggers, or Pages uses the global IDE search functionality in the sidebar rather than the editor's find and replace feature.
Pattern Matching: Find functionality locates text patterns within the active file, highlighting matches and enabling navigation between occurrences. Pattern matching typically operates on literal text strings without regular expression support unless specifically implemented.
Accessing Find and Replace
Access find and replace functionality through keyboard shortcuts or editor menu options depending on IDE implementation. Common keyboard shortcuts include Ctrl+F (Windows/Linux) or Command+F (macOS) for opening the find dialog, and Ctrl+H (Windows/Linux) or Command+H (macOS) for opening find and replace.
Dialog or Inline Interface: Find and replace may appear as a dialog box overlaying the editor or as an inline interface embedded within the editor at the top or bottom. Interface styles vary by IDE implementation but provide consistent functionality.
Find Functionality
Enter search text in the find field to locate matching text within the current file. The editor highlights all matches or navigates to the first match depending on interface design.
Match Navigation: Use next and previous buttons or keyboard shortcuts to navigate between matches in the file. Navigation enables systematic review of all occurrences and selection of specific instances for editing or verification.
Match Highlighting: Found matches receive distinctive highlighting in the editor, making them visually prominent against surrounding code. Highlighting persists until the find operation is closed or new search terms are entered.
Case Sensitivity Options: Find interfaces typically include a case-sensitive toggle option. When enabled, searches match only text with exact case; when disabled, searches match text regardless of case differences.
Whole Word Matching: Find interfaces may include a whole word option that matches only complete words rather than partial matches within longer words. Whole word matching prevents unintended matches of substrings within larger identifiers.
Replace Functionality
Enter replacement text in the replace field to specify the text that should replace found matches. Replace operations can affect individual matches or all matches depending on selected options.
Single Replace: Replace individual matches one at a time by navigating to specific occurrences and confirming replacement. Single replace provides precise control over which matches are modified.
Replace All: Replace all matches simultaneously throughout the file in a single operation. Replace all enables bulk modifications but requires careful verification that all matches should actually be replaced.
Undo After Replace: If replace operations produce unintended results, use undo functionality immediately to revert changes before additional edits complicate restoration of previous content.
Find and Replace Use Cases
Variable Renaming: Rename variables, properties, or methods throughout a file by finding all occurrences of the old name and replacing with the new name. Systematic renaming ensures consistency and prevents missed references.
String Value Updates: Update string literals that appear in multiple locations such as error messages, labels, or configuration values. Bulk updates ensure consistency across all occurrences.
API Reference Updates: When entity or field names change, use find and replace to update all references throughout affected files. Systematic updates prevent compilation errors from outdated references.
Code Pattern Modernization: Update deprecated API patterns or coding conventions by finding old patterns and replacing with updated equivalents. Pattern updates maintain code currency with platform evolution.
Undo and Redo Operations
Purpose and Functionality
Undo and redo operations enable reversal and reapplication of recent code changes, supporting iterative development, error recovery, and experimental coding approaches. These operations maintain a history of editing actions that can be traversed backward and forward as needed.
Edit History: The editor maintains a history of editing actions performed during the current editing session. History includes text insertions, deletions, replacements, and other modifications made since the file was opened.
Session-Based History: Undo history persists only during the current editing session for each file. Closing a file tab clears undo history; reopening the file starts with empty undo history based on the saved file state.
Sequential Operations: Undo operations reverse changes in reverse chronological order, undoing the most recent change first and progressively moving backward through edit history. Redo operations reapply changes in chronological order after undo operations.
Accessing Undo and Redo
Undo and redo operations are accessible through keyboard shortcuts without requiring menu navigation or button clicks. Standard keyboard shortcuts include:
Undo:
- Windows/Linux: Ctrl+Z
- macOS: Command+Z
Redo:
- Windows/Linux: Ctrl+Y
- macOS: Command+Y
Alternative Redo Shortcuts: Some implementations may support Ctrl+Shift+Z or Command+Shift+Z as alternative redo shortcuts following common application conventions.
Undo Functionality
Press the undo keyboard shortcut to reverse the most recent editing action. The editor removes or restores text affected by the undone action, returning the file content to its state before that action occurred.
Multiple Undo Levels: Undo can be invoked repeatedly to reverse multiple sequential actions, progressively moving backward through edit history. The number of undo levels depends on IDE implementation but typically supports numerous actions.
Undo Granularity: Individual undo operations reverse discrete editing actions such as typing a word, deleting a line, pasting text, or executing a find and replace operation. Granularity determines how much change each undo invocation reverses.
Undo Indication: The editor updates immediately to reflect undone changes, moving the cursor to appropriate positions and displaying file content as it existed before undone actions.
Redo Functionality
After performing undo operations, press the redo keyboard shortcut to reapply previously undone changes. Redo moves forward through edit history, reapplying changes that were reversed by undo.
Redo Limitation: Redo can only reapply changes that were undone. New edits after undo operations clear the redo history, preventing redo of changes that existed before new edits were made.
Sequential Reapplication: Redo can be invoked repeatedly to reapply multiple sequentially undone actions, moving forward through edit history until reaching the most recent state before undo operations began.
Undo and Redo Use Cases
Error Recovery: When accidental deletions, incorrect paste operations, or mistaken text replacements occur, undo enables immediate recovery of lost or corrupted content without requiring file reloading or backup restoration.
Experimental Development: Try experimental code implementations and use undo to quickly revert experiments that don't work as expected. Undo-supported experimentation enables rapid iteration without fear of losing working code.
Change Comparison: Undo and redo enable comparison between different code versions by alternating between states. Comparison helps evaluate alternative implementations or verify that changes produce improvements.
Progressive Refinement: Make incremental code changes and use undo selectively to revert specific changes while preserving others. Progressive refinement with undo support enables controlled code evolution.
Saving and Unsaved Changes
Manual Save Requirement
The IDE does not include automatic save functionality for any file types. All changes to Controllers, Classes, Triggers, Active Pages, Templates, and Content Pages must be saved explicitly through manual save actions. Developers bear complete responsibility for saving work to prevent data loss.
No Autosave: Unlike some development environments that periodically autosave work, the Magentrix IDE requires explicit save actions for any changes to be persisted. Unsaved work is lost if tabs are closed, browser crashes occur, or sessions time out without manual saves.
Disciplined Save Practices: Develop habits of frequent saving during development to minimize risk of data loss. Save after completing logical code sections, before testing operations, after significant changes, and regularly during extended editing sessions.
Save Methods
Save Buttons: Each editor tab includes a save button in the toolbar or interface controls. Clicking this button saves the current file, triggering validation for code files and persisting changes to storage.
Keyboard Shortcuts: Standard save keyboard shortcuts provide faster save access during development:
- Windows/Linux: Ctrl+S
- macOS: Command+S
Keyboard shortcuts enable saving without removing hands from the keyboard, supporting efficient workflow during active coding.
Unsaved Changes Indicators
The IDE provides visual indicators showing which open files contain unsaved changes, enabling developers to identify files requiring save operations before closing tabs or exiting sessions.
Tab Indicators: File tabs with unsaved changes typically display visual markers such as asterisks (*) in tab labels, colored dots on tabs, modified styling of tab text, or other visual cues indicating unsaved status.
Indicator Persistence: Unsaved change indicators persist until save operations are performed. Indicators update immediately after successful saves, confirming that changes have been persisted.
Save Confirmation Prompts
When attempting to close tabs with unsaved changes, the IDE displays confirmation prompts asking whether changes should be saved before closing. Prompts prevent accidental loss of unsaved work during navigation or session termination.
Prompt Options: Save confirmation prompts typically offer three options: save changes and close (persist work before closing), discard changes and close (abandon unsaved work), or cancel closure (return to editing without closing).
Multiple Unsaved Files: When closing multiple tabs or exiting the IDE with multiple unsaved files, the IDE may prompt for each file sequentially or present a consolidated interface for handling all unsaved changes simultaneously.
Exit Prevention: Until unsaved changes are addressed through save or discard actions, the IDE prevents tab closure or session exit. This protection ensures no work is lost through inadvertent navigation or closure.
Code Editor Best Practices
Frequent Saving
Regular Save Intervals: Save files frequently during development regardless of whether logical code sections are complete. Frequent saving minimizes potential data loss from unexpected events including browser crashes, network interruptions, or session timeouts.
Milestone Saving: Save after completing logical code sections, functions, or features even when continuing work on the same file. Milestone saves create restore points enabling undo to recent stable states.
Pre-Test Saving: Always save before testing code to ensure tested versions match edited code and to trigger validation that identifies compilation errors before test execution attempts.
Validation Response
Immediate Error Review: When save operations reveal compilation errors, immediately review error messages and line numbers to understand issues. Prompt error review while code context is fresh in mind accelerates resolution.
Systematic Error Resolution: Address errors systematically rather than randomly, working from first to last or prioritizing based on error severity and dependencies. Systematic approaches prevent repeated cycles of partial fixes.
Validation Success Verification: Always verify that save operations complete successfully with validation success confirmation. Never assume saves succeeded without checking results.
Undo Management
Undo Awareness: Maintain awareness of undo capability during development, knowing that recent changes can be reversed if needed. Undo awareness reduces anxiety about experimentation and enables confident exploration of alternatives.
Undo Limitations Understanding: Remember that undo history clears when files are closed, preventing undo across sessions. Plan significant structural changes with awareness that closing files eliminates undo as a recovery mechanism.
Save Before Major Changes: Save files before beginning major code restructuring or refactoring. Pre-change saves create restore points if restructuring introduces issues and undo history becomes complex or exhausted.
Find and Replace Safety
Preview Matches: Always preview found matches before executing replace operations to verify that replacement will affect intended targets without unintended side effects on similar text.
Incremental Replace: Consider using single replace rather than replace all when uncertainty exists about whether all matches should be replaced. Incremental replacement provides review opportunities at each match.
Verify After Replace: After executing replace operations, review affected code sections to verify that replacements produced intended results and didn't introduce syntax errors or logical problems.
Code Organization
Clear Formatting: Maintain clear, consistent code formatting that complements syntax highlighting including appropriate indentation that shows code structure, blank lines separating logical sections, consistent naming conventions, and readable spacing around operators.
Meaningful Identifiers: Use descriptive variable, method, and class names that communicate purpose. Clear identifiers improve code comprehension even without extensive comments.
Commenting Discipline: Include comments explaining complex logic, business rules, or non-obvious implementation choices. Comments supplement syntax highlighting by providing semantic meaning beyond syntactic structure.
Troubleshooting Common Issues
Syntax Highlighting Problems
Incorrect Language Highlighting: If syntax highlighting applies wrong language rules, verify that the file type is correctly identified by the IDE. File extension and file type configuration determine which highlighting rules apply.
Missing Highlighting: If syntax highlighting doesn't appear, check browser compatibility and ensure that the IDE loads completely. Refresh the browser or reopen files if highlighting fails to apply.
Highlighting Inconsistencies: If highlighting appears inconsistent, check for syntax errors that confuse the highlighter such as unclosed quotes or mismatched brackets. Correcting syntax errors may restore proper highlighting.
Validation Issues
Validation Not Occurring: If save operations don't trigger validation or validation results don't appear, verify that saved files are code files requiring validation (Controllers, Classes, Triggers) rather than static content files (Templates, Content Pages).
Persistent Errors After Correction: If errors persist after correction, verify that corrections were actually saved. Unsaved corrections don't affect validation results in subsequent save attempts.
Unclear Error Messages: If error messages are unclear, search for the specific error text in documentation or forums to find explanations and resolution guidance from other developers who encountered similar errors.
Undo and Redo Issues
Undo Not Available: If undo doesn't reverse recent changes, verify that undo shortcut is correct for your operating system and that the editor has focus (cursor active in editor). Check whether file was closed and reopened, clearing undo history.
Unexpected Undo Behavior: If undo reverses more or less than expected, understand that undo granularity varies by implementation. Some actions are treated as atomic units while others may be subdivided differently than expected.
Lost Undo History: If undo history is lost unexpectedly, check whether the file was closed and reopened. File closure always clears undo history; reopened files cannot undo changes made before closure.
Save Problems
Save Failures: If save operations fail without persisting changes, check network connectivity, verify that the session hasn't timed out requiring re-authentication, and ensure that no browser errors prevent communication with the platform.
Unsaved Change Indicators Persist: If unsaved change indicators persist after saving, verify that save operations completed successfully by checking validation results or success messages. Refresh the file or browser if indicators incorrectly show unsaved status.
Prompt Confusion: If save prompts appear unexpectedly, verify whether files actually contain unsaved changes that were forgotten. Review recent edits to understand what changes exist and whether they should be saved or discarded.
Jump to IDE Checklist
<< Using IDE Tools | IDE Navigation and Interface >>