# Update
I've been programming a lot these ten days, trying out VS Code the entire time. And generally I am very happily committed to VS Code (VSCode) now. I went back to VLIDE just once for code formatting (the grass was not much greener there); I may go back again to Rebuild FAS. I feel like I am programming better already.
In this reply I am listing Solutions to my original post, features that are Winning me over. Good features, Workarounds, Bad features, and my new Wish List. Maybe this should be a blog post. 😅
# Solutions
1. Large projects: This is a winner. Navigation and overview are noticeably better. See my Winning features section.
2. Globals: See Globals under Workarounds
3. View Error Trace: Similar hyperlinked crash point information is provided in the PROBLEMS tab of the bottom pane on crash.
4. Formatting and Case: See Case under the Good section. You can't do this once and for all in your formatting settings. Since I am getting older, I chose to standardize on upper case for everything except User Interface text; this makes coding easier for me to see. I decided generally to adjust to what Format does without worrying about how it will affect my git logs. I still am learning the nuances of how Format reacts to my existing line breaks.
5. Rebuild FAS: See this Solution reply by @paullimapa.
# Winning features
These seal the deal.
- Fold/Collapse blocks/expressions plus file #regions: This does wonders for my 6000-line file (see my open source code base at github). I promptly added foldable #regions to the files I am editing (cnm.lsp and edclib.lsp). And I refactored all my defuns there to have (DEFUN FUNCTION_NAME (ARGUMENTS / LOCALS) on the same line.
- Find all references in block/file, Shift+Alt+F12, puts a very handy hyperlinked list in the left pane of the defun and all calls for the function name under the cursor. This is surprisingly helpful for auditing a process from top to bottom.
- Start of current block/expression is always automatically shown/frozen/scroll-locked at top of window. This took me a little while to notice, but it's very helpful.
- Debug editing: I can edit my code during debug and then hit reload midstream if I choose. It is a surprising convenience to have run-time values shown while I am editing and to have the reload button always available.
- Debug inspection: I am free of Inspect and Add to Watch because the variables I care about are intuitively available by hovering or in the left pane Locals list. As a bonus, when I focus on the left pane Locals list, Globals management is mostly natural and intuitive; encouraging better habits. And I expect that there are more efficiencies left for me to discover and notice.
- Layout: The fact that the screen is organized into panes instead of windows turns out to be very productive. For example, I rarely visited the Visual Lisp Console because it was not at a reliable standard location across installations, machines, and sessions. In VSCode, I am there all the time.
- Keyboard shortcuts: I am learning keyboard shortcuts that are making me more productive; better habits.
- Snippets: I defined the few code snippets I need most. Very worthwhile. See the end of this reply.
- App switching: Switching between VS Code and AutoCAD seems less buggy. And it's nice to be able to run VS Code without AutoCAD if I get to like VS Code enough.
# Good
(alphabetical order)
- Block Start automatically shown/locked at top of tab. I didn't notice this at first. Very helpful.
- Case to upper: Ctrl+Shift+P > Upper (type the letters "Up" then Enter)
- Collapse sections: (see Fold)
- Duplicate line: Shift + Alt + Down Arrow or Shift + Alt + Up Arrow.
- Find all references in block/file: Shift+Alt+F12 with cursor on a function name. Well implemented. Play with it.
- Fold or unfold file: Ctrl+K > Ctrl+0 (fold all) or Ctrl+J (unfold all)
- Fold or unfold this block: Ctrl+K > Ctrl+[ or ]. Very good to "open" a single region or function.
- Fold any file levels deeper than X: Ctrl+K > Ctrl+2 (for level 2). To be honest, I haven't exactly figured this out.
- Goto Definition in split screen: Ctrl+Alt+Click. Very helpful. But I stopped using it as much as "Find all references" above.
- Inspect during debug: See Locals list in left pane (good programming practice) or hover over any variable.
- Select block (expand/shrink): Alt+Shift+Right/Left
- Snippets: Ctrl+Shift+P > Snippets then Ctrl+Shift+P > DevRe to create your own code snippets in autolisp.json and load them. My additions are at the end of this reply.
- Watch automatically in "Variables" under "Run and Debug" in the left pane during debug.
# Workarounds
- Globals: Locals are listed in the (left side) Run and Debug pane during debug. If a variable doesn't appear there, it is global. This is poor insurance. But I think it encourages good programming practice with incremental and natural Locals management. At least it can be a heads up and a clue. And it is a very handy watch list. If still desperate for a good old complete list of globals, I'll try this workaround by @john_uhden.
# Bad
- Formatting: (Mark block w/ repeated Alt+Shift+Right then Ctrl+K, Ctrl+F.) Yuck. I'm working with it and trying to understand it better.
- The AutoLISP Extension or VS Code sometimes hangs. My tab key stops working; I restart VSCode. Auto-indent stops working; I Reload the file (seems to restart the extension).
# Wish list
- Refactoring: I wish it were easier to pull out a code block to a function. This is a pervasive need and a common feature. Eventually I will be taking time to figure it out.
I ran this by Grok AI assistant for ideas, which was helpful.
Tom
# Snippets
// Reload with Ctrl+Shift+P > DevRe
"Cond UC": {
"prefix": "COND",
"body": [
"(COND",
" (${1:TESTEXPR1}",
" ${2:[THENEXPR1 ...]}",
" )",
" (${3:TESTEXPR2}",
" ${4:[THENEXPR2 ...]}",
" )",
")",
""
],
"description": "Conditional function"
},
"Defun UC": {
"prefix": "DEFUN",
"body": [
"(DEFUN ${1:NAME} (${2:ARGS} / ${3:LOCALVARS})",
" ${4:[EXPR ...]}",
")",
""
],
"description": "Defun Upper Case"
},
"Mapcar Lambda UC": {
"prefix": "MAPCAR LAMBDA",
"body": [
"(MAPCAR",
" '(LAMBDA (${1:ARGS} / ${2:LOCALVARS})",
" ${3:[EXPR ...]}",
" )",
" ${4:LIST}",
")",
""
],
"description": "Mapcar lambda block"
},
// This is neither my style nor the VS Code Format style. I could change this later.
"Setq UC": {
"prefix": "SETQ",
"body": [
"(SETQ",
" ${1:SYM1}",
" ${2:[EXPR1 ...]}",
")",
""
],
"description": "Setq function"
},