Using .NET Code Assist

QuickSharp's C# language support provides a simple 'Code Assist' feature which allows program entities such as classes, methods, variables and namespaces to be listed for insertion into the editor. To see it in action open a C# source file and position the editing cursor after the '.' of a variable or class name. Press Ctrl+Space to invoke the Code Assist window; this will contain a list of the class or variable's type members. To select an item use double-click or the up/down cursor keys followed by Enter, the item will be inserted into the text at the editing location. To close the pop-up without making a selection press Escape or Backspace.

Using Code Assist

Code Assist can be used in several places within a program; here are a few examples. Type 'Console.Wri' and hit Ctrl+Space to see the member list, the first item beginning with 'Wri' will be pre-selected for insertion. After a 'using' directive hit Ctrl+Space to see a list of the available top-level namespaces; type 'System.' to see the available child namespaces, or type a few characters, such as 'System.Da', to jump to a specific namespace. You can also use Ctrl+Space at the beginning of a statement to see all the available classes and objects; try typing 'Con' and use it to find the Console class.

When class members are shown in the Code Assist pop-up each entry will also have a context menu which can be displayed by right-clicking the entry in the list. This menu will present the full signature of the method or class constructor selected; a signature can be inserted into the code by selecting the menu entry. The context menu will list all signatures for the selected item; if the item is overloaded all the overload signatures will be also be displayed. Whereas the main pop-up list will insert the method or constructor name only, the context menu will insert the fill signature complete with place-holder names for the parameters; replace these with values appropriate for your program.

For example, type 'Console.Write' and press Ctrl+Space. Right-click the entry for 'WriteLine' to display the overloaded methods; click one to insert it into your code. Now type 'String s = new String' and press Ctrl+Space. Right-click the entry for the String class to display its constructors. As before click one to insert the signature into your code.

Managing Code Assist

QuickSharp's .NET Code Assist uses reflection to scan compiled code for information on namespaces, classes and other Framework entities. This occurs at two levels; the Framework itself and local assemblies located in the workspace.

Code Assist for the Framework base class library is managed through the Code Assist page in the QuickSharp options editor; clicking the Manage button will open the reference namespaces editor from which namespaces can be selected or deselected for inclusion in Code Assist lookups.

'Reference' namespaces are used to locate Framework entities; if a namespace is enabled in the Code Assist configuration it will be available for lookups and the entities it contains can appear in the Code Assist pop-up window. By default, the System namespaces are included but additional namespaces can be enabled by ticking the appropriate box in the configuration editor.

The namespaces presented are those found in the Global Assembly Cache when QuickSharp was first started; any assemblies installed since then will not be included. To update the list use the Reload button to perform a fresh scan.

Assemblies not located in the global cache can be added directly using the Add File and Add Folder buttons in the namespace list editor. In each case the namespaces contained within the selected file or all the files in the selected folder will be added to the list.

When a namespace from the global cache is unselected it will remain in the reference list; any other namespace will be removed and must be restored to the list using the Add File/Folder buttons.

The Object Browser

The Object Browser presents a summary of the .NET types available to Code Assist in the form of a tree; navigate the tree nodes to view the contents of namespaces and assemblies. Type members are displayed in the centre pane with the properties of the currently selected entity visible in the property grid to the right (the property grid is hidden by default, use the toolbar button to make it visible).