Closed zero-plusplus closed 2 years ago
That is wonderful idea!
Why not follow the format already implemented?
; @Debug-Object -> {obj} - Collapsed output, JSON/YAML content
; @Debug-Object ->| {obj} - Collapsed output, serialized content (JSON only?)
; @Debug-Object => {obj} - Expanded output, JSON/YAML content
; @Debug-Object =>| {obj} - Expanded output, serialized content (JSON only?)
With support for an optional Label
, again like the others:
; @Debug-Object => Label {obj}
Thanks for the idea.
Why not follow the format already implemented?
The same symbols change meaning, which could increase the learning cost. Also, I am cautious about creating directives with similar features due to development and learning costs.
Given these considerations, I considered a function or method format as follows.
; @Debug-Output => {ToJson(obj)}
; @Debug-Output => {ToYaml(obj)}
; @Debug-Output => {obj.toJson()}
; @Debug-Output => {obj.toYaml()}
As I was writing this, I realized that the method form is likely to be misunderstood as if the fields and methods of the AutoHotkey object were available.
The function format would reduce misunderstandings. Also, if arguments can be supported the number of indentations can be controlled as follows.
; @Debug-Output => {ToJson(obj, 4)}
; @Debug-Output => {ToYaml(obj, 4)}
This idea is less costly to develop because existing directives can be used without modification and expandability.
What about this idea?
I am still looking for ideas and opinions.
Limiting to only two directives (-Breakpoint
and -Output
) makes sense.
So this will be available?
str := "test"
;@debug-output => {StrLen(str)}
Currently I have a _debug
super-global that I use as proxy for stuff like:
str := "test"
_debug := StrLen(str)
;@debug-output => {_debug}
That will be awesome! No more proxy.
Good idea. I would like to implement this in the future, including functions that can actually be used with AutoHotkey.
This could be misinterpreted as a pure function of AutoHotkey, but I think the convenience outweighs that.
Once the parser I am currently creating is complete, I plan to eventually support four arithmetic operations.
It is limited by the fact that it is evaluated on JavaScript by static analysis rather than by AutoHotkey, but it should still be useful.
I am currently working on it in parallel, so it will be quite a while before I implement it, but I will definitely implement it eventually.
This issue has been merged in the following.
I therefore close this issue.
Added method for converting objects to JSON. c65af0c7fe09ee84ebb0300290775f0cea7cf4f5
obj := { key: "value" }
; @Debug-Output => {ToJsonString(obj)}
; This outputs the following
; {
; "key": "value"
; }
; The following is an example of using format specifies. This has the same meaning as above
; @Debug-Output => {obj, J}
return
If requested, a method of conversion to TOML or CSON will be provided.
Currently when an object is output, it is collapsed as in the VARIABLES view.
The contents must be manually unfolded to view them, and once the debugger exits, the collapsed contents are no longer available for viewing.
Because of this specification, there were many cases where the contents could not be grasped even if the log was output during debugging.
To solve this issue, I am considering implementing a feature to output the contents of an object as a string.
At first, I was considering using json format, but yaml, which supports multi-line strings, may be easier to read.
For output in yaml format, I am considering the following method of enclosing variables in
%
.Alternatively, I am considering how to switch the output method of the object in the settings.
Please let me know if you have any other ideas.