mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-07 23:32:42 +01:00
Author:halw
Date:2009-01-09T22:13:57.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@156 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -7,60 +7,60 @@ So far we have tried to make sure that everything went smoothly. But in actual s
|
||||
==Levels of language description==
|
||||
|
||||
Let's remind ourselves first of how the language is specified. The book <span> [http://www.eiffel.com/doc/ Eiffel: The Language] </span>, the language reference, carefully distinguishes between three levels of description: '''syntax''', '''validity''' and '''semantics'''. Their roles are clearly distinct:
|
||||
* <span>Syntax</span> defines the structure of software texts. A typical syntax rule states that an assignment starts with a <code> Writable </code> entity, continues with the symbol <code> := </code>, and ends with an <code> Expression </code>. This is a purely structural specification, saying nothing for example about the types of the <code> Writable </code> and the <code> Expression </code>.
|
||||
* <span>Validity</span>, applicable only to syntactically legal texts, defines required consistency conditions. A typical validity rule states that in an assignment the right-hand-side <code> Expression </code> must <span>conform</span> -- a property of its type, defined rigorously on the basis of inheritance -- to the left-hand-side <code> Writable </code>. Eiffel has about 75 validity rules; part of the language's originality is that these rules are of the " <span>if and only if</span> " form, not only telling you individual error cases ("this is valid <span>only if</span> <span>...</span> ") but also reassuring you that your text will in fact be valid <span>if</span> it satisfies the conditions listed exhaustively.
|
||||
* Semantics, applicable only to valid texts, defines the software's expected run-time behavior. A typical semantic rule states that an assignment replaces the value of its left-hand-side <code> Writable </code> by the value of the right-hand-side <code> Expression </code> at the time the assignment is executed, with precise rules on the different possible cases involving references, objects and simple values.
|
||||
* <span>Syntax</span> defines the structure of software texts. A typical syntax rule states that an assignment starts with a <code>Writable</code> entity, continues with the symbol <code>:=</code>, and ends with an <code>Expression</code>. This is a purely structural specification, saying nothing for example about the types of the <code>Writable</code> and the <code>Expression</code>.
|
||||
* <span>Validity</span>, applicable only to syntactically legal texts, defines required consistency conditions. A typical validity rule states that in an assignment the right-hand-side <code>Expression</code> must <span>conform</span> -- a property of its type, defined rigorously on the basis of inheritance -- to the left-hand-side <code>Writable</code>. Eiffel has about 75 validity rules; part of the language's originality is that these rules are of the " <span>if and only if</span> " form, not only telling you individual error cases ("this is valid <span>only if</span> <span>...</span> ") but also reassuring you that your text will in fact be valid <span>if</span> it satisfies the conditions listed exhaustively.
|
||||
* Semantics, applicable only to valid texts, defines the software's expected run-time behavior. A typical semantic rule states that an assignment replaces the value of its left-hand-side <code>Writable</code> by the value of the right-hand-side <code>Expression</code> at the time the assignment is executed, with precise rules on the different possible cases involving references, objects and simple values.
|
||||
|
||||
You may make an error at any of these levels:
|
||||
* Writing <code> = </code> instead of <code> := </code> for the assignment symbol is a syntax error.
|
||||
* Writing <code> your_integer </code> <code> := </code> <code> your_real </code>, with the types suggested by the names, is a validity error.
|
||||
* Writing <code>=</code> instead of <code>:=</code> for the assignment symbol is a syntax error.
|
||||
* Writing <code>your_integer</code> <code>:=</code> <code>your_real</code>, with the types suggested by the names, is a validity error.
|
||||
* Calling a feature on a void target, violating a precondition, causing a division by zero, are semantic errors.
|
||||
|
||||
Syntax and validity errors will be detected by the compilation process. For semantic errors, you will rely on contract checking and on the debugging tools described later. Let's look now at examples of the first two cases.
|
||||
</div><div>
|
||||
==A syntax error==
|
||||
|
||||
To see what happens for a syntax error, replace the keyword <code> is </code> by <code> ist </code> in the first line of routine <code> display </code> of class <code> PARENT </code> (click the position immediately after the <code> s </code> and type a <code> t </code>.). Save the file by clicking the Save button or using CTRL- <code> S </code> and then compile the system.
|
||||
To see what happens for a syntax error, replace the keyword <code>is</code> by <code>ist</code> in the first line of routine <code>display</code> of class <code>PARENT</code> (click the position immediately after the <code>s</code> and type a <code>t</code>.). Save the file by clicking the Save button or using CTRL- <code>S</code> and then compile the system.
|
||||
|
||||
[[Image:index-75]]
|
||||
|
||||
To correct the error, just bring the mouse back to its location, remove the spurious <code> t </code>, and click Save again; also click Compile to make sure that the project is recompiled up-to-date.
|
||||
To correct the error, just bring the mouse back to its location, remove the spurious <code>t</code>, and click Save again; also click Compile to make sure that the project is recompiled up-to-date.
|
||||
|
||||
You may wonder why the syntax error messages are not a little more verbose than just <code> Syntax error </code>. The reason is merely that Eiffel's syntax, being simple and regular, does not require sophisticated error messages; syntax errors usually result from trivial oversights. If you make a syntax error and the reason is not immediately clear, check the syntax summary in the appendix of <span> [http://www.eiffel.com/doc/ Eiffel: The Language] </span>.
|
||||
You may wonder why the syntax error messages are not a little more verbose than just <code>Syntax error</code>. The reason is merely that Eiffel's syntax, being simple and regular, does not require sophisticated error messages; syntax errors usually result from trivial oversights. If you make a syntax error and the reason is not immediately clear, check the syntax summary in the appendix of <span> [http://www.eiffel.com/doc/ Eiffel: The Language] </span>.
|
||||
</div><div>
|
||||
==A validity error==
|
||||
|
||||
A validity error is a violation of one of the validity constraints given in <span> [http://www.eiffel.com/doc/ Eiffel: The Language] </span>. Every such constraint is identified by a four-letter code of the form <code> V </code> <code> XXX </code> (the first letter is always <code> V </code>).
|
||||
A validity error is a violation of one of the validity constraints given in <span> [http://www.eiffel.com/doc/ Eiffel: The Language] </span>. Every such constraint is identified by a four-letter code of the form <code>V</code> <code>XXX</code> (the first letter is always <code>V</code>).
|
||||
|
||||
A validity error will produce a precise error message, which includes the validity code. Although short, the error message is usually sufficient to find out what the error is. If not, you can get the complete rule, straight from the book.
|
||||
|
||||
To see this mechanism at work, let us introduce a validity error. There is in fact one ready for you in class <code> TESTROOT </code>. Target a Development Window to this class; at the end of its text, just before the final <code> end </code>, you will find the following comment line:
|
||||
To see this mechanism at work, let us introduce a validity error. There is in fact one ready for you in class <code>TESTROOT</code>. Target a Development Window to this class; at the end of its text, just before the final <code>end</code>, you will find the following comment line:
|
||||
<code>
|
||||
-- inv: INVALID;</code>
|
||||
|
||||
If uncommented, this is a declaration of a feature of type <code> INVALID </code>. A class called <code> INVALID </code> indeed exists in file <code> invalid.e </code> of the root cluster, but it contains a validity error. To see what it is, remove the initial double-dash <code> -- </code> in the above line from class <code> TESTROOT </code> so that it is not a comment any more.
|
||||
If uncommented, this is a declaration of a feature of type <code>INVALID</code>. A class called <code>INVALID</code> indeed exists in file <code>invalid.e</code> of the root cluster, but it contains a validity error. To see what it is, remove the initial double-dash <code>--</code> in the above line from class <code>TESTROOT</code> so that it is not a comment any more.
|
||||
|
||||
[[Image:index-76]]
|
||||
|
||||
Click <code> Save </code>, then <code> Compile </code>. Compilation starts but after a few degrees it stops with an error message that appears in the bottom Context Tool (you may have to do some resizing to see it in its entirety):
|
||||
Click <code>Save</code>, then <code>Compile</code>. Compilation starts but after a few degrees it stops with an error message that appears in the bottom Context Tool (you may have to do some resizing to see it in its entirety):
|
||||
|
||||
[[Image:index-77]]
|
||||
|
||||
As the error message indicates, you have (shame on you) violated the validity rule <code> VUAR </code>, which requires the number and types of actual arguments in a routine call to match the number and types of formal arguments declared in the routine.
|
||||
As the error message indicates, you have (shame on you) violated the validity rule <code>VUAR</code>, which requires the number and types of actual arguments in a routine call to match the number and types of formal arguments declared in the routine.
|
||||
|
||||
One of the interesting properties of the error message is that everything in color is '''clickable''' : class name, feature name, but also the error code. This means that you can start a Pick-and-Drop on any of these elements to find out more.
|
||||
|
||||
For example, to see the exact context of the error, pick-and-drop the name of the affected feature, <code> display </code> -- appearing on the fifth non-blank line, after <code> Feature: </code> -- and pick-and-drop it to the top Text window. (As you remember this means: right-click on it and release; move the mouse to the text window, without clicking any button; right-click again. During the move the cursor shows a cross, the symbol for features.) This displays the erroneous feature:
|
||||
For example, to see the exact context of the error, pick-and-drop the name of the affected feature, <code>display</code> -- appearing on the fifth non-blank line, after <code>Feature:</code> -- and pick-and-drop it to the top Text window. (As you remember this means: right-click on it and release; move the mouse to the text window, without clicking any button; right-click again. During the move the cursor shows a cross, the symbol for features.) This displays the erroneous feature:
|
||||
|
||||
[[Image:index-78]]
|
||||
|
||||
Note on this display a special property of Pick-and-Drop when its source is a feature name appearing in a validity error message: the instruction that causes the error is highlighted.
|
||||
|
||||
In the error message in the Context Tool, the error code itself, <code> VUAR </code>, is also clickable. Assuming the message was not sufficient to understand the error, you can use it to start a Pick-and-Drop. Do this now, by picking that code and starting to move the mouse, but not dropping yet:
|
||||
In the error message in the Context Tool, the error code itself, <code>VUAR</code>, is also clickable. Assuming the message was not sufficient to understand the error, you can use it to start a Pick-and-Drop. Do this now, by picking that code and starting to move the mouse, but not dropping yet:
|
||||
|
||||
[[Image:index-79]]
|
||||
|
||||
The icon shape for such information elements is a question mark <code> ? </code>. If it is not on a droppable target, as in the bottom Context Tool, that icon will be crossed. In principle the place to drop is the Explanation hole in the Project toolbar, the only one that remains highlighted during the Move step of Pick-and-Drop:
|
||||
The icon shape for such information elements is a question mark <code>?</code>. If it is not on a droppable target, as in the bottom Context Tool, that icon will be crossed. In principle the place to drop is the Explanation hole in the Project toolbar, the only one that remains highlighted during the Move step of Pick-and-Drop:
|
||||
|
||||
[[Image:index-80]]
|
||||
|
||||
@@ -70,8 +70,8 @@ As is often the case when dropping into a specific hole, you don't need to shoot
|
||||
|
||||
The result is to display the complete text of the violated rule, straight from the pages of <span> [http://www.eiffel.com/doc/ Eiffel: The Language] </span>.
|
||||
|
||||
The rule has several clauses, numbered. Since the error message showed the error code as <code> VUAR(1) </code>, the violated clause is the first; this convention of showing the clause number in parentheses applies to all multi-clause validity constraints.
|
||||
The rule has several clauses, numbered. Since the error message showed the error code as <code>VUAR(1)</code>, the violated clause is the first; this convention of showing the clause number in parentheses applies to all multi-clause validity constraints.
|
||||
|
||||
To correct the error the easiest is to go back to class <code> TESTROOT </code> and reinstate the comment symbol <code> -- </code> (two consecutive dashes) on the erroneous line. Save and compile to continue with a valid system.
|
||||
To correct the error the easiest is to go back to class <code>TESTROOT</code> and reinstate the comment symbol <code>--</code> (two consecutive dashes) on the erroneous line. Save and compile to continue with a valid system.
|
||||
</div>
|
||||
|
||||
|
||||
@@ -18,15 +18,15 @@ Make sure that the Editing Tool is big enough to display the text of the class:
|
||||
|
||||
The Editing Tool hosts a text editor which you can use to change the class text. Here the routine <code>display</code> starts by outputting a simple message; let's precede it by another line of display to check that we affected the outcome. We'll want to add the following two lines just after the <code>do</code>, before the first two instructions of the routine:
|
||||
<code>
|
||||
io.put_string ("This is some more added text")
|
||||
io.new_line
|
||||
io.put_string ("This is some more added text")
|
||||
io.new_line
|
||||
</code>
|
||||
|
||||
They are very similar to the current first two lines of the routine, so you can just use copy-paste: select the first two lines with the mouse, copy them using CTRL- <code>C</code> (or <code>Copy</code> from the <code>Edit</code> menu), then paste them just after the <code>do</code> using CTRL- <code>V</code> (or <code>Paste</code> from the <code>Edit</code> menu). Add or remove tabs to align with the rest of the routine, and change the string to <code>THIS IS SOME MORE ADDED TEXT</code> so that the result will look like what's shown on the next figure. This is all there is to change; the second line remains untouched. Please check the result and be careful not to introduce any mistakes; in the next section we'll study how EiffelStudio will report syntax and other errors, but right now we want to see what happens when everything is right!
|
||||
They are very similar to the current first two lines of the routine, so you can just use copy-paste: select the first two lines with the mouse, copy them using <code>CTRL-C</code> (or <code>Copy</code> from the <code>Edit</code> menu), then paste them just after the <code>do</code> using <code>CTRL-V</code> (or <code>Paste</code> from the <code>Edit</code> menu). Add or remove tabs to align with the rest of the routine, and change the string to <code lang=text>THIS IS SOME MORE ADDED TEXT</code> so that the result will look like what's shown on the next figure. This is all there is to change; the second line remains untouched. Please check the result and be careful not to introduce any mistakes; in the next section we'll study how EiffelStudio will report syntax and other errors, but right now we want to see what happens when everything is right!
|
||||
|
||||
[[Image:index-67]]
|
||||
|
||||
Now save your changes; you may indifferently use CTRL- <code>S</code>, the <code>Save</code> entry from the <code>Edit</code> menu, or the Save button highlighted on the figure. (If you forget to save, the next compilation will tell you so, and ask you if from now on you want all non-saved class edits to be saved automatically.)
|
||||
Now save your changes; you may indifferently use <code>CTRL-S</code>, the <code>Save</code> entry from the <code>Edit</code> menu, or the Save button highlighted on the figure. (If you forget to save, the next compilation will tell you so, and ask you if from now on you want all non-saved class edits to be saved automatically.)
|
||||
</div><div>
|
||||
==Recompiling and executing after a change==
|
||||
|
||||
@@ -46,34 +46,44 @@ The editing facilities in the Editing Tool are provided by the EiffelStudio Edit
|
||||
|
||||
The online documentation provides many more details about editing functions. Here are the essentials.
|
||||
|
||||
First, the key property of any interactive system: '''Undo'''. You can cancel the latest editing command, or any earlier one performed during the current session, by choosing <code>Undo</code> from the <code>Edit</code> menu, or typing CTRL- <code>Z</code>. To cancel more than one command, apply Undo repetitively; there is no limit to the number of undoable commands within a session. (When you exit EiffelStudio, however, the editing history is lost.) To redo an undone command, use <code>Redo</code> from the <code>Edit</code> menu or CTRL- <code>Y</code>.
|
||||
First, the key property of any interactive system: '''Undo'''. You can cancel the latest editing command, or any earlier one performed during the current session, by choosing <code>Undo</code> from the <code>Edit</code> menu, or typing <code>CTRL-Z</code>. To cancel more than one command, apply <code>Undo</code> repetitively; there is no limit to the number of undoable commands within a session. (When you exit EiffelStudio, however, the editing history is lost.) To redo an undone command, use <code>Redo</code> from the <code>Edit</code> menu or <code>CTRL-Y</code>.
|
||||
|
||||
{{note|Since right now we don't need to do any actual editing to continue this Guided Tour, we suggest that you don't change the text of class <code>PARENT</code> but simply look up the menu entries described next, without actually selecting them. If you do make a change, voluntary or not, you should at the end of this editor discussion perform enough Undo commands to get the text of class <code>PARENT</code> back to its original state. }}
|
||||
|
||||
To '''copy''', '''cut''' and '''paste''' use the corresponding entries in the <code>Edit</code> menu or the familiar keyboard shortcuts CTRL- <code>C</code>, CTRL- <code>X</code> and CTRL- <code>V</code>.
|
||||
To '''copy''', '''cut''' and '''paste''' use the corresponding entries in the <code>Edit</code> menu or the familiar keyboard shortcuts <code>CTRL-C</code>, <code>CTRL-X</code> and <code>CTRL-V</code>.
|
||||
|
||||
When you edit text, it will be automatically '''indented''' according to standard Eiffel style rules. If you prefer to remain in charge of your own indenting, you can disable this facility through <code>Tools</code> <code>--></code> <code>Preferences</code> <code>--></code> <code>Editor</code>.
|
||||
When you edit text, it will be automatically '''indented''' according to standard Eiffel style rules. If you prefer to remain in charge of your own indenting, you can disable this facility through
|
||||
<code lang=text>
|
||||
Tools --> Preferences --> Editor</code>
|
||||
|
||||
To indent a sequence of lines, select the lines, then use <code>Edit</code> <code>--></code> <code>Advanced</code> <code>--></code> <code>Indent selection</code>. You can also use the Tab key, but only if the selection consists of one or more entire lines; otherwise typing Tab will simply replace the selected text with a Tab character. Shift-Tab will similarly decrease indentation by one step.
|
||||
To indent a sequence of lines, select the lines, then use
|
||||
<codeang=text>
|
||||
Edit --> Advanced --> Indent selection</code>
|
||||
You can also use the Tab key, but only if the selection consists of one or more entire lines; otherwise typing Tab will simply replace the selected text with a Tab character. Shift-Tab will similarly decrease indentation by one step.
|
||||
|
||||
To '''comment out''' a sequence of lines, select them and use <code>Edit</code> <code>--></code> <code>Advanced</code> <code>--></code> <code>Comment</code> or CTRL- <code>K</code>. Conversely, CTRL-Shift- <code>K</code> will uncomment. Also in the <code>Edit</code> <code>--></code> <code>Advanced</code> menu are "set to upper case", with the keyboard shortcut CTRL- <code>U</code>, and to lower case, CTRL-Shift- <code>U</code>.
|
||||
To '''comment out''' a sequence of lines, select them and use
|
||||
<code lang=text>
|
||||
Edit --> Advanced --> Comment</code>
|
||||
or <code>CTRL-K</code>. Conversely, <code>CTRL-Shift-K</code> will uncomment. Also in the <code lang=text>Edit --> Advanced</code> menu are "set to upper case", with the keyboard shortcut <code>CTRL-U</code>, and to lower case, <code>CTRL-Shift-U</code>.
|
||||
|
||||
Other useful facilities of the <code>Edit</code> <code>--></code> <code>Advanced</code> menu are:
|
||||
* <code>Embed in "if"</code>, or CTRL- <code>I</code>, which will create a conditional instruction and include the selected instructions in it.
|
||||
* <code>Embed in "debug"</code>, CTRL- <code>D</code>, which will include the selected instructions in a <code>debug</code> <span>...</span> <code>end</code> instruction, so that their execution becomes conditional on a Debug compilation option.
|
||||
Other useful facilities of the <code lang=text>Edit --> Advanced</code> menu are:
|
||||
* <code>Embed in "if"</code>, or <code>CTRL-I</code>, which will create a conditional instruction and include the selected instructions in it.
|
||||
* <code>Embed in "debug"</code>, <code>CTRL-D</code>, which will include the selected instructions in a <code>debug</code> <span>...</span> <code>end</code> instruction, so that their execution becomes conditional on a Debug compilation option.
|
||||
<div>
|
||||
==Search and replace==
|
||||
|
||||
The editor lets you search for text and replace occurrences, individually or globally. We assume you have seen a text search facility before, so we'll just emphasize some of the less obvious features.
|
||||
|
||||
To start a search, make sure the Search Tool is active by clicking the Search button in the top toolbar (this one we'll let you find) or using the <code>Edit</code> <code>--></code> <code>Find</code> menu entry.
|
||||
To start a search, make sure the Search Tool is active by clicking the Search button in the top toolbar (this one we'll let you find) or using the <code lang=text>Edit --> Find</code> menu entry.
|
||||
|
||||
{{note|that although we are studying Search as part of the Editor, this function also applies to any textual form displayed in the Context Tool; make sure to start a Search from the tool that you want to search.'' }}
|
||||
|
||||
{{note|If you press CTRL - <code>F</code> in a tool you will get a quick search bar that quickly allows to search for something in the current text.}}
|
||||
{{note|If you press <code>CTRL-F</code> in a tool you will get a quick search bar that quickly allows to search for something in the current text.}}
|
||||
|
||||
The Search Tool presents a number of self-explanatory options:
|
||||
|
||||
|
||||
|
||||
[[Image:index-69]]
|
||||
|
||||
You can enter a term to replace your search term in the <code>Replace with</code> box.
|
||||
@@ -84,7 +94,10 @@ The <code>Search for</code> field has an associated drop-down list, so that you
|
||||
</div><div>
|
||||
==Let the editor do the typing==
|
||||
|
||||
Particularly interesting are the editor's '''automatic completion''' facilities. Well, particularly interesting for <span>most</span> people: maybe you like your editor to do the grunt work for you, or maybe you don't. In the latter case -- if you prefer to be in control of all the details -- don't worry: through <code>Tools</code> <code>--></code> <code>Preferences</code> <code>--></code> <code>Editor</code> you can easily disable any facility that you don't like. The behavior described here is the default.
|
||||
Particularly interesting are the editor's '''automatic completion''' facilities. Well, particularly interesting for <span>most</span> people: maybe you like your editor to do the grunt work for you, or maybe you don't. In the latter case -- if you prefer to be in control of all the details -- don't worry: through
|
||||
<code lang=text>
|
||||
Tools --> Preferences --> Editor</code>
|
||||
you can easily disable any facility that you don't like. The behavior described here is the default.
|
||||
|
||||
The EiffelStudio Editor knows about Eiffel syntax and will recognize syntactic elements as you type them. It will color them according to standard conventions: basic elements in black, keywords in blue, comments in dark red. You can change these conventions through Preferences.
|
||||
|
||||
@@ -100,35 +113,41 @@ To start a routine, type the routine name followed by the keyword <code>is</code
|
||||
|
||||
This prompts you to enter the header comment (no self-respecting Eiffel developer even <span>thinks</span> of writing a feature without a header comment). At the end of the header comment, type Return if the header comment continues, otherwise type a down arrow to continue with the indentation for the beginning of the routine, with one of the keywords <code>require</code>, <code>local</code>, <code>do</code>, <code>external</code>, <code>once</code>. Once you type <code>do</code>, followed by a Return or space, the completion mechanism will insert the appropriate <code>end</code>, but other than that it doesn't try to produce an entire routine structure because there are too many syntactical choices (precondition or not, postcondition or not, locals or not etc.).
|
||||
|
||||
Also interesting is '''feature completion''', using the '''CTRL-SPACE''' key. It works at two levels:
|
||||
* You can type the beginning of the name of a feature of the current class, then CTRL-SPACE to get possible completions.
|
||||
* Once you have typed the name of a query (attribute or function), either all by yourself or aided by the previous completion technique, you can type a period followed by CTRL-SPACE to get the list of possible features to be applied, deduced from the list of features in the corresponding class (the type of the query).
|
||||
Also interesting is '''feature completion''', using the <code>CTRL-SPACE</code> key. It works at two levels:
|
||||
* You can type the beginning of the name of a feature of the current class, then <code>CTRL-SPACE</code> to get possible completions.
|
||||
* Once you have typed the name of a query (attribute or function), either all by yourself or aided by the previous completion technique, you can type a period followed by <code>CTRL-SPACE</code> to get the list of possible features to be applied, deduced from the list of features in the corresponding class (the type of the query).
|
||||
|
||||
In both cases, if more than one completion is possible, you will get a menu of the possibilities. You can scroll through it with the up and down arrow keys, or the mouse, and select one through Enter or double-click. You can also or give up through the Escape key.
|
||||
|
||||
Here for example is the menu you will see in the body of our example routine if you type <code>io</code> <span>. </span> followed by CTRL-SPACE, where <code>io</code> is the feature, coming from class <code>ANY</code>, that provides access to standard input and output facilities:
|
||||
Here for example is the menu you will see in the body of our example routine if you type <code>io.</code> followed by <code>CTRL-SPACE</code>, where <code>io</code> is the feature, coming from class <code>ANY</code>, that provides access to standard input and output facilities:
|
||||
|
||||
[[Image:index-73]]
|
||||
|
||||
The following properties enhance the convenience of the completion mechanisms:
|
||||
* If only one completion is possible, no menu appears; the completion is selected.
|
||||
* If the cursor is just after the name of a query (which you have fully typed, or obtained through completion), typing CTRL-SPACE once more will produce a period, as if you had typed it.
|
||||
* When a menu of possible completions is displayed, typing CTRL-SPACE will select the first of them.
|
||||
* If the cursor is just after the name of a query (which you have fully typed, or obtained through completion), typing <code>CTRL-SPACE</code> once more will produce a period, as if you had typed it.
|
||||
* When a menu of possible completions is displayed, typing <code>CTRL-SPACE</code> will select the first of them.
|
||||
|
||||
The combination of these facilities means that you can often obtain what you want simply by typing CTRL-SPACE repeatedly.
|
||||
|
||||
Also note the following properties of automatic feature completion:
|
||||
* The mechanism will only work for queries that were present at the time of the last successful compilation. So if you add an attribute, say <code>attr</code>, to the current class, and do not recompile, typing <code>a</code> -CTRL-SPACE will not display <code>attr</code>. To make sure that it's included in completion proposals, save and recompile. (Remember, incremental compilation is fast in EiffelStudio, so there is nothing wrong in compiling early and often.) The same rule holds for features of <span>other</span> classes, those that will appear in proposed completions after a period.
|
||||
* The mechanism will only work for queries that were present at the time of the last successful compilation. So if you add an attribute, say <code>attr</code>, to the current class, and do not recompile, typing <code>a</code> then <code>CTRL-SPACE</code> will not display <code>attr</code>. To make sure that it's included in completion proposals, save and recompile. (Remember, incremental compilation is fast in EiffelStudio, so there is nothing wrong in compiling early and often.) The same rule holds for features of <span>other</span> classes, those that will appear in proposed completions after a period.
|
||||
* Automatic completion is applicable to features, not local entities or formal arguments.
|
||||
* The features proposed for automatic completion include all features of the class: those declared in the class itself, or <span>immediate</span> features, and those <span>inherited</span> from proper ancestors, direct or indirect, with one exception: by default the list will not include features from the universal class <code>ANY</code>, which serves as ancestor to all classes and provides many features for comparison, copying, input-output, reflection etc. Including <code>ANY's</code> features would clutter all menus with too many features. So for example typing <code>i</code> followed by CTRL-SPACE will not suggest <code>io</code> among the possible completions. You can change this policy through Preferences. The policy does not apply to remote feature completion for an entity <code>x</code> declared of type <code>ANY</code> : typing CTRL-SPACE after <code>x</code> <span>. </span> will produce the list of <code>ANY</code> 's features.
|
||||
* The features proposed for automatic completion include all features of the class: those declared in the class itself, or <span>immediate</span> features, and those <span>inherited</span> from proper ancestors, direct or indirect, with one exception: by default the list will not include features from the universal class <code>ANY</code>, which serves as ancestor to all classes and provides many features for comparison, copying, input-output, reflection etc. Including <code>ANY's</code> features would clutter all menus with too many features. So for example typing <code>i</code> followed by <code>CTRL-SPACE</code> will not suggest <code>io</code> among the possible completions. You can change this policy through Preferences. The policy does not apply to remote feature completion for an entity <code>x</code> declared of type <code>ANY</code> : typing <code>CTRL-SPACE</code> after <code>x.</code> will produce the list of <code>ANY</code>'s features.
|
||||
|
||||
==Using your own editor==
|
||||
|
||||
You may have a favorite editor and prefer to use it, at least in some cases. The EiffelStudio incremental compilation mechanism, to be studied shortly, recognizes that files have been modified outside of EiffelStudio (by checking their time stamps) and will without any fuss take their modified versions into account.
|
||||
|
||||
You can also call an outside editor on a class from within EiffelStudio. Just use <code>File</code> <code>--></code> <code>External editor</code> or the corresponding button in the top toolbar.
|
||||
You can also call an outside editor on a class from within EiffelStudio. Just use
|
||||
<code lang=text>
|
||||
File --> External editor</code>
|
||||
or the corresponding button in the top toolbar.
|
||||
|
||||
This will call the editor of your choice. The default is Notepad on Windows and Vi on Unix and Linux. You can easily change this to any editor by entering the desired editor command in <code>Tools</code> <code>--></code> <code>Preferences</code> <code>--></code> <code>Global Preferences</code>. In this command text you can use the two special notations <code>$target</code> and <code>$line</code> ; when EiffelStudio calls the selected command, it will replace any occurrence of <code>$target</code> by the name of the file where the current class resides, and <code>$line</code> by the line number at which the Editing Tool is currently scrolled. If you include one or both of these markers at the appropriate argument positions for the command, this will enable you -- assuming the editor supports the appropriate options -- to make sure it starts at exactly the right place. For example the default editor command under Unix is
|
||||
This will call the editor of your choice. The default is Notepad on Windows and Vi on Unix and Linux. You can easily change this to any editor by entering the desired editor command in
|
||||
<code lang=text>
|
||||
Tools --> Preferences --> Global Preferences</code>
|
||||
In this command text you can use the two special notations <code>$target</code> and <code>$line</code> ; when EiffelStudio calls the selected command, it will replace any occurrence of <code>$target</code> by the name of the file where the current class resides, and <code>$line</code> by the line number at which the Editing Tool is currently scrolled. If you include one or both of these markers at the appropriate argument positions for the command, this will enable you -- assuming the editor supports the appropriate options -- to make sure it starts at exactly the right place. For example the default editor command under Unix is
|
||||
<code>
|
||||
vi +$line $target</code>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user