Ruby In Steel ArchivesBack to Ruby In Steel Archives
The Editor and Console
Here is a short guide to some of Steel’s features for programming Ruby in Visual Studio...
CREATING A PROJECT
Once you create a new solution (as explained in our Two Minute Guide), you can use the Visual Studio Solution Explorer as a project organiser. This lets you create multiple ‘Project Groups’ of your Ruby files. You can collapse and expand the branches of each project and copy files between different project groups.
Add New or Existing Items
To create a new Ruby program file, right-click the Solution Explorer and select Add Item. You can then select a program template from a dialog box. To add an existing program file from disk, select Add Existing Item.
THE CODE EDITOR
Steel automatically colours Ruby language elements including keywords, comments and data types such as strings, floats and integers
Steel outlines your code so that you can selectively hide code block such as classes, modules, methods. Click the + or - symbols to toggle code collapsing. Hover your mouse to see the hidden code in a tooltip.
Optional ‘mark and collapse areas’
If code blocks aren’t automatically outlined, you can mark and collapse any code you wish using the mouse. This lets you hide ‘free standing’ code areas or comment blocks, for example.
Mark a block of code and click the Comment button to comment out the block. To uncomment a block, click the Uncomment button.
Steel has automatic bracket matching. Scroll your cursor over a bracket in order to highlight a pair of matching brackets. Press CTRL-] to move the cursor quickly from one matching bracket to another.
You can run the currently selected Ruby program file inside an interactive console window (above)...
...alternatively you may run your programs in a popup (’DOS-box’) command window’.
To run in the console window...
Press CTRL+F5 or CTRL+2 or...
Click the Green Arrow in the Visual Studio Toolbar or...
Select the Tools menu then Ruby Run
To run in a command window...
Press CTRL+1 or...
Select the Tools menu then Ruby Command
Fixing Syntax Errors
One or more syntax error messages may be displayed in the Error List pane...
...as well as in the interactive Ruby console:
To locate the problem lines in the editor, double-click the error message. Your cursor will be placed on the problem line in the code editor.
Other Editing Features...
Steel supports most of the editing features you’ve come to expect in Visual Studio, including:
Drag and drop cut, copy and paste
Toggle Bookmark on selected line (CTRL+B, T)
Find/Replace (with regular expressions)
The environment can be customised in a variety of ways. For example, you can:
Change syntax colouring
View Line Numbers
Dock the Console Window