Author Topic: General question about VLIDE and Coding  (Read 5778 times)

0 Members and 1 Guest are viewing this topic.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: General question about VLIDE and Coding
« Reply #15 on: December 14, 2011, 11:04:34 AM »
Enough about the screen grabbing  :pissed:

To get the best of both worlds you can do what I sometimes do: Have the LSP open in VLIDE as well as your favourite editor (mine's SciTE). That way you can have code completion, proper formatting, folding, regex S&R ect. As soon as you save from the external editor, you can return to VLIDE, it will tell you the file's changed and ask if you want it reloaded. Then you can go ahead and do your debugging there.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

nivuahc

  • Guest

JohnK

  • Administrator
  • Seagull
  • Posts: 10649
Re: General question about VLIDE and Coding
« Reply #17 on: December 14, 2011, 11:27:45 AM »
I'm with the others in this thread who use a text editor. I don't have worry much about formatting but I have adopted a sort of system in my editor which is actauly best described as "adaptive" (I got that word from the link below) based upon filetypes. Ive been thinking that I may want to expand on this this theory a bit and try to create a system which will allow for alternates for each filetype but that's later.

REF:
I answered a similar question about this on stackoverflow a while back.
http://stackoverflow.com/a/6950427/875064
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

StykFacE

  • Guest
Re: General question about VLIDE and Coding
« Reply #18 on: December 14, 2011, 10:05:29 PM »
Awesome! Thanks for the replies everyone. I'll keep that in mind when I'm monkeying around with more code. I never thought about looking at the two icons with the triangles, I'll mess around with those tools as well.

I've seen that some people has extremely clean formatted code and it always seemed like it would be a pain to try and make it that way, but a well organized code says something about the coder in my opinion. Glad to finally hear it from you guys.

 :kewl:

StykFacE

  • Guest
Re: General question about VLIDE and Coding
« Reply #19 on: December 14, 2011, 10:08:37 PM »
Yep, the "triangle" buttons like attached. Just remember to setup your Tools --> Environment Options --> Visual LISP Format Options to something you like. I prefer not having those default ;_ end of ... comments added all over the place.
Irneb, would you mind elaborating on your settings a bit from your screenshot? I see that they do not match the default settings. I understand some of the options but others I don't.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: General question about VLIDE and Coding
« Reply #20 on: December 15, 2011, 01:39:02 AM »
Some of these are a bit of personal preference. You can of course choose your "own look":
  • Right text margin: I've set mine to 120 since my screen handles a longer line than the default. And it helps to allow longer EOL comments. There's a max limit and I think this is it.
  • Narrow style indentation: 2 so an indent is rather minimal and nested indents don't start forcing new lines when they become too deep.
  • Max wide car length: 9 ... I haven't changed this, can't even remember what it does.
  • Single semicolon comment indentation: 1 so EOL comments are placed directly after the line, not trying to align to a specified character position, which IMO makes the comment detatched from the code and harder to relate to its own line (even though it might look more neat).
  • Closing paren style = @ new line with outer indent: means my ending parenthesis would be at the same indentation as the corresponding open paren, and it's placed on a new line of its own. Just my preference. Some like using the @ same line approach, thus formatting more like Python / rather Scheme.
  • Insert tabs = OFF: Pressing tab actually creates spaces instead of a \T character. Works better if your code is viewed on other PC's as well and also works better when copying to forums. Otherwise the tab char-length might differ and cause irregular indents.
  • Save formatting = Yes: means these settings are saved in an auto-generated comment at the end of the LSP file. Ensures proper formatting on any PC, so you don't need to re-setup VLIDE on another PC / version of Acad.
  • Insert form closing comment=Off: I don't like having auto-generated comments like ;_ end of defun, ;_ end of while ;_ end of if, etc.etc. IMO it makes the code "ugly"
  • Approximate line length = 100: A trial & error setting to make comment lines at end of line (EOL comments) not start at new lines too easily. There's a max limit and I think this is it.
  • Preserve existing line breaks=On: If I make a new line, I'd rather it stays that way than VLIDE remove the NL character. Usually I'd have pressed Enter for a reason.
  • Setting case to symbols = both OFF: I want my CamelCase as I've typed it. All lower / All UPPER is a bit unreadable IMO.
  • Long list format style: If I type a list into the code I don't want each item on its own line. That's just a waste of space. I could've gone with Multi-column and it might then space each item to a "smart" tab position, but I don't care about that for such lists.
« Last Edit: December 15, 2011, 01:43:19 AM by irneb »
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: General question about VLIDE and Coding
« Reply #21 on: December 15, 2011, 01:55:18 AM »
I've seen that some people has extremely clean formatted code and it always seemed like it would be a pain to try and make it that way, but a well organized code says something about the coder in my opinion. Glad to finally hear it from you guys.

 :kewl:
:lmao: I think it just says they use the formatting function. I don't think you get many who'd be so pedantic as to press 1000's of spaces in different lines just to get the formatting "just-right". The only guys who "have-to" do that is Python programmers, where the indentation actually has some meaning in the action of the source code. But then their editors would have an auto-indent feature anyway.

Edit: Actually, the manual "spacing" to indent always gives me an itchy feeling as I generally see typists hit the spacebar 10 times per line to go and indent a paragraph in Word. I've given up trying to explain to them the "oh-so-new" feature of Word where you can simply set a paragraph's intents to have it done automatically for you.
« Last Edit: December 15, 2011, 02:05:54 AM by irneb »
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: General question about VLIDE and Coding
« Reply #22 on: December 15, 2011, 07:00:46 AM »
I never use the formatting utility in the VLIDE, I format the code manually as I write it  :-)

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: General question about VLIDE and Coding
« Reply #23 on: December 15, 2011, 07:30:46 AM »
Good thread.  Very good thread.  2 birds with one thread.  :wink:
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: General question about VLIDE and Coding
« Reply #24 on: December 15, 2011, 08:10:59 AM »
I never use the formatting utility in the VLIDE, I format the code manually as I write it  :)
You mean you format it in NotePad?

If in any other decent code editor (even VLIDE) most of the formatting is done on the fly. VLIDE's format function just completes where its auto-indenting falls short.

So what you mean is you type the code into VLIDE and then fix the screwups with its auto-indent manually? ... Well ... I did say "most" wouldn't be as pedantic  ;)
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: General question about VLIDE and Coding
« Reply #25 on: December 15, 2011, 08:19:22 AM »
I never use the formatting utility in the VLIDE, I format the code manually as I write it  :)
You mean you format it in NotePad?

No, I write the code in VLIDE, but don't use the option to format it automatically.

JohnK

  • Administrator
  • Seagull
  • Posts: 10649
Re: General question about VLIDE and Coding
« Reply #26 on: December 15, 2011, 08:24:52 AM »
lmao @ `pedantic'.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: General question about VLIDE and Coding
« Reply #27 on: December 15, 2011, 09:30:25 AM »
I never use the formatting utility in the VLIDE, I format the code manually as I write it  :)
You mean you format it in NotePad?

No, I write the code in VLIDE, but don't use the option to format it automatically.
That's a lot of work.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: General question about VLIDE and Coding
« Reply #28 on: December 15, 2011, 09:52:06 AM »
:lmao: I think it just says they use the formatting function.

And yet you'd be wrong.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: General question about VLIDE and Coding
« Reply #29 on: December 15, 2011, 09:52:49 AM »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst