Author Topic: AutoLISP Editor in 2024  (Read 2992 times)

0 Members and 2 Guests are viewing this topic.

EnM4st3r

  • Mosquito
  • Posts: 2
Re: AutoLISP Editor in 2024
« Reply #30 on: March 01, 2024, 01:55:22 AM »

If vsCode plugin had a 'evaluateSelection' option I'd probably never open VLIDE  :-)


isnt that standart built in? Look attachment
Also i really like the 'Rename Symbol' option, the IntelliCode and similar to what BIGAL said the colored Brackets
« Last Edit: March 01, 2024, 02:16:16 AM by EnM4st3r »

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2140
  • class keyThumper<T>:ILazy<T>
Re: AutoLISP Editor in 2024
« Reply #31 on: March 01, 2024, 03:18:32 AM »

@EnM4st3r

Thanks for that information,
I'll have another look  :-)

Regards,
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: AutoLISP Editor in 2024
« Reply #32 on: March 01, 2024, 10:58:45 AM »
I have serious doubts, but I hope VSCode will force AutoLispers to use more or better documentation habits in their code.

For example to get the hover tips on a custom function you have to add a function header which looks like this:
Code - Auto/Visual Lisp: [Select]
  1. ;|
  2.   Squares a number
  3.   @Param nu number
  4.   @Returns `nu` squared
  5. |;
  6. (defun square (nu)
  7.   (* nu nu))
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

57gmc

  • Bull Frog
  • Posts: 366
Re: AutoLISP Editor in 2024
« Reply #33 on: March 03, 2024, 12:46:39 PM »

@EnM4st3r

Thanks for that information,
I'll have another look  :-)

Regards,
Thanks for the tip.

57gmc

  • Bull Frog
  • Posts: 366
Re: AutoLISP Editor in 2024
« Reply #34 on: March 03, 2024, 12:50:01 PM »
I have serious doubts, but I hope VSCode will force AutoLispers to use more or better documentation habits in their code.

For example to get the hover tips on a custom function you have to add a function header which looks like this:
Code - Auto/Visual Lisp: [Select]
  1. ;|
  2.   Squares a number
  3.   @Param nu number
  4.   @Returns `nu` squared
  5. |;
  6. (defun square (nu)
  7.   (* nu nu))
Good reminder.

Lastknownuser

  • Newt
  • Posts: 28
Re: AutoLISP Editor in 2024
« Reply #35 on: March 04, 2024, 01:44:56 AM »
Inspired by this thread I played with VS code this weekend, and I'm starting to like it, but I'd like to change color theme for the AutoLisp extension. Anyone know how to do that, since there are no themes available for this extension? I should probably create a new one, but how to add it to this extension? Mainly because I don't like how the variables and numeric values are the same color
« Last Edit: March 04, 2024, 03:01:57 AM by Lastknownuser »

danAllen

  • Newt
  • Posts: 133
Re: AutoLISP Editor in 2024
« Reply #36 on: March 04, 2024, 03:50:09 PM »
For lisp I still use Textpad v5 from 2011 with lisp syntax files, mostly because I don't have VLIDE or Blade with Bricscad v15. But I also tried other editors and miss the carot placement consistency when using up/down arrows. (see links for more info)
https://sourceforge.net/p/notepad-plus/discussion/331754/thread/d1ea2bcd/
https://forum.sublimetext.com/t/smart-horizontal-cursor-positioning/2050/18

When I have bugs it is usually missing closing parens, but CTRL+M toggle back & forth which usuall works for me.

I have been using VScode for beginning code in other languages, and I like it. But too set in my ways to move my autolisp editing to it. (Plus missing that darn down arrow feature)

EWCAD

  • Mosquito
  • Posts: 14
Re: AutoLISP Editor in 2024
« Reply #37 on: March 05, 2024, 10:58:07 AM »
Just thought I would add my opinion here. I actually like VScode for other languages but prefer to use Notepad++ for lisp. Also if you are eventually switching to AutoCAD LT you will have no way debug (other than saving and reloading the lisp every edit) so there would be little benefit from using VScode over Notepad++ anyways.

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: AutoLISP Editor in 2024
« Reply #38 on: March 05, 2024, 11:12:22 AM »
If debugging is your only problem, you can use `vl-bt` to debug instead of using VLIDE:

Define a simple error handler with:
Code - Auto/Visual Lisp: [Select]
  1. (defun *error* (msg) (vl-bt))
or
Code - Auto/Visual Lisp: [Select]
  1. (set '*error* (lambda (msg) (vl-bt)))
Create your code:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:bug () (/ 2 0))
debug your code on the command line.
Code: [Select]
Backtrace:
[0.47] (VL-BT)
[1.43] (#<SUBR @00000158a9fa6278 -lambda-> "divide by zero")
[2.39] (_call-err-hook #<SUBR @00000158a9fa6278 -lambda-> "divide by zero")
[3.33] (sys-error "divide by zero")
:ERROR-BREAK.28 nil
[4.25] (/ 2 0)
[5.19] (C:BUG)
[6.15] (#<SUBR @00000158a9fa6548 -rts_top->)
[7.12] (#<SUBR @00000158b0659750 veval-str-body> "(C:BUG)" T #<FILE internal>)
:CALLBACK-ENTRY.6 (:CALLBACK-ENTRY)
:ARQ-SUBR-CALLBACK.3 (nil 0)

After your bugs are dead (-i.e. switch to production code), just (setq *error* nil) and/or replace/use your standard error handler.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

dexus

  • Bull Frog
  • Posts: 208
Re: AutoLISP Editor in 2024
« Reply #39 on: March 05, 2024, 11:18:02 AM »
I have serious doubts, but I hope VSCode will force AutoLispers to use more or better documentation habits in their code.

For example to get the hover tips on a custom function you have to add a function header which looks like this:
Code - Auto/Visual Lisp: [Select]
  1. ;|
  2.   Squares a number
  3.   @Param nu number
  4.   @Returns `nu` squared
  5. |;
  6. (defun square (nu)
  7.   (* nu nu))
I can't seem to get any hover tips working for autolisp in VSCode.
Do you have a specific plugin that finds the function headers to display them as a tip?

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: AutoLISP Editor in 2024
« Reply #40 on: March 05, 2024, 11:34:33 AM »
I can't seem to get any hover tips working for autolisp in VSCode.
Do you have a specific plugin that finds the function headers to display them as a tip?

Do you have the AutoCAD AutoLisp extension installed?
Quote
Name: AutoCAD AutoLISP Extension
Id: Autodesk.autolispext
Description: This is a vscode extension for AutoCAD AutoLISP
Version: 1.6.2
Publisher: Autodesk
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=Autodesk.autolispext


TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: AutoLISP Editor in 2024
« Reply #41 on: March 05, 2024, 11:37:22 AM »
If debugging is your only problem, you can use `vl-bt` to debug instead of using VLIDE:
... >%
Expanding on that concept.

Define a `DEBUG` mode and set up some simple unit testing.
Code - Auto/Visual Lisp: [Select]
  1. (setq DEBUG T)
  2.   (DEBUG
  3.     (set '#assert
  4.          (lambda ( result expected )
  5.            (equal (eval result) expected)))
  6.  
  7.     (set '*error* (lambda (msg) (vl-bt)))
  8.     )
  9.   (T (set '#assert nil) (set '*error* nil))
  10.   )

Now you can use something like this to debug/test (you don't have to, but building tests for code is good practice).

Code - Auto/Visual Lisp: [Select]
  1. (#assert '(/ 2 0) 0)
  2. (#assert '(+ 2 2) 4)
  3.  
  4. (defun c:four () (+ 2 2))
  5. (#assert '(c:four) 4)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

57gmc

  • Bull Frog
  • Posts: 366
Re: AutoLISP Editor in 2024
« Reply #42 on: March 05, 2024, 11:54:24 AM »

If vsCode plugin had a 'evaluateSelection' option I'd probably never open VLIDE  :)


isnt that standart built in? Look attachment
Also i really like the 'Rename Symbol' option, the IntelliCode and similar to what BIGAL said the colored Brackets
How did you get the panel added to the rt+clk menu? Mine doesn't have it.

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: AutoLISP Editor in 2024
« Reply #43 on: March 05, 2024, 12:01:53 PM »
Did you install the extension to VSCode?

File -> Preferences -> Extensions ---> Search for "AutoLisp"
Load the: "AutoCAD AutoLISP Extension"
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

57gmc

  • Bull Frog
  • Posts: 366
Re: AutoLISP Editor in 2024
« Reply #44 on: March 05, 2024, 12:05:59 PM »
Did you install the extension to VSCode?

File -> Preferences -> Extensions ---> Search for "AutoLisp"
Load the: "AutoCAD AutoLISP Extension"
I figured it out. You have to have a debug session running, i.e. F5. This is counterintuitive, as I just wanted to load the selected lisp, not the whole form, which F5 does.