VS Code and AutoLISP Project Files

VS Code and AutoLISP Project Files

Julio_Soto
Advisor Advisor
382 Views
5 Replies
Message 1 of 6

VS Code and AutoLISP Project Files

Julio_Soto
Advisor
Advisor

I consider myself at an intermediate level of writing Lisps.  In the last year I started using VS Code to write/debug my LISPs. I recently started reading about AutoLISP Project Files.  I believe this is supposed to help organize all my lisps. I guess I'm not sure what is the best way to use this. Am I supposed to put all of my lisps into one project? Or is there supposed to be one project per every function I create?  Or does it even matter? I just want to follow best practices so I don't regret it in the future. 

0 Likes
383 Views
5 Replies
Replies (5)
Message 2 of 6

john.kaulB9QW2
Advocate
Advocate
  • As a programmer (in multiple programming languages), I use a directory per project. 
  • You may want to look into using a version control system like Git, or any of the 30,000 other VCS'. 
  • The "project files" are for your editor (in this case, Visual Studio Code) but I'm not sure VS Code reads .prj files because I believe VS Code uses workspaces (you want to create a workspace for each project). 
My overall directory structure.
projects
    |
    +---doc
    |
    +---lib
    |   |
    |   +---[PROJECT NAME]
    |       |
    |       +---src
    |
    o---tools
        |
        +---[PROJECT NAME]
            |
            +---src





My project directory structure
    |   +---[PROJECT NAME]
    |       |
    |       +---readme.md
    |       |
    |       +---.gitignore
    |       |
    |       +---.git
    |       |
    |       +---[PROJECT NAME].code-workspace
    |       |
    |       +---.vscode
    |       |     |
    |       |     +---tasks.json
    |       |     |
    |       |     +---launch.json
    |       |
    |       +---src
    |       |     |
    |       |     +---[PROJECT NAME].lsp
    |       |

 

another swamper
0 Likes
Message 3 of 6

Julio_Soto
Advisor
Advisor

So a project could be one function or a whole suite of functions?

 

Also, from AutoCAD 2024 Help menu it would appear that it does read prj files

https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-4F5AB2A0-94E0-4F3D-B5FE-4D374EF961DB

0 Likes
Message 4 of 6

john.kaulB9QW2
Advocate
Advocate

Your use of the word `function` is confusing me. A 'function' to me is a "DEFUN". Like:
(defun add (x y) (+ x y))


That would be a support "function" (procedure) used in a larger 'project' (tool) and would not be a project by itself.

An example of a 'project' would be a series of 'functions' (procedures) to perform a task (and where I place in a folder in one or several files under the "TOOLS" directory in my example above). 

(defun add (x y) (+ x y))
(defun sub (x y) (- x y))
(defun mul (x y) (* x y))
...
(defun c:myapp ()
...


The AutoLisp plugin may support .prj files, but I would only assume that would be for backwards compatibility. VS Code uses workspaces; I would recommend using workspaces but feel free to use any source file management method you want.

another swamper
0 Likes
Message 5 of 6

Julio_Soto
Advisor
Advisor

Yeah, your right. Thanks for the correction. I believe nomenclature is important so we know we're all talking about the same thing.

 

So most of my Tools (C:myapp) are fairly simple and most don't have other functions.  Would each tool warrant its own Project?  I have a group of like 50 commands, so that would be about 50 projects. 

0 Likes
Message 6 of 6

john.kaulB9QW2
Advocate
Advocate
In my opinion, each tool would require its own folder/project but I like my code organized. Ultimately, it is up to you.

I also use a Version Control System (git) to keep my code organized across multiple computers.

I also try to type up documentation for each project as to "why" I created it and any specific "how" to use it. Although, most times that documentation ends up being in the Lisp file itself.

That being said, having a directory with XXX number of lisp files isn't any benefit over having multiple directories; you can use windows explorer search to find things in subdirectories, and etc.. I prefer organization and automation so I use a Batch script to create a folder, VS Code .json file(s), etc. for my new projects which you can find in the link below but I still have a few directories with "misc files" which are not 'projects' (-i.e. I only create a project folder for a tool which is intended to be used in production).

https://www.theswamp.org/index.php?topic=55696.msg598040#msg598040
another swamper
0 Likes