Previous Topic Next topic Print topic


Using Light Bulbs with COBOL

You can use the Visual Studio 2015 light bulb feature (light bulb) to quickly implement interfaces or add the USING directive.

Using light bulbs to implement interfaces

You can use the light bulb feature to implement interfaces in managed OO COBOL programs. To use them:

  1. Type the definition of the implementing class or value type:
    class-id MyClass implements type Interface

    At this stage the class does not implement the interface and you get an error at its name. Hover the error until the light bulb appears (light bulb).

  2. Click the light bulb to see the suggested fixes and click the command to implement the interface:

    Implement an interface

    This adds the missing interface members to the implementing class or value type.

Note: This does not support generic interfaces and does not add event members from an interface.

Using light bulbs to add the USING directive

When a type is specified without fully qualifying the namespace, use the light bulb feature to add the appropriate USING directive. For example, you want to use System.IO.Path::GetFullPath and you might only have the following defined in the local-storage section:

01 var1 type Path

You get an error message that Path is an unknown type in the Output window, and when you click the line for this declaration, the light bulb icon appears in the margin of the program on this line.

Hover Path until the light bulb appears then click the light bulb icon (light bulb) to see the suggested fixes. Choose the fix that applies to your code:

Resolving namespaces

Note: To use light bulbs, you must have background parsing turned on (default).
Previous Topic Next topic Print topic