This Visual Studio Code extension provides syntax highlighting and code snippets for Eiffel language development.
Once installed, files with the .e extension will automatically activate the Eiffel syntax highlighting and snippet support.
The Eiffel language syntax is supported through a custom grammar definition. It highlights the following:
- Comments: Single-line comments start with
--
. Keywords: Keywords such asclass
,feature
,do
,end
,if
,else
,from
, and more are highlighted. - Variables: All variable names that follow standard Eiffel naming conventions are highlighted.
- Constants: Common constants like
True
,False
,Void
,Result
, andCurrent
are included. - String Literals: Double-quoted strings are highlighted, with escape sequences recognized within them.
- Numbers: Numeric constants are highlighted.
Modifiers: Keywords like
deferred
,expanded
, and storage modifiers are highlighted for better readability. - Class Definitions: The extension provides recognition for class structures, including inheritance and class-level declarations.
This extension comes with predefined snippets to boost your productivity when writing Eiffel code. Here are some of the snippets provided:
-
Assignment:
-
Quickly assign values with:
writable := expression
-
Attempt assignment:
writable ?= expression
-
-
Create Statements: For object creation, you can use:
create {TYPE} writable.default_create
-
Classes: You can create class templates using the following snippets:
-
Class:
class CLASS_NAME inherit create feature invariant end -- CLASS_NAME
-
Expanded Class:
expanded class CLASS_NAME inherit create feature invariant end -- CLASS_NAME
-
Deferred Class:
deferred class CLASS_NAME inherit feature invariant end -- CLASS_NAME
-
-
Variable Declarations:
-
Declare variables with:
variable: attached TYPE
-
For detachable variables:
variable: detachable TYPE
-
-
Conditions: Snippets for
inspect
andcheck
statements are available to quickly scaffold conditional logic:inspect expression when choice then instruction else instruction end
-
Assertions: Use the
check
snippet to verify assertions in your code:check assertion end
Enjoy coding in Eiffel with enhanced productivity!