New features in ModelMaker Code Explorer for Visual Studio 2.00

MMX-VS v2.00 released

On 6 December 2007 ModelMaker Tools released ModelMaker Code Explorer for Visual Studio 2. This major update is available for Visual Studio 2003, 2005 and 2008.

Generic and C# new features

Visual Studio 2008 support

  • Visual Studio 2008 IDE integration available.
  • C# v1.0 up to v3.5 support

New Editing features

  • Convert Field to Property optionally creates a read-only property rather than read-write.
  • Convert member at cursor positionConvert Field to Property demo movie to Field / Method /Property available in MMX IDE (editor) menu. Convert field to property etc.
  • Type selectors have a button to suggest type based on entity name and history. Shortcut Ctrl+H. This is similar to the already existing command / button in the parameter wizard. The shortcut for the parameter wizard has been changed to Ctrl+Alt+H to avoid a duplicate shortcut in the method dialog.
  • Double clicking on a type selector, first selects the type and then accepts the containing dialog (as if OK were clicked). For example in method, field and local var dialogs.
  • The default TODO item for new methods can contain CRLFs (Properties | [Language\ | Editing tab). A CRLF sequence is entered as \N Normal \ characters should be escaped like so \\
  • Explorer windows members view rearrange modes now accept multiple selected entities when re-arranging. Constraints are applied on each dragged entity. Also dragged entities cannot surround the drop target entity and must be either all below or all above the drop target.
  • Move Selection Up / Down. Moves the IDE Editor selection up / down by one line. If nothing is selected, the current line is moved up / down.
  • IDE editor: Sort text, sorts selected lines.
  • Default sort all classes and Rearrange members are now also available from the main MMX menu (Sorting sub-menu).
  • Rearranged the IDE MMX menus to create space for new commands. Code Explorer, Source Indexer and Sorting commands are moved to new sub menus.
  • Keybindings and shortcuts are stored as integer rather than as current locale dependent string. New registry entities like KeybindingsEx contain data like AddToHistoryAction=#24648;Shift+Ctrl+H  . The numeric value - in this case "#24648;" - is optional, to manually modify the binding, just enter the text value, for example "Ctrl+Alt+H"

Find Next / Previous identifier occurrence

  • Find next / previous occurrenceFind identifier demo movie of an identifier: scrolls the editor to the next occurrence of the word at cursor position. Searches full text including comments and strings. A hint window pops up showing the number of occurrences and the current occurrence number (after jumping). If the cursor is not on or immediately after an identifier the previously searched identifier is used. Default keybindings: Shift+Alt+Right/Left.
  • Check Properties | General | Searching for options such as feedback window style, display search context, dropping a bookmark, colors and more.
  • Custom find identifier, invokes the Find next / previous logic allowing to enter a search string rather than picking up the word at cursor position. Default keyboard shortcut is Shift+Alt+Home. It is also invoked by regular Find/Next if the editor is at line 1, column 1

Browsing and Navigating

  • Select default class on Properties | General tab. If enabled, the cursor is positioned on the first class in a module after opening a source file. Default enabled. Now also available in CodeGear IDEs. For Visual Studio the feature has been redesigned to avoid interfering with VS navigation commands.
  • Files with non-supported encodings are displayed as an empty module with a single parsing error message rather than a messy interpretation of the input stream. Also all editing operations are blocked.
  • Member Search bar: Pressing Escape when the search bar is empty, terminates module search mode.
  • Member Search bar: Pressing Ctrl+End sets focus to the members view and selects the last item in the list.
  • MMX Properties command is context sensitive. Invoking the command on live metrics will open the live metrics tab, similar for search results, parsing errors etc.

New Source Indexer features

Tabbed browsing in Indexer

  • Tabbed searching Code Explorer 5 screenshot in Source Indexer window. Tabs can be added with New Tab and closed with Close Tab and Close other Tabs commands. DblClick on a tab also closes the tab. The Tab position is adjustable (Top, Bottom Left, Right) via the pop up menu. Note that Left and Right tabs do not appear themed.

New Indexer commands

  • Find in Module (IDE editor command) builds an index for the top most module and displays the matches for the word at cursor in a new tab. Does not require an existing index. Default shortcut Shift+Ctrl+Alt+F
  • IDE editor commands to move to previous / next indexer match position. Default shortcuts Shift+Alt+F7/F8
  • Show Source Indexer just activates the source indexer window in its current search state - without starting a new search for the current word at cursor.
  • Refresh views updates search matches and their cursor locations in all tabs - without rebuilding the index. Used to pick up changes from modified files.
  • Report allows emitting the search results to file, printer, clipboard or preview.
  • Expand all (Ctrl+Right) available. Note: expanding a node for the first time causes the file to be re-parsed. This has the advantage of seeing up to date search results, but the disadvantage of processing time. When expanding a single node, you usually don't notice this in-place reparsing, but you might see a delay for an "expand all" for many files.
  • New keyboard navigation commands in source indexer window:
    Down in Search edit focuses match results (Down just changes focus, without invoking the search command like Enter does)
    Escape or Up Search edit focus the code editor.
    Ctrl+Alt+S sets focus to the search edit. Space or mouse click on a match, locates the match without focusing the editor (or rather: the indexer is refocused).
    Enter or Ctrl+DblClick locates the match and focuses the editor.

Invoke Indexer from Explorer window

  • The Explorer Classes and Members views allow invoking the Source Indexer's "Search Identifier" and "Search Identifier in File" commands using the selected entity's name as input. Shortcuts default to Ctrl+Alt+Shift+S / F (identical to the defaults for the same commands in the IDE editor)

New search & display modes

  • Search Mode "Exact | Starts with | Contains | Ends with" allows specifying how the search text is located in the index.
  • The source indexer combines results if a single line contains multiple occurrences of the searched identifier. If there are multiple matches, the number of matches is displayed like so [3] after the line number.
  • Source indexer now uses IDE buffers when scanning. As a result, there's no need to save files before rebuilding the index. Also search matches are build using IDE buffers rather than read from disk.

Customizing the indexer

  • Source Indexer toolbar is customizable. Additional commands are available that are hidden by default.
  • Source Indexer toolbar shrink mode is customizable. Use the customize pop up menu to choose between Wrap and Chevron style.
  • Source Indexer auto hide status bar (check pop up menus). When auto-hide status bar is enabled, the status bar is only visible when (re-)building the index and automatically hidden as soon as the index is built or aborted. Default enabled.
  • Assign index to Search drop down list is now optional. If enabled (default), the index word list is assigned to the search edit drop down list after rebuilding the index. For large word lists this can take considerable time during which the IDE appears locked. Disabling this option improves responsiveness after rebuilding the index at the cost of not being able to view the scanned word list in the drop down. Note: the auto complete feature work in both cases.

Live Metrics

  • New live metric Check Long Lines. Emits hints for lines longer than a user definable number of columns. Long Lines can be a sign of code duplication or complex expressions. Usually long lines can be refactored using Extract Method or Add Explaining Variable.
  • New Live Metric: detect irregular line breaks. This will emit warning if a source file contains any other line breaks than the standard CRLF (0xD 0xA) sequences. In this case the Members view pop up menu shows the "Repair irregular line breaks" command which will normalize all breaks to CRLFs. This metric is always enabled.
  • New Pascal Metric: check with statements. Using with statements is sometimes considered a bad programming style as they can lead to invisible (future) scope problems.

Pascal new features

Extended parser and type operations.

  • The pascal parser supports nested types in Delphi 9 win32 mode. Also all non-class types (such as sets, aliases, meta class pointers etc) are now picked up and optionally displayed in the explorer.
  • The explorer members view displays contained (nested) types Code Explorer 5 screenshot controlled by 3 filters: container types (classes, interfaces etc.), delegates and plain function pointer types, and other (unhandled) types.
  • Unhandled types are not edited in detail, but can be renamed (invoking IntelliReplace) and cut/copy/pasted, moved up /down in rearrange modes etc. Much as you'd expect.
  • Members view allows multiple selecting types such as classes. For example: select "module" node in classes view and use members view to multiple select classes to cut/copy/delete etc.
  • Most operations on module members allow a mixture of types, procedures and uses clauses. This allows you to copy / paste classes, procedures and uses clauses at once.
  • Nested classes cannot be copied. Nested non-container types can be copied, but not when mixed with class members (methods, properties).
  • Create a function from a function pointer type (delegate without the "of object" keywords) by drag/drop / copy paste the function pointer on the module node. This creates a new procedure (function) based on the function pointer signature. Similar to the existing "create event/eventhandler from delegate" when dragging/copying a delegate type on a class.

Generic new Pascal features

  • Edit known modules: Code Explorer maintains a list of previously parsed modules and their contained types. Several features such as "Auto complete uses clause" and navigation use this information. To exclude a module, use the Edit modules command as found on Properties | Pascal | Editing (CodeGear IDEs) or Properties | General (VS IDEs). This opens up a list with modules. Unchecking a module clears the module type information and marks the module as disabled for future sessions.
  • Property navigation (Navigate up/down) now includes the property when cycling through access methods. (Down in implementations, Up in declarations)
  • Method navigation (Navigate up/down) now cycles through overloaded method declarations / implementations. Up in declaration or Down in implementation moves to next overloaded method.
  • The (existing) known modules dialog allows defining modules contained by packages that should be skipped by the auto complete uses clause feature. Check button Properties | Pascal | Editing | "Edit modules..." next to auto complete used units.
  • "Convert to const" inserts a new const section before rather than after an existing var section.
  • Pascal: Open Unit dialog now also displays *.inc files.
  • Pascal: Convert Field to Property in Members view now supports converting multiple selected fields at once.
  • Pascal: "Add Method" picks up parameter list from editor code. For example:
    procedure Sample.Something(const Value: string);
    var
      I: Integer;
    begin
      for I := 1 to 10 do
        AddThisMethod(I, Value); 
    end;
    Add Method invoked with the cursor somewhere in identifier AddThisMethod will suggest parameters I: Integer and Value: string for the new method. Picking up parameters works for types declared in the same module (unit), local variables and method parameters. Other types may not be recognized and are assumed "Integer". When used in an assignment statement, Add Method also tries to pick up the method return type. Note: Add procedure and Add Local procedure also try to pick up parameter lists.
  • Pascal: Add Field, Add Property, Add Local Var and Add Parameter try to pick up member type when invoked in an assignment statement.
  • Pascal: Paste Prototype available as IDE editor command.

Solved bugs C# and general

  • C#: constructor initializers would not accept the ternary operator "? :" Solved
  • C#: Destructor attributes and comments would not be associated with the destructor method. As a result sorting or moving the destructor could result in loss of attributes or documentation. Solved.
  • C#: Live Documentation would not save destructor comments. Solved
  • C#: constructor base / this calls would not accept array initializers as in base(new int[]{1,2,3}) . Solved
  • C#: implicit/ explicit operators would not accept array types. Solved.
  • C#: Displaying the class hierarchy for generic classes would fail to link a generic class to a derived constructed class. For example
    class IntList: List<int> {}
    would not show IntList as List<T> descendant. Similar problems would occur when navigating to generic ancestors - "Error: class List<int> not found.". Solved.
  • Documentation editors would show an error: "Cannot modify source for unknown module type". Solved.
  • Select default class would interfere with VS navigation commands -such as navigating from the class browser. Solved.
  • The splitter position would not be saved between sessions. Solved.
  • Restoring the explorer treeview state after reparsing could select the wrong node with the same name. For example a namespace ABC instead of the class ABC, or an interface reference ITest instead of the actual interface ITest. Solved
  • Reverse assignment would append a semi-colon, even if the original expression did not have one. Solved
  • Several minor memory leaks fixed.

Solved bugs Pascal

  • Rename Local would cause an AV when invoked on an entity that is not recognized by MMX (consts etc). Solved.
  • subrange types starting with a number literal were not recognized and caused parsing errors. Solved.
  • In certain cases changing visibility using the dialog for fields or methods that were followed by an empty line, would result in bad code. Solved.
  • Convert method to property could cause uncompilable code if the method had no / default visibility. Solved
  • A comment immediately following a class declaration would be erased when editing the class declaration. Solved.
  • An unterminated string in a region name would cause an unhandled exception, leaving the explorer window empty. Solved.
  • Matching Implicit and Explicit operator implementations with declarations could cause problems if operator parameter lists were identical. Solved.
  • In some (rare) cases "convert property to method" would place the method declaration outside the class interface. Solved.
  • Using a unit in a .dpr would create a new uses section instead of adding it to the existing one. Solved.
  • Void module procedures would not be displayed with a type image in the members view. Solved.