Skip to content

Launch Mode

zero-plusplus edited this page Feb 8, 2022 · 39 revisions

This is a simple mode to debug the specified script.

Basic configuration

Name Type Description
name string The name of the settings. I recommend giving it a unique and easily understood name.
type string Specify "autohotkey". This is like the ID of the debug adapter to run. So its value is fixed.
request string Specify "launch".
runtime string The path to AutoHotkey.exe. If you specify a relative path, the current directory is C:/Program Files/AutoHotkey. Also extension(i.e. .exe) is optional.
e.g. "v2/AutoHotkey.exe", "${workspaceFolder}/AutoHotkey"
runtime_v1
runtime_v2
string Same as runtime, but useful if you want to specify different settings for different extensions. runtime_v1 corresponds to .ahk and runtime_v2 corresponds to .ahk2 or .ah2. If the runtime is set, it takes precedence.
default: "AutoHotkey.exe", "v2/AutoHotkey.exe"
runtimeArgs arary Most people don't need to change this setting. If you set it wrong, debugging may fail.

Arguments to pass to AutoHotkey.exe. You can see a description of the argument here, described as a Switch. However "/debug" will be ignored.
default: [ "/ErrorStdOut" ]. If possible [ "/ErrorStdOut=UTF-8"].
runtimeArgs_v1
runtimeArgs_v2
array Same as runtimeArgs, but useful if you want to specify different settings for different extensions. runtimeArgs_v1 corresponds to .ahk and runtimeArgs_v2 corresponds to .ahk2 or .ah2.
cwd string The absolute path of the current working directory. If not specified, the program directory will be set.
port number A port to be assigned to the debugger. Basically, you don't need to change it, but if you want to debug more than one at the same time, you need to set different ports for each.
default: 9002
string If a port is already in use, a confirmation message will appear asking if you want to use a different port. If this message is annoying, you can give the debug adapter permission to use the port using the "start-end" format.
e.g. "9002-9010"
program string The absolute path to the script you want to debug.
default: "${file}"
args array Arguments to be passed to program
env object Environment variable to be set during debugging. if set to null, it will be treated as an empty string.
stopOnEntry boolean If false, it runs until it break at a breakpoint. Set it to true if you want it to stop at the first line, as in SciTE4AutoHotkey.
default: false
maxChildren number The maximum number of child elements of the object to be retrieved. Basically, there is no need to change it.
default: 10000
openFileOnExit string The absolute path of the script you want to open when the debugging is finished. This is useful if you want to quickly edit a specific script.
e.g. "${file}"
useAutoJumpToError boolean Open the error source when debugging is terminated due to an load-time error. If you want it to work even with run-time errors, you need to use this library.
This takes precedence over openFileOnExit.
default: false
useAnnounce boolean Enable / disable announcements from the debug adapter.
default: true
string If "error" is specified, only errors will be displayed. If "detail" is specified, more detailed announcements will be displayed.
skipFiles array Note that the skipping process is technically slow, so if large loops are involved, there will be more than a few seconds of waiting time.

Array of absolute file or glob pattern paths to skip when executing steps. For detailed instructions, see here.
useLoadedScripts boolean Enable / disable Loaded Scripts. If disabled, the debug startup time will be faster.
default: true
object Advanced settings. See the following attributes for details.
default: true
useLoadedScripts.scanImplicitLibrary boolean It scans for implicitly used libraries and displays them in Loaded Scripts. However, it will slow down the start of debugging. This attribute also affects the debug directive.
default: true
skipFunctions array Note that the skipping process is technically slow, so if large loops are involved, there will be more than a few seconds of waiting time.

Array of functions names to skip when executing steps. For detailed instructions, see here.
extends string Specifies the `name` attribute of another configuration. Inherits all attributes of the matched configuration.

Advanced configuration

Name Type Description
useIntelliSenseInDebugging boolean Enable / disable IntelliSense in Debugging. If you have installed another extension that supports IntelliSense, it is recommended to disable this feature.
default: true
usePerfTips boolean Enable / disable PerfTips.
default: false
string Short hand for setting only .format.
e.g. "{{elapsedTime_s}}s elapsed."
object Advanced settings. See the following attributes for details.
usePerfTips.format string Content to be displayed. See the Log point's Embedding value for instructions on how to embed the variables.
e.g. "{{elapsedTime_s}}s elapsed."
usePerfTips.fontColor string Set the color of CSS.
e.g. "gray"
usePerfTips.fontStyle string Set the font-style of CSS.
e.g. "italic"
useDebugDirective boolean Note that if you enable, debug startup is slow.

Enable / disable Debug directive.
default: false
object Advanced settings. See the following attributes for details.
useDebugDirective.useBreakpointDirective boolean Enable / disable Breakpoint directive.
useDebugDirective.useOutputDirective boolean Enable / disable Output directive.
useDebugDirective.useClearConsoleDirective boolean Enable / disable ClearConsole directive.
useUIAVersion boolean If set to true, debugging of the UIA version of AutoHotkey will be possible. Unlike normal debugging, there are some limitations. Please check them here.
If you don't know about UIA, you don't need to worry about this setting.
default: false
useOutputDebug boolean Whether to display OutputDebug messages in the debug console.
object The attribute described below is a experimental version and its use may change in the future.

More detailed settings. See the following attributes for details.
useOutputDebug.category string Output message destination. Specifies "stdout", "stderr" or "console"
default: "stdout"
useOutputDebug.useTrailingLinebreak boolean Add a trailing linebreak. If the trailing line is a linebreak, do nothing.
default: false
variableCategories string Specifies "recommend". It divides data inspection groups into three categories: Local, Global, and Built-in Global.
Note that, the 0, 1, 2... variables that indicate script parametes will not be displayed. Please use A_Args instead.
array The [Category] and [Matcher] described below is a experimental version and its use may change in the future.

Specify an array of [Category] objects with the following attributes.

This is a very complex attribute, so practical examples are provided here.
[Category] string An object that represents a group of variables. It has the following attributes.
[Category].label string The label displayed in the group.
[Category].source string Specifies "Local", "Global".

If you are using AutoHotkey_H, additionally you can specify "Static".
array Array of strings that can be specified above.
[Category].hidden boolean Show / hide category.
string Specifies "auto". In this case, the category will be hidden if the variable to be displayed in category is 0.
[Category].noduplicate string Disallow / allow duplication with variables of different categories that have the same source.

This attribute can only be set for one of the categories that have the same source. Also, this attribute does not work if an array is specified in the source attribute.
[Category].matchers array An array of [Matcher] objects with the following attributes.
[Matcher] object An object representing a match condition. If multiple conditions are specified, all of them will be matched or not. It has the following attributes.
[Matcher].method string If the variable matching the condition is to be excluded, specify "exclude". On the other hand, if you want to include them, specify "include" or omit this attribute.
[Matcher].pattern string JavaScript RegExp patterns for variable name.
[Matcher].ignorecase boolean If true, [Matcher].pattern will ignore case.
[Matcher].type string The type name recognized by the debugger. See here for details.
[Matcher].className string The class name recognized by the debugger. For more information, see CLASSNAME here.
[Matcher].builtin boolean Whether it is a built-in variable or not.
[Matcher].static boolean Whether it is a static variable or not.