lcb file snippet for the Atom editor
lcb file snippet for the Atom editor
I've created a snippet for the Atom editor to make creating .lcb files a little easier
In Atom
(you need to have Peters packages installed first)
Go File>Open Your Snippets
Add the following to the file
'.source.iRev, .source.lcb':
'lcbtemplate':
'prefix': 'lcbt'
'body': '-- declaring extension as widget, followed by identifier\n
widget community.livecode.username.identifier\n
use com.livecode.canvas\n
use com.livecode.widget\n
use com.livecode.engine\n
metadata title is "title"\n
metadata author is "author"\n
metadata version is "1.0.0"\n
end widget'
Then save the snippets file
Create a new .lcb file
This must be saved in order for Atom to be able to associate the .lcb file with Peters packages.
In the new .lcb file type
lcbt and hit enter or the tab key or pick it from the auto-complete options
You will now get this added to your .lcb file
-- declaring extension as widget, followed by identifier
widget community.livecode.username.identifier
use com.livecode.canvas
use com.livecode.widget
use com.livecode.engine
metadata title is "title"
metadata author is "author"
metadata version is "1.0.0"
end widget
In Atom
(you need to have Peters packages installed first)
Go File>Open Your Snippets
Add the following to the file
'.source.iRev, .source.lcb':
'lcbtemplate':
'prefix': 'lcbt'
'body': '-- declaring extension as widget, followed by identifier\n
widget community.livecode.username.identifier\n
use com.livecode.canvas\n
use com.livecode.widget\n
use com.livecode.engine\n
metadata title is "title"\n
metadata author is "author"\n
metadata version is "1.0.0"\n
end widget'
Then save the snippets file
Create a new .lcb file
This must be saved in order for Atom to be able to associate the .lcb file with Peters packages.
In the new .lcb file type
lcbt and hit enter or the tab key or pick it from the auto-complete options
You will now get this added to your .lcb file
-- declaring extension as widget, followed by identifier
widget community.livecode.username.identifier
use com.livecode.canvas
use com.livecode.widget
use com.livecode.engine
metadata title is "title"
metadata author is "author"
metadata version is "1.0.0"
end widget
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Re: lcb file snippet for the Atom editor
Thanks Andy!
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
-
- VIP Livecode Opensource Backer
- Posts: 3999
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: lcb file snippet for the Atom editor
Hi Andy,
thank you for your snippet. It saves a lot of repetetive typing.
Although I had trouble installing it by copying the snippet from the forum using Safari on a Mac I managed when I copied your snippet from the digest of the use-list from the email.
Atom was complaining about an unexpected end of line. Comparing both texts in BBEdit did not give me a clue as to why.
Anyways, thank you again.
Kind regards
Bernd
thank you for your snippet. It saves a lot of repetetive typing.
Although I had trouble installing it by copying the snippet from the forum using Safari on a Mac I managed when I copied your snippet from the digest of the use-list from the email.
Atom was complaining about an unexpected end of line. Comparing both texts in BBEdit did not give me a clue as to why.
Anyways, thank you again.
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 3999
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: lcb file snippet for the Atom editor
Hi Andy,
I like your idea so much that I added standard public handlers
Kind regards
Bernd
I like your idea so much that I added standard public handlers
Code: Select all
'.source.iRev, .source.lcb':
'lcbtemplate':
'prefix': 'lcbt'
'body': '-- declaring extension as widget, followed by identifier\n
widget community.livecode.username.identifier\n
use com.livecode.canvas\n
use com.livecode.widget\n
use com.livecode.engine\n
metadata title is "title"\n
metadata author is "author"\n
metadata version is "1.0.0"\n
\n
-- property yourProperty get mYourVariable set yourSetCommand
\n
\n
public handler OnLoad(in pProperties as Array)\n
-- your code here\n
put pProperties["myProperty"] into mMyVariable\n
end handler\n
\n
public handler OnSave(out rProperties as Array)\n
-- your code here\n
put the empty array into rProperties\n
put mMyVariable into rProperties["myProperty"]\n
return rProperties\n
end handler\n
\n
public handler OnCreate()\n
-- your code here\n
end handler\n
\n
public handler OnPaint()\n
-- your code here\n
end handler\n
\n
end widget'
Bernd
Re: lcb file snippet for the Atom editor
Hi Bernd,
Thanks, I'll be using this version from now.
As a side to this I'm playing with pushing and pulling text from the LC editor to Atom which sort of works if this becomes stable I'll post a link to the scripts.
Thanks, I'll be using this version from now.
As a side to this I'm playing with pushing and pulling text from the LC editor to Atom which sort of works if this becomes stable I'll post a link to the scripts.
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: lcb file snippet for the Atom editor
Hi Bernd,
I'm getting that "unexpected newline" from your script now.
I thought it was this
but no luck.
Simon
I'm getting that "unexpected newline" from your script now.
I thought it was this
Code: Select all
-- property yourProperty get mYourVariable set yourSetCommand
\n
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- VIP Livecode Opensource Backer
- Posts: 3999
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: lcb file snippet for the Atom editor
Hi Simon,
here is the zipped snippets-file from Atom which on my Max is in an invisble folder right in
/users/theUser/.atom/snippets.cson
try to put it there.
This works for me if you open a new document and save it as xyz.lcb
then as AndyP explained type in the first line of the new document lcbt and then return or tab and it autofills with the snippet.
I have tried to find what is going on but have not succeeded, as stated above.
I hope the zipped file does the trick...
Kind regards
here is the zipped snippets-file from Atom which on my Max is in an invisble folder right in
/users/theUser/.atom/snippets.cson
try to put it there.
This works for me if you open a new document and save it as xyz.lcb
then as AndyP explained type in the first line of the new document lcbt and then return or tab and it autofills with the snippet.
I have tried to find what is going on but have not succeeded, as stated above.
I hope the zipped file does the trick...
Kind regards
- Attachments
-
- snippets.cson.zip
- (542 Bytes) Downloaded 257 times
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: lcb file snippet for the Atom editor
Thanks Bernd,
That worked perfectly!
Simon
That worked perfectly!
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: lcb file snippet for the Atom editor
Hi Bernd,
Would you like to add these to my Atom package? I'm always keen to receive improvements!
Would you like to add these to my Atom package? I'm always keen to receive improvements!
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com
-
- VIP Livecode Opensource Backer
- Posts: 3999
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: lcb file snippet for the Atom editor
Hi Peter,
Where do you want me to put it?
Kind regards
Bernd
I would love to give that AndyP (Andy Piddock) gets the credit for this very nice idea to make a snippet for the header of a LCB file. I just expanded his idea.peter-b wrote:Would you like to add these to my Atom package? I'm always keen to receive improvements!
Where do you want me to put it?
Kind regards
Bernd
Re: lcb file snippet for the Atom editor
Please send me a patch or submit a pull request to my GitHub repository (no CLA is needed, it's a community project )bn wrote: I would love to give that AndyP (Andy Piddock) gets the credit for this very nice idea to make a snippet for the header of a LCB file. I just expanded his idea.
Where do you want me to put it?
https://github.com/peter-b/atom-language-livecode
Thank you so much for contributing!
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com
Re: lcb file snippet for the Atom editor
Hi Folks
Nothing major to add but this version sorts out the indents and is a bit easier to edit:
EDIT
I had some more fun with this and this version will auto-select username first then you can tab to identifier, title etc.
I went looking for a way to define a variable somewhere central for author, username etc but it's not available yet. There appears to be some work going on for this but not yet complete: https://github.com/atom/snippets/pull/83
Nothing major to add but this version sorts out the indents and is a bit easier to edit:
EDIT
I had some more fun with this and this version will auto-select username first then you can tab to identifier, title etc.
I went looking for a way to define a variable somewhere central for author, username etc but it's not available yet. There appears to be some work going on for this but not yet complete: https://github.com/atom/snippets/pull/83
Code: Select all
'.source.iRev, .source.lcb':
'lcbtemplate':
'prefix': 'lcbt'
'body': """
-- declaring extension as widget, followed by identifier
widget community.livecode.${1:username}.${2:identifier}
use com.livecode.canvas
use com.livecode.widget
use com.livecode.engine
metadata title is "${3:title}"
metadata author is "${4:author}"
metadata version is "${5:1.0.0}"
-- property yourProperty get mYourVariable set yourSetCommand
public handler OnLoad(in pProperties as Array)
-- your code here
put pProperties["myProperty"] into mMyVariable
end handler
public handler OnSave(out rProperties as Array)
-- your code here
put the empty array into rProperties
put mMyVariable into rProperties["myProperty"]
return rProperties
end handler
public handler OnCreate()
-- your code here
end handler
public handler OnPaint()
-- your code here
end handler
end widget
"""
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/