Author Topic: Visual Studio Code Vs Visual LISP IDE Watch expression : not available  (Read 1128 times)

0 Members and 1 Guest are viewing this topic.

damn

  • Mosquito
  • Posts: 15
Hi All,

Little lazy maybe, I've had a quick look around to no avail.  I figure one of you Guru's knows the answer.
I was an avid watch window user in Visual LISP IDE.  I can't get any values in my expressions in Visual Studio Code.
I have :not availabe to all my watched expressions.  The old editor would retain the values until I run it again.
Ah Correction, I found an unsatisfactory way. That is to add a breakpoint in the code and then i can see it's value.
It seems the expressions are clearing after completion of the function.  I know the expressions still have values as they are passed to other functions.
Any ideas how I can keep the Watch vaules?

Thanks for any help.
Damn.


danAllen

  • Newt
  • Posts: 133
Re: Visual Studio Code Vs Visual LISP IDE Watch expression : not available
« Reply #1 on: August 03, 2023, 11:48:49 AM »
I run Bricscad v15 without Blade nor Acad's IDE, thus I made my own debugging tools. One is a command that toggles a debug variable, then I have princ statements in the code to echo variables as the program is run/tested. When done I just turn off the debug variable. Replace ZZZ with your initials.

Code - Auto/Visual Lisp: [Select]
  1. ;;; example in a routine, debug princ takes a list to add surrounding text, new lines, etc
  2. (saa_debugPrinc (list "\n" cmd))
  3.  
  4. ;;; debug echo
  5. ;;; returns T if not in debug mode to allow use in AND statements
  6. (defun ZZZ_debugPrinc (str / x strNew)
  7.   (if (= 'LIST (type str))
  8.     (progn
  9.       (setq strNew "")
  10.       (foreach x str
  11.         (setq strNew (strcat strNew (vl-princ-to-string x)))
  12.       ) ;_foreach
  13.       (setq str strNew)
  14.     ) ;_progn
  15.   ) ;_if
  16.   (setenv "ZZZ_lastDebugPrinc" (vl-princ-to-string str))
  17.   (if ZZZdebug_brief (princ str) T)
  18. )
  19.  
  20. ;;; debug echo only in verbose mode
  21. ;;; returns T if not in debug mode to allow use in AND statements
  22. (defun ZZZ_debugPrincVerbose (str / x strNew)
  23.   (if (= 'LIST (type str))
  24.     (progn
  25.       (setq strNew "")
  26.       (foreach x str
  27.         (setq strNew (strcat strNew (vl-princ-to-string x)))
  28.       ) ;_foreach
  29.       (setq str strNew)
  30.     ) ;_progn
  31.   ) ;_if
  32.   (setenv "ZZZ_lastDebugPrinc" (vl-princ-to-string str))
  33.   (if ZZZdebug_verbose (princ str) T)
  34. )
  35.  
  36. (defun c:debug ()
  37.   (cond
  38.   ( (= (getenv "ZZZ\\Debug") "2")       ;if in debugmode verbose
  39.       (setenv "ZZZ\\Debug" "0")         ;turn it off
  40.       (setq ZZZdebug nil)
  41.       (setq ZZZdebug_brief nil)
  42.       (setq ZZZdebug_verbose nil)
  43.       (princ "\nDebugging turned OFF")
  44.     )
  45.     ((or (= (getenv "ZZZ\\Debug") "0")
  46.          (= (getenv "ZZZ\\Debug") nil)
  47.      )
  48.       (setenv "ZZZ\\Debug" "1")         ;else turn it on
  49.       (setq ZZZdebug T)
  50.       (setq ZZZdebug_brief T)
  51.       (princ "\nDebugging turned ON to brief")
  52.     )
  53.     ((= (getenv "ZZZ\\Debug") "1")
  54.       (setenv "ZZZ\\Debug" "2")         ;else turn it on
  55.       (setq ZZZdebug T)
  56.       (setq ZZZdebug_brief T)
  57.       (setq ZZZdebug_verbose T)
  58.       (princ "\nDebugging turned ON to verbose")
  59.     ) ;progn
  60.   ) ;cond
  61.   (princ)
  62. )
  63.  
« Last Edit: August 03, 2023, 06:50:14 PM by danAllen »