Skip to content

Commit

Permalink
Change names to PEP 8 underscore style and add some docs links
Browse files Browse the repository at this point in the history
  • Loading branch information
williamd1k0 committed Jun 4, 2016
1 parent 14ae2db commit 7d466c6
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 122 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Remove duplicates;
* Fix typos;
* Add basic snippets info;
* Change names to PEP 8 underscore style;

## 1.5.6
* Fix `menu` without name;
Expand Down
257 changes: 135 additions & 122 deletions snippets/language-renpy.cson
Original file line number Diff line number Diff line change
@@ -1,191 +1,204 @@
'.source.renpy':
## Renpy Snippets
'Label':
'prefix': 'label'
'body': 'label ${1:labelName}:\n\t${2:}'
'description': 'Create a new label \n- Use the snippet `dochelp` or `helplabel` to see doc info.'
prefix: 'label'
body: 'label ${1:label_name}:\n\t${2:}'
description: 'Create a new label \n- Click in "More..." for doc info.'
descriptionMoreURL: 'https://www.renpy.org/doc/html/label.html'
'Jump':
prefix: 'jump'
body: 'jump ${1:label_name}'
description: 'Jump to a label \n- Click in "More..." for doc info.'
descriptionMoreURL: 'https://www.renpy.org/doc/html/label.html#jump-statement'
'Call':
prefix: 'call'
body: 'call ${1:label_name}'
description: 'Call a label \n- Click in "More..." for doc info.'
descriptionMoreURL: 'https://www.renpy.org/doc/html/label.html#jump-statement'
'Pause':
'prefix': 'pause'
'body': 'with Pause($1)\n$2'
prefix: 'pause'
body: 'with Pause($1)\n$2'
description: 'Wait a few seconds before showing the next screen \n- Click in "More..." for doc info.'
descriptionMoreURL: 'https://www.renpy.org/doc/html/transitions.html#Pause'
'One Line Python':
'prefix': 'p1'
'body': '$ ${1:#python statements}'
prefix: 'p1'
body: '$ ${1:#python statements}'
description: 'Execute a single line of Python\n- Click in "More..." for doc info.'
descriptionMoreURL: 'https://www.renpy.org/doc/html/python.html#one-line-python-statement'
'Python in Block':
'prefix': 'py'
'body': 'python:\n\t${1:}'
prefix: 'py'
body: 'python:\n\t${1:}'
description: 'The python statement takes a block of python code \n- Click in "More..." for doc info.'
descriptionMoreURL: 'https://www.renpy.org/doc/html/python.html'
'Init Block':
'prefix': 'init'
'body': 'init ${1:#priority number}:\n\t${2:}'
prefix: 'init'
body: 'init ${1:#priority number}:\n\t${2:}'
description: 'Run python code at initialization time \n- Click in "More..." for doc info.'
descriptionMoreURL: 'https://www.renpy.org/doc/html/python.html#init-python-statement'
'Init with Python Block':
'prefix': 'inipy'
'body': 'init ${1:#priority number} python:\n\t${2:}'
prefix: 'inipy'
body: 'init ${1:#priority number} python:\n\t${2:}'
'Create a Character':
'prefix': 'char'
'body': 'define ${1:characterName} = Character("${2:displayableName}")'
prefix: 'char'
body: 'define ${1:character_name} = Character("${2:displayable name}")'
'Create a Character (NVL)':
'prefix': 'charnvl'
'body': 'define ${1:characterName} = Character(None, kind=nvl)\n${2:}'
prefix: 'charnvl'
body: 'define ${1:character_name} = Character(None, kind=nvl)\n${2:}'
'PreDefined Transitions':
'prefix': 'transitions'
'body': '${1:fade, dissolve, pixellate, move,\nmoveinright (Also: moveinleft, moveintop, moveinbottom),\nmoveoutright (Also: moveoutleft, moveouttop, moveoutbottom),\nease (Also: easeinright, easeinleft, easeintop, easeinbottom, easeoutright, easeoutleft, easeouttop, easeoutbottom),\nzoomin, zoomout, zoominout, vpunch, hpunch, blinds, squares,\nwipeleft (Also: wiperight, wipeup, wipedown),\nslideleft (Also: slideright, slideup, slidedown),\nslideawayleft (Also: slideawayright, slideawayup, slideawaydown),\nirisin, irisout.}'
'Jump to a Label':
'prefix': 'jump'
'body': 'jump ${1:labelName}'
'Call a Label':
'prefix': 'call'
'body': 'call ${1:labelName}'
prefix: 'transitions'
body: '${1:fade, dissolve, pixellate, move,\nmoveinright (Also: moveinleft, moveintop, moveinbottom),\nmoveoutright (Also: moveoutleft, moveouttop, moveoutbottom),\nease (Also: easeinright, easeinleft, easeintop, easeinbottom, easeoutright, easeoutleft, easeouttop, easeoutbottom),\nzoomin, zoomout, zoominout, vpunch, hpunch, blinds, squares,\nwipeleft (Also: wiperight, wipeup, wipedown),\nslideleft (Also: slideright, slideup, slidedown),\nslideawayleft (Also: slideawayright, slideawayup, slideawaydown),\nirisin, irisout.}'
## Init Block
'[i] Create MultiPersistent (Only PC)':
'prefix': 'MultiPersistent'
'body': '${1:persistentName} = MultiPersistent("${2:persistentFileName}")'
prefix: 'MultiPersistent'
body: '${1:persistent_name} = MultiPersistent("${2:persistent_filename}")'
## Python one-line
'[$] Variable(Create/Modify)':
'prefix': 'var'
'body': '$ ${1:variable_name} = ${2:#variable value}'
prefix: 'var'
body: '$ ${1:variable_name} = ${2:# variable value}'
'[$] Variable(Create/Modify)':
'prefix': '$'
'body': '$ ${1:variable_name} = ${2:#variable value}'
prefix: '$'
body: '$ ${1:variable_name} = ${2:# variable value}'
'[$] Renpy Pause':
'prefix': 'rpause'
'body': '$ renpy.pause($1)\n$2'
prefix: 'rpause'
body: '$ renpy.pause($1)\n$2'
'[$] Movie Cutscene (All Platforms)':
'prefix': 'cutscene'
'body': '$ renpy.movie_cutscene(\'${1:fileName.extension}\')'
prefix: 'cutscene'
body: '$ renpy.movie_cutscene(\'${1:file_name.extension}\')'
'[$] Save Persistent (All Platforms)':
'prefix': 'persist'
'body': '$ persistent.${1:valueName} = ${2:#variable}'
prefix: 'persist'
body: '$ persistent.${1:attribute_name} = ${2:# variable value}'
'[$] Save MultiPersistent (Only PC)':
'prefix': 'SaveMulti'
'body': '$ ${1:persistentName}.save()'
prefix: 'multisave'
body: '$ ${1:persistent_name}.save()'
## Transitions
'[T] Fade':
'prefix': 'wFade'
'body': 'with fade'
prefix: 'wFade'
body: 'with fade'
'[T] Dissolve':
'prefix': 'wDissolve'
'body': 'with dissolve'
prefix: 'wDissolve'
body: 'with dissolve'
'[T] Pixellate':
'prefix': 'wPixel'
'body': 'with pixellate'
prefix: 'wPixel'
body: 'with pixellate'
'[T] Move':
'prefix': 'wMove'
'body': 'with move'
prefix: 'wMove'
body: 'with move'
'[T] Move in Right':
'prefix': 'wMoveInRight'
'body': 'with moveinright'
prefix: 'wMoveInRight'
body: 'with moveinright'
'[T] Move in Left':
'prefix': 'wMoveInLeft'
'body': 'with moveinleft'
prefix: 'wMoveInLeft'
body: 'with moveinleft'
'[T] Move in Top':
'prefix': 'wMoveInTop'
'body': 'with moveintop'
prefix: 'wMoveInTop'
body: 'with moveintop'
'[T] Move in Bottom':
'prefix': 'wMoveInBottom'
'body': 'with moveinbottom'
# Built-in Python
prefix: 'wMoveInBottom'
body: 'with moveinbottom'
# Built-in Python/Ren'Py
'If (Conditional Statement)':
'prefix': 'if'
'body': 'if ${1:condition}:\n\t${2:#block of code to run}'
prefix: 'if'
body: 'if ${1:condition}:\n\t${2:#block of code to run}'
'Else If (Conditional Statement)':
'prefix': 'elif'
'body': 'elif ${1:condition}:\n\t${2:#block of code to run}'
prefix: 'elif'
body: 'elif ${1:condition}:\n\t${2:#block of code to run}'
'Else (Conditional Statement)':
'prefix': 'else'
'body': 'else:\n\t${1:#block of code to run}'
prefix: 'else'
body: 'else:\n\t${1:#block of code to run}'
'While (Loop)':
'prefix': 'while'
'body': 'while ${1:condition}:\n\t${2:#block of code to run}'
prefix: 'while'
body: 'while ${1:condition}:\n\t${2:#block of code to run}'
# Choice Menus
'Choice Menu':
'prefix': 'menu'
'body': 'menu ${1:optionalName}:\n\t"${2:Say Statement}"\n\t"${3:Choice 1}":\n\t\t#block of code to run\n\t"${4:Choice 2}":\n\t\t#block of code to run\n\t${5:}'
prefix: 'menu'
body: 'menu ${1:optional_name}:\n\t"${2:Say Statement}"\n\t"${3:Choice 1}":\n\t\t#block of code to run\n\t"${4:Choice 2}":\n\t\t#block of code to run\n\t${5:}'
'Menu Choice':
'prefix': 'choice'
'body': '"${1:Choice N}":\n\t${2:#block of code to run}\n\t$3'
prefix: 'choice'
body: '"${1:Choice N}":\n\t${2:#block of code to run}\n\t$3'
# Ren'Py Docs
'Ren\'Py Docs':
'prefix': 'dochelp'
'body': '## Visit the site for documentation or help of Ren\'Py engine. ##\n## Documentation:\n\t"${1:http://www.renpy.org/doc/html/}"\n## Wiki-Old Documentation:\n\t"${2:http://www.renpy.org/wiki/renpy/Wiki_Home_Page}"\n## Forum:\n\t"${3:http://lemmasoft.renai.us/forums/viewforum.php?f=42}"\n## Package Documentation:\n\t"${4:https://github.com/williamd1k0/language-renpy#getting-started}"\n\n## Warning: All snippets that start with [Py] are for Python commands and [$] are for One Line Python.'
prefix: 'dochelp'
body: '## Visit the site for documentation or help of Ren\'Py engine. ##\n## Documentation:\n\t"${1:http://www.renpy.org/doc/html/}"\n## Wiki-Old Documentation:\n\t"${2:http://www.renpy.org/wiki/renpy/Wiki_Home_Page}"\n## Forum:\n\t"${3:http://lemmasoft.renai.us/forums/viewforum.php?f=42}"\n## Package Documentation:\n\t"${4:https://github.com/williamd1k0/language-renpy#getting-started}"\n\n## Warning: All snippets that start with [Py] are for Python commands and [$] are for One Line Python.'
## Python Block
# Assert (hidden)
'[Py] Assert Equal':
'prefix': ',ase'
'body': 'self.assertEqual(${1:expected}, ${2:actual}${3:, \'${4:message}\'})$0'
prefix: ',ase'
body: 'self.assertEqual(${1:expected}, ${2:actual}${3:, \'${4:message}\'})$0'
'[Py] Assert Not Equal':
'prefix': ',asne'
'body': 'self.assertNotEqual(${1:expected}, ${2:actual}${3:, \'${4:message}\'})$0'
prefix: ',asne'
body: 'self.assertNotEqual(${1:expected}, ${2:actual}${3:, \'${4:message}\'})$0'
'[Py] Assert Raises':
'prefix': ',asr'
'body': 'self.assertRaises(${1:exception}, ${2:callable})$0'
prefix: ',asr'
body: 'self.assertRaises(${1:exception}, ${2:callable})$0'
'[Py] Assert True':
'prefix': ',ast'
'body': 'self.assertTrue(${1:actual}${2:, \'${3:message}\'})$0'
prefix: ',ast'
body: 'self.assertTrue(${1:actual}${2:, \'${3:message}\'})$0'
'[Py] Assert False':
'prefix': ',asf'
'body': 'self.assertFalse(${1:actual}${2:, \'${3:message}\'})$0'
prefix: ',asf'
body: 'self.assertFalse(${1:actual}${2:, \'${3:message}\'})$0'
'[Py] Assert Is':
'prefix': ',asi'
'body': 'self.assertIs(${1:expected}, ${2:actual}${3:, \'${4:message}\'})$0'
prefix: ',asi'
body: 'self.assertIs(${1:expected}, ${2:actual}${3:, \'${4:message}\'})$0'
'[Py] Assert Is Not':
'prefix': ',asint'
'body': 'self.assertIsNot(${1:expected}, ${2:actual}${3:, \'${4:message}\'})$0'
prefix: ',asint'
body: 'self.assertIsNot(${1:expected}, ${2:actual}${3:, \'${4:message}\'})$0'
'[Py] Assert Is None':
'prefix': ',asino'
'body': 'self.assertIsNone(${1:actual}${2:, \'${3:message}\'})$0'
prefix: ',asino'
body: 'self.assertIsNone(${1:actual}${2:, \'${3:message}\'})$0'
'[Py] Assert Is Not None':
'prefix': ',asinno'
'body': 'self.assertIsNotNone(${1:actual}${2:, \'${3:message}\'})$0'
prefix: ',asinno'
body: 'self.assertIsNotNone(${1:actual}${2:, \'${3:message}\'})$0'
'[Py] Assert In':
'prefix': ',asin'
'body': 'self.assertIn(${1:needle}, ${2:haystack}${3:, \'${4:message}\'})$0'
prefix: ',asin'
body: 'self.assertIn(${1:needle}, ${2:haystack}${3:, \'${4:message}\'})$0'
'[Py] Assert Not In':
'prefix': ',asni'
'body': 'self.assertNotIn(${1:needle}, ${2:haystack}${3:, \'${4:message}\'})$0'
prefix: ',asni'
body: 'self.assertNotIn(${1:needle}, ${2:haystack}${3:, \'${4:message}\'})$0'
'[Py] Assert':
'prefix': ',as'
'body': 'self.assert_(${1:boolean expression}${2:, \'${3:message}\'})$0'
prefix: ',as'
body: 'self.assert_(${1:boolean expression}${2:, \'${3:message}\'})$0'
'[Py] Fail (a test)':
'prefix': 'fail'
'body': 'self.fail(\'${1:message}\')$0'
prefix: 'fail'
body: 'self.fail(\'${1:message}\')$0'
# Class
'[Py] New Class':
'prefix': 'class'
'body': 'class ${1:ClassName}(${2:object}):\n\t"""${3:docstring for $1}"""\n\tdef __init__(self, ${4:arg}):\n\t\t${5:super($1, self).__init__()}\n\t\tself.arg = arg\n\t\t$0'
prefix: 'class'
body: 'class ${1:ClassName}(${2:object}):\n\t"""${3:docstring for $1}"""\n\tdef __init__(self, ${4:arg}):\n\t\t${5:super($1, self).__init__()}\n\t\tself.arg = arg\n\t\t$0'
'[Py] New Method':
'prefix': 'defs'
'body': 'def ${1:mname}(self, ${2:arg}):\n\t${3:pass}'
prefix: 'defs'
body: 'def ${1:mname}(self, ${2:arg}):\n\t${3:pass}'
'[Py] New Function':
'prefix': 'def'
'body': 'def ${1:fname}(${2:arg}):\n\t${3:pass}'
prefix: 'def'
body: 'def ${1:fname}(${2:arg}):\n\t${3:pass}'
'[Py] New Property':
'prefix': 'property'
'body': 'def ${1:foo}():\n doc = "${2:The $1 property.}"\n def fget(self):\n ${3:return self._$1}\n def fset(self, value):\n ${4:self._$1 = value}\n def fdel(self):\n ${5:del self._$1}\n return locals()\n$1 = property(**$1())$0'
prefix: 'property'
body: 'def ${1:foo}():\n doc = "${2:The $1 property.}"\n def fget(self):\n ${3:return self._$1}\n def fset(self, value):\n ${4:self._$1 = value}\n def fdel(self):\n ${5:del self._$1}\n return locals()\n$1 = property(**$1())$0'
# Others
'[Py] For (Loop)':
'prefix': 'for'
'body': 'for ${1:value} in ${2:variable}:\n\t${3:pass}'
prefix: 'for'
body: 'for ${1:value} in ${2:variable}:\n\t${3:pass}'
'[Py] Try/Except':
'prefix': 'try'
'body': 'try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise $3}'
prefix: 'try'
body: 'try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise $3}'
'[Py] List Comprehension':
'prefix': 'lc'
'body': '[${1:value} for ${2:value} in ${3:variable}]'
prefix: 'lc'
body: '[${1:value} for ${2:value} in ${3:variable}]'
'[Py] List Comprehension If Else':
'prefix': 'lcie'
'body': '[${1:value} if ${2:condition} else ${3:condition} for ${4:value} in ${5:variable}]'
prefix: 'lcie'
body: '[${1:value} if ${2:condition} else ${3:condition} for ${4:value} in ${5:variable}]'
'[Py] Dictionary Comprehension':
'prefix': 'dc'
'body': '{${1:key}: ${2:value} for ${3:key}, ${4:value} in ${5:variable}}'
prefix: 'dc'
body: '{${1:key}: ${2:value} for ${3:key}, ${4:value} in ${5:variable}}'
'[Py] PDB set trace':
'prefix': 'pdb'
'body': 'import pdb; pdb.set_trace()\n'
prefix: 'pdb'
body: 'import pdb; pdb.set_trace()\n'
'[Py] iPDB set trace':
'prefix': 'ipdb'
'body': 'import ipdb; ipdb.set_trace()\n'
prefix: 'ipdb'
body: 'import ipdb; ipdb.set_trace()\n'
'[Py] __magic__':
'prefix': '__'
'body': '__${1:init}__'
prefix: '__'
body: '__${1:init}__'
'.source.renpy:not(.string)':
'self':
'prefix': '.'
'body': 'self.'
prefix: '.'
body: 'self.'

0 comments on commit 7d466c6

Please sign in to comment.