Recent

Author Topic: [SOLVED] Code Snippets...  (Read 3178 times)

GypsyPrince

  • Guest
[SOLVED] Code Snippets...
« on: June 19, 2018, 08:26:14 pm »
I have searched the forum but cannot find the question I need answered in any existing topic.
I had to put off learning Lazarus (Object Pascal) for a year and a half, and I am just now dusting off my keyboard to give it another go.
Can anyone tell me if the Lazarus IDE has a feature for entering coded/comment snippets into one's source code. Or, am I stuck with copy and paste?

Thanx in advance!
« Last Edit: June 20, 2018, 01:46:41 am by GypsyPrince »

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Code Snippets...
« Reply #1 on: June 19, 2018, 08:34:01 pm »
You can insert 'ToDo' from the sources menu.  :)

Code Completion is good to know
http://wiki.freepascal.org/Lazarus_IDE_Tools#Code_Completion

For everything else, copy and paste is still the best.

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Code Snippets...
« Reply #2 on: June 19, 2018, 08:36:47 pm »
AFAIK at least some people almost always write complete compilable "snippets" on this forum. With the essential snippet marked as such...
Specialize a type, not a var.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Code Snippets...
« Reply #3 on: June 19, 2018, 08:39:41 pm »
Or here
https://github.com/TAAZZ/CODELIBRARIAN

You can extend that with your own codes.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Code Snippets...
« Reply #4 on: June 19, 2018, 09:05:45 pm »
There is "code templates" in the Tools menu.

GypsyPrince

  • Guest
Re: Code Snippets...
« Reply #5 on: June 19, 2018, 10:03:37 pm »
Thank you all very much for your help! I greatly appreciate you wisdom!

Martin_fr -

That (code templates) was what I was looking for. It took me a minute to figure out how it works, and how to add my own snippets directly to the file rather than using the Code Templates dialog so that I could arrange them in alphabetic order. The dialog appends new snippets to the very end of the [lazarus.dci] file and doesn't rearrange the new custom abbreviations in alphabetic order. But I manually edited the file, arranging my custom abbreviations (and their corresponding snippets) in alphabetic order, and it now works exactly how I wanted.


 

TinyPortal © 2005-2018