Custom Macros for HLASM
With the release of IBM Z Open Editor 4.2.0, custom macros are now supported for your HLASM programs. Macro libraries will be declared in your zapp.yaml
file and used to find your custom macros. All macros that are located in your macro library will now support hover, document links, and Go to Definition
. If a custom macro is found and used at least once in a program, it will also be available when using code completion and content assist.
Files that contain multiple macros are supported as well as single macro files. Currently, only local macro libraries are supported.
zapp.yaml
file
Declaring Macro Libraries in your To locate macros from your MACLIB, you need to create a new library in your ZAPP named maclib
.
The following ZAPP snippet shows a property group declaration for HLASM containing a MACLIB entry:
- name: hlasm-local
language: hlasm
libraries:
- name: maclib
type: local
locations:
- "**/ASMMAC"
You can declare any number of locations, but they need to be under the maclib
library to be scanned for macros.
Accessing Custom Macros from HLASM Programs
When the custom macros resolve correctly in your HLASM programs, you can see underlines (document links) appear under all the located custom macros in your program. You can hover over the macro to see the declaration and contents. If you want to directly access the macro, you can use Ctrl+Click
(Windows) or Cmd+Click
(Mac) to open it. Alternatively, you can right click and select Go to Definition
and the editor will take you directly to the line where that macro is declared.
The following gif shows this functionality:
Settings for Custom Macros
The following settings are added to support the new custom macros feature:
zopeneditor.hlasm.enableCustomMacrosWarnings
: This setting is enabled by default and will place warnings under all custom macros that cannot be found in your HLASM programs. Disable this setting if you do not want to see these warnings.zopeneditor.hlasm.reduceCustomMacroLogging
: This setting is disabled by default and will accelerate custom macro scanning performance at the cost of a reduced number of logs provided for the user. When the setting is disabled, you can debug and see which documents are being requested by the language server. Those document requests are not sent when the setting is enabled, allowing the language server to handle everything internally so that no communication is logged.