Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setBreakpoints attribute in launch.json #266

Open
Tracked by #214
zero-plusplus opened this issue Dec 6, 2022 · 1 comment
Open
Tracked by #214

Add setBreakpoints attribute in launch.json #266

zero-plusplus opened this issue Dec 6, 2022 · 1 comment
Labels
draft Draft of new features enhancement New feature or request

Comments

@zero-plusplus
Copy link
Owner

zero-plusplus commented Dec 6, 2022

Debug directives require adding comments directly to the source code.

This attribute can be used to set hidden breakpoints without modifying the source code.

Its value is an array of objects with the following child attributes.

  • target: string : File path or function name
    • File Mode : If / or \ is included, it is treated as a file path; a glob may also be specified
    • Callable Symbol Mode: Names of functions, methods, and dynamic properties. It is possible to use wildcards
  • line: number : Line number to be placed. If a negative value is specified, it is the offset from the end. Also, an object with the following fields can be specified to set breakpoints on lines that match the condition
    • pattern : Regular expression to be applied to each line
    • ignoreCase: boolean
    • select: 'first' | 'last' | 'all' | number | number[] : Controls whether some or all breakpoints are set when multiple lines are matched
    • offset: number
  • condition: string : Condition for enabling breakpoint
  • hitCondition: string : Hit condition for enabling breakpoint
  • log: string : A log message to be output at break
  • break: boolean : If false is specified, no break is made. If omitted, false is set if log or action is specified, otherwise true
  • action: string : The following string can be specified to define the action to be executed at break
    • "ClearConsole" : Clear the console at break.
"setHiddenBreakpoints": [
  { "target": "path/to/source.ahk", "line": 1, "condition": "a == b"}
  { "target": "ExampleFunction", "line": 1, "log":  "{A_ThisFunc} start" }
  { "target": "ExampleFunction", "line": -1, "log":  "{A_ThisFunc} end" }
]

You can also specify an object with the following fields In this case, you can use the UI for exception breakpoints to change the enable/disable of the specified breakpoints.

  • label: string : Labels displayed on the UI for exception breakpoints
  • default: boolean : Default setting for debugging. Enabled (true), Disabled (false). Default is true
  • breakpoints : An array consisting of objects with the fields described above
"setHiddenBreakpoints": [
  {
    "label" : "Function trace",
    "default": true,
    "breakpoints": [
      { "target": "*", "line": 1, "action":  "{A_ThisFunc} start" }
      { "target": "*", "line": -1, "action":  "{A_ThisFunc} end" }
    ]
  }
]

Grouped strings with pattern can be output in the log.

"setHiddenBreakpoints": [
  {
    "target": "${workspaceFolder}/*.*",
    "line": {
      "pattern": "^\\s*(global)\\s+(?<var>[a-zA-Z$@#]+)\\s*(?=:=)",
      "select": "all",
      "ignoreCase": true,
      "offset": 1,
    },
    "log": "{GetMeta("$var")}: {GetVar(GetMeta("$var"))}"
  },
]
@zero-plusplus zero-plusplus added enhancement New feature or request draft Draft of new features labels Dec 6, 2022
@zero-plusplus zero-plusplus mentioned this issue Dec 18, 2022
62 tasks
zero-plusplus added a commit that referenced this issue Jan 29, 2023
Add setHiddenBreakpoints attribute in launch.json
@zero-plusplus zero-plusplus changed the title Add setHiddenBreakpoints attribute in launch.json Add setBreakpoints attribute in launch.json Jan 19, 2024
@zero-plusplus
Copy link
Owner Author

Now that I know how to add and remove arbitrary breakpoints, I will reconsider the specification of this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
draft Draft of new features enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant