zero-plusplus / vscode-autohotkey-debug

https://marketplace.visualstudio.com/items?itemName=zero-plusplus.vscode-autohotkey-debug
52 stars 4 forks source link

Add attributes to `useOutputDebug` in launch.json to set `prefix` and `suffix` #278

Closed zero-plusplus closed 1 year ago

zero-plusplus commented 1 year ago

RELATED: #277

zero-plusplus commented 1 year ago

For this reason, the addition of this attribute is withdrawn.

Debugging messages must not be processed by extensions, but must be clear in the source code.

If they cannot be displayed in the same way in any editor, they have no meaning as debug messages.

PythonYunfei commented 1 year ago

Last struggle, if different debuggers from different editors already have different shapes, then displaying in the same way is not a must, in my opinion. Some debug consoles are much higher but very narrow. Some are as wide as screenwidth but very low and cannot show more than 10 lines. If the same way applies to these "bottom" consoles, then more than 90% of blank areas on the right side cannot get used.😢 Debuggers with different shapes are better at becoming themselves than becoming to follow SciTE4's way, I think. Of course, it's just a small suggestion for a small improvement, and not much important. You can just ignore it.

zero-plusplus commented 1 year ago

First of all, I want to say that I am not throwing out your opinion, I have closed this issue because there is a better solution. So if you have any doubts, please tell me as many times as you want.


vscode can now be changed to various layouts through version upgrades. This means that adding special settings for specific layouts is not a good solution.

My personal solution is to create a simple function library as follows.

; Example ---------------------------
PrintRow("a-1", "b-1", "c-1")
PrintRow("a-2", "b-2", "c-2")
; The output is as follows
; a-1   b-1 c-1
; a-2   b-2 c-2
;--------------------------------------

PrintLine(message) {
  OutputDebug(message . "`n")
}
PrintRow(cells*) {
  message := ""
  for i, cell in cells {
    message .= cell . "`t"
  }
  message := RTrim(message)
  PrintLine(message)
}

This solution makes it clear how messages are output in the source code.

It can also output the messages in various formats without having to rely on extension.

; Example -------------------
Log("abc")
Log("edf")
; The output is as follows
; [2023/01/01 00:00:00] abc
; [2023/01/01 00:00:00] edf
;----------------------------
Log(message) {
  log := Format("[{}/{}/{} {}:{}:{}] {}", A_YYYY, A_MM, A_DD, A_Hour, A_Min, A_Sec, message)
  OutputDebug(log . "`n")
}
PythonYunfei commented 1 year ago

Thanks for your codes. I've realized that it is a considerable and nice way.