ALFA in VSCode

ALFA includes a VSCode Plugin that can be installed on your VSCode Editor to help work with ALFA model files. This guide shows you how to get the editor installed.

Prerequisites:

Mandatory

  • VS Code version 1.51.* or higher

  • To verify, open the VSCode Help menu, and select About.

  • Java 1.8 or higher.

  • To verify, open a Command window, and type

    c:\> java -version
    java version "1.8.0_202"
    

Optional

  • Python 3.7 or higher - required only for running ALFA test cases
  • To verify, open a Command window, and type python –version
c:\> python --version
Python 3.7.0

Installation Steps

  • Download and install the ALFA distribution

    • Prepare local install folder:

      Run the 4 commands below on a Windows Command window. These will:

      • Create a new directory alfa

      • Update the user’s system path to include alfa

      • Open Windows Explorer in the newly created directory.

        On windows, %LOCALAPPDATA% is an alias to the path C:\Users\< username >\AppData\Local. The full path to the new directory will be C:\Users\< username >\AppData\Local\alfa

        mkdir %LOCALAPPDATA%\alfa
        setx ALFA_HOME=%LOCALAPPDATA%\alfa
        setx PATH=%PATH%;%ALFA_HOME%\bin
        explorer %LOCALAPPDATA%\alfa
        
    • Download http://alfa-lang.io/downloads/AlfaPackage-3.4.0.zip and extract the contents to the newly created %LOCALAPPDATA%\alfa directory.

    • Save the supplied alfa-license.txt file in the new %LOCALAPPDATA%\alfa directory. You would have been emailed this file by Schemarise Ltd, if not please contact us.

      On Windows Explorer, your folder should appear like the following.

      ALFA Directory

    • Confirm ALFA has installed correctly by opening a new Command window, and type alfa -h and hit Enter.

      c:\> alfa -h
      
      ALFA Command Line Interface  v3.4.0
      ...
      
 
 
  • Install the ALFA VS Code Plugin

    Open the Extensions view on VSCode (circled in red on the right), and select Install from VSIX … from the context menu.

    VSCodePlugin

    Browse and select the 2 files below, and select Install.

C:\Users\<user>\AppData\Local\alfa\dist\alfa-3.4.0.vsix
C:\Users\<user>\AppData\Local\alfa\dist\alfa-assistant-3.4.0.vsix

Once installed, the ALFA extension will appear in the list of supported extensions in VS Code.

Note: For step by step instructions from VsCode see : https://code.visualstudio.com/docs/editor/extension-gallery#_install-from-a-vsix

ALFA Editor Features

  1. Complete outline of the UDTs defined in the currently opened file along with their fields or methods in the case for service.
  2. Syntax highlighting on all keywords, datatypes etc.
  3. Errors and warning highlighted.
  4. The count of errors identified is identified against definitions.
  5. Smart tooltips - not simply static HTML. Some types such as table will show expanded columns for the table.
  6. Documentation against a target type will be shown as tooltip.

Right-click on any .alfa file and open ALFA Studio to get access to further tools that work alongside the Editor.