Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a command to wrap Docblock comments at 80 chars (disabled by de…

…fault)

Updated the PHPDoc Help command
Added a Documentation for Tag command for PHPDoc info tags
Updated menu structure


git-svn-id: http://svn.textmate.org/trunk/Bundles/PHP.tmbundle@6651 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
commit 7607295341aa4452a97c8080f3b809b7ad0852f3 1 parent c8f3871
@ciaran ciaran authored
View
25 Commands/Documentation for Tag.tmCommand
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>if grep &lt;&lt;&lt;${TM_CURRENT_WORD:-!} -Esq '[@a-zA-Z]+'
+ then exit_show_html "&lt;meta http-equiv='Refresh' content='0;URL=http://manual.phpdoc.org/HTMLframesConverter/earthli/phpDocumentor/tutorial_tags.${TM_CURRENT_WORD#@}.pkg.html'&gt;"
+ else echo "Nothing to lookup (hint: place the caret on a tag)"
+fi</string>
+ <key>input</key>
+ <string>none</string>
+ <key>keyEquivalent</key>
+ <string>^h</string>
+ <key>name</key>
+ <string>Documentation for Tag</string>
+ <key>output</key>
+ <string>showAsTooltip</string>
+ <key>scope</key>
+ <string>comment.block.documentation.phpdoc.php</string>
+ <key>uuid</key>
+ <string>42F50AE3-4F1C-43EB-9722-D80261A19625</string>
+</dict>
+</plist>
View
7 Commands/PHPDoc Help.tmCommand
@@ -25,6 +25,7 @@ This bundle contains snippets for use with [PHPDoc](http://phpdoc.org/).
* `doc_s ` — Abstract function signature
* `doc_v ` — Class variable
* `doc_vp` — Class variable (post documentation)
+ * `doc` — Generates a docblock for the item following the caret. Currently supports a class/interface, function, define or variable
_Commands marked as “post documentation” are designed for undocumented code — in other words, a comment block is added at the caret position._
@@ -35,6 +36,12 @@ The snippets make use of two environment variables (_set these under Preferences
* `TM_ORGANIZATION_NAME` — default value of @copyright [+ date]
* `PHPDOC_AUTHOR` — default value of @author (realname will be used if not set)
+If you want docblocks to automatically wrap after 80 columns, you need to set it up:
+
+1. Open the Bundle Editor (&amp;#x2303;&amp;#x2325;&amp;#x2318;B)
+2. Find and select the “Wrap Docblock at 80 Characters” command
+3. Click in the white box next to “Key Equivalent” and press space
+4. Close the Bundle Editor
EOF</string>
<key>input</key>
<string>none</string>
View
64 Commands/Post-doc.tmCommand
@@ -5,54 +5,38 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>#!/usr/bin/ruby
+ <string>. "$TM_SUPPORT_PATH/lib/webpreview.sh"
+html_header PHPDoc
-next_line = STDIN.read.to_a[ENV['TM_LINE_NUMBER'].to_i..-1].join("\n").strip[/.+$/]
+Markdown.pl &lt;&lt;'EOF'
-puts '/**'
+# Snippets
-@tags = []
-type = ''
-author = true
+This bundle contains snippets for use with [PHPDoc](http://phpdoc.org/).
-def tag(tag, default, trailing = nil)
- @tags &lt;&lt; {:tag =&gt; tag, :default =&gt; default, :trailing =&gt; trailing}
-end
+ * `doc_c ` — Class
+ * `doc_cp` — Class (post documentation)
+ * `doc_d ` — Define inline constant
+ * `doc_dp` — Define inline constant (post documentation)
+ * `doc_f ` — Function
+ * `doc_fp` — Function (post documentation)
+ * `doc_h ` — Document header
+ * `doc_i ` — Interface class
+ * `doc_s ` — Abstract function signature
+ * `doc_v ` — Class variable
+ * `doc_vp` — Class variable (post documentation)
+ * `doc` — Generates a docblock for the item following the caret (a class/interface, function, define or variable)
-case next_line
-when /(class|interface)/
- type = $&amp;
- tag 'package', 'default'
-when /function\s*\((.*)\)/
- type = 'function'
- $1.split(/,/).each do |arg|
- tag 'param', 'string', '\\$' + arg[/[A-z0-9]+/].strip
- end
- tag 'return', 'void'
-when /const|define/
- type = 'constant'
- author = false
-when /var|p(ublic|rivate|rotected)/
- type = 'variable'
- tag 'var', 'string'
- author = false
-end
+_Commands marked as “post documentation” are designed for undocumented code — in other words, a comment block is added at the caret position._
-puts " * ${1:undocumented #{type}}"
-puts ' *' if @tags.size &gt; 0 or author
+# Shell Variables
-placeholder = 1
-@tags.each do |tag|
- placeholder += 1
- if tag[:trailing]
- puts " * @#{tag[:tag]} ${#{placeholder}:#{tag[:default]}} #{tag[:trailing] } \$#{placeholder += 1}"
- else
- puts " * @#{tag[:tag]} ${#{placeholder}:#{tag[:default]}}"
- end
-end
+The snippets make use of two environment variables (_set these under Preferences &amp;#x2192; Advanced &amp;#x2192; Shell Variables_).
-puts ' * @author ${PHPDOC_AUTHOR:`niutil -readprop / "/users/$USER" realname`}$' + (placeholder + 1).to_s if author
-puts ' */$0'</string>
+ * `TM_ORGANIZATION_NAME` — default value of @copyright [+ date]
+ * `PHPDOC_AUTHOR` — default value of @author (realname will be used if not set)
+
+EOF</string>
<key>fallbackInput</key>
<string>scope</string>
<key>input</key>
View
27 Commands/Wrap Docblock at 80 Characters.tmCommand
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>#!/usr/bin/ruby
+col = ENV['TM_COLUMN_NUMBER'].to_i
+start_col = ENV['TM_CURRENT_LINE'].index('*')
+if col - start_col &gt;= 80
+ puts
+ print " " * start_col + "*"
+end
+print " "</string>
+ <key>input</key>
+ <string>none</string>
+ <key>name</key>
+ <string>Wrap Docblock at 80 Characters</string>
+ <key>output</key>
+ <string>afterSelectedText</string>
+ <key>scope</key>
+ <string>comment.block.documentation.phpdoc.php</string>
+ <key>uuid</key>
+ <string>6F7E7868-F5A2-4B7D-ACFB-2A8DE2CD04E2</string>
+</dict>
+</plist>
View
23 info.plist
@@ -32,13 +32,26 @@
<string>34E2C808-8CCF-11D9-B507-000D93C8BE28</string>
<string>4833C612-8CCF-11D9-B507-000D93C8BE28</string>
<string>------------------------------------</string>
- <string>BB471E3A-8CCD-11D9-B507-000D93C8BE28</string>
<string>2B91DE5F-8CD0-11D9-B507-000D93C8BE28</string>
<string>CBF8F204-8CCF-11D9-B507-000D93C8BE28</string>
<string>7720523B-8CCE-11D9-B507-000D93C8BE28</string>
+ <string>93896C6F-4D1B-47EA-94B2-887CAB6ABFC2</string>
</array>
<key>submenus</key>
<dict>
+ <key>93896C6F-4D1B-47EA-94B2-887CAB6ABFC2</key>
+ <dict>
+ <key>items</key>
+ <array>
+ <string>BB471E3A-8CCD-11D9-B507-000D93C8BE28</string>
+ <string>117476CE-7A7F-4DC4-9A4E-772D282983A3</string>
+ <string>ED759470-69D7-4ADF-9842-D890DEB00F19</string>
+ <string>4F33617A-80FE-47D2-84AF-AA3D5D8A7128</string>
+ <string>1E34E416-CD16-4C16-A369-9CDC3FAFD4C4</string>
+ </array>
+ <key>name</key>
+ <string>HTML</string>
+ </dict>
<key>A3930E6A-FFFE-4E60-B797-052D34824F68</key>
<dict>
<key>items</key>
@@ -92,8 +105,10 @@
<key>items</key>
<array>
<string>EBD6D4CF-9F5E-4616-9880-5D3FF21EF408</string>
+ <string>42F50AE3-4F1C-43EB-9722-D80261A19625</string>
<string>------------------------------------</string>
<string>775F7FCC-C43C-4C23-B935-9D5F6C25CF1D</string>
+ <string>94D8B40B-9F49-4B6D-90B5-DBFF5FB36590</string>
<string>------------------------------------</string>
<string>9086BA3F-87E7-11D9-A6A3-000D93589AF6</string>
<string>C65A0A03-956D-11D9-B0A1-000D93382786</string>
@@ -175,8 +190,14 @@
<string>9087051B-87E7-11D9-A6A3-000D93589AF6</string>
<string>2CDD1B21-956E-11D9-B0A1-000D93382786</string>
<string>908774B1-87E7-11D9-A6A3-000D93589AF6</string>
+ <string>42F50AE3-4F1C-43EB-9722-D80261A19625</string>
<string>90872B90-87E7-11D9-A6A3-000D93589AF6</string>
<string>90874D6F-87E7-11D9-A6A3-000D93589AF6</string>
+ <string>94D8B40B-9F49-4B6D-90B5-DBFF5FB36590</string>
+ <string>117476CE-7A7F-4DC4-9A4E-772D282983A3</string>
+ <string>ED759470-69D7-4ADF-9842-D890DEB00F19</string>
+ <string>4F33617A-80FE-47D2-84AF-AA3D5D8A7128</string>
+ <string>1E34E416-CD16-4C16-A369-9CDC3FAFD4C4</string>
</array>
<key>uuid</key>
<string>467A1966-6227-11D9-BFB1-000D93589AF6</string>
Please sign in to comment.
Something went wrong with that request. Please try again.