<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>netCUBED Blog &#187; textmate</title>
	<atom:link href="http://blog.netcubed.de/tag/textmate/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.netcubed.de</link>
	<description>Just another web developer's weblog</description>
	<lastBuildDate>Mon, 29 Jun 2009 20:58:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Perl autocompletion of methods for TextMate</title>
		<link>http://blog.netcubed.de/2009/06/perl-autocompletion-of-methods-for-textmate/</link>
		<comments>http://blog.netcubed.de/2009/06/perl-autocompletion-of-methods-for-textmate/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 08:26:01 +0000</pubDate>
		<dc:creator>Moritz Onken</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[auto completion]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[completion]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://blog.netcubed.de/?p=120</guid>
		<description><![CDATA[It is pretty hard to write a code completion script for perl since it&#8217;s hard to find out of which type a variable is. I use simple regexes and a comment to achieve this. Here is how it looks like:
It consists of a perl script which reads the current file from STDIN and gets the [...]]]></description>
			<content:encoded><![CDATA[<span class='flash'><span id='flash-perl-autocompletion-of-methods-for-textmate1.58507612528E+37'></span></span>
<script type='text/javascript'>
var params = {
allowfullscreen: 'true'
};var flashvars = null
swfobject.embedSWF('http://blog.netcubed.de/wp-content/uploads/2009/06/2009-06-10_1002.swf', 'flash-perl-autocompletion-of-methods-for-textmate1.58507612528E+37', '574', '474', '9.0.0', '', flashvars, params, '');
</script>
<p>It is pretty hard to write a code completion script for perl since it&#8217;s hard to find out of which type a variable is. I use simple regexes and a comment to achieve this. Here is how it looks like:</p>
<p>It consists of a perl script which reads the current file from STDIN and gets the current line number as well as the cursor position in that line. The script is run if the cursor is behind a <code>-&gt;</code> and the string before that looks like a class or a variable. If it&#8217;s a variable the script travels the lines up until it finds something like <code>$var = Class->new</code>, <code>$var = new Class</code> or <code> # $var isa Class</code>.</p>
<p><code>Class::MOP::Class</code> loads that class and retrieves all method names. It also evaluates the prefix which has been entered behind the <code>-></code> and displays those methods only which have the same prefix. Private methods are moved to the buttom as well as capitalized method names.</p>
<p>The second part of this script is embedded in TextMate. TextMate allows to define custom commands. You can define how the data shoud be rendered depending on the return value of the script. In this case STDERR is printed directly into the editor (if there is only one method left) and STDOUT is printed as tool tip.</p>
<p>I&#8217;d like to hear what you think about it and whether there are better / other approaches. I should probably use PPI instead of regexes to parse the document. This is one of the reasons why I did not release any code yet. Another shortcoming is speed. Especially for large classes like Catalyst or DateTime it takes a noticeable time until you get the results.</p>
<p>So long&#8230; I&#8217;ll keep you posted.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.netcubed.de/2009/06/perl-autocompletion-of-methods-for-textmate/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Format JavaScript in TextMate with JavaScript::Beautifier</title>
		<link>http://blog.netcubed.de/2009/06/format-javascript-in-textmate-with-javascriptbeautifier/</link>
		<comments>http://blog.netcubed.de/2009/06/format-javascript-in-textmate-with-javascriptbeautifier/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 17:08:53 +0000</pubDate>
		<dc:creator>Moritz Onken</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://blog.netcubed.de/?p=104</guid>
		<description><![CDATA[TextMate has a number of great bundles which help you develop in many many languages. The feature I miss most is formatting for JavaScript just like Perl Tidy does it for Perl.
I recently saw JavaScript::Beautifier in the &#8220;Recent&#8221; list on the CPAN and was wondering if I can bind it to TextMate. This is how [...]]]></description>
			<content:encoded><![CDATA[<p>TextMate has a number of great bundles which help you develop in many many languages. The feature I miss most is formatting for JavaScript just like Perl Tidy does it for Perl.</p>
<p>I recently saw <a href="http://search.cpan.org/perldoc?JavaScript::Beautifier">JavaScript::Beautifier</a> in the &#8220;Recent&#8221; list on the CPAN and was wondering if I can bind it to TextMate. This is how I did it:</p>
<p>First of all, install it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> cpan <span style="color: #660033;">-i</span> JavaScript::Beautifier</pre></div></div>

<p>Next, add the command to TextMate. Open the Bundle Editor (Bundles/Bundle Editor/Show Bundle Editor).</p>
<p style="text-align: center;"><img class="size-full wp-image-106   aligncenter" title="bild-1" src="http://blog.netcubed.de/wp-content/uploads/2009/06/bild-1.png" alt="bild-1" width="267" height="161" /></p>
<p style="text-align: left; clear:both">Then select JavaScript and click on &#8220;New Command&#8221; (bottom left).<img class="size-medium wp-image-107   aligncenter" title="bild-2" src="http://blog.netcubed.de/wp-content/uploads/2009/06/bild-2-300x220.png" alt="bild-2" width="300" height="220" /></p>
<p style="text-align: left; clear:both">Name it &#8220;Beautifier&#8221; (or whatever you want) and paste the following in the command text field:</p>
<pre>require_cmd js_beautify.pl 'sudo cpan -i JavaScript::Beautifier'

js_beautify.pl $TM_FILEPATH</pre>
<p>Set the rest of the options like this:</p>
<pre style="text-align: center;"><img class="size-full wp-image-108" title="bild-3" src="http://blog.netcubed.de/wp-content/uploads/2009/06/bild-3.png" alt="bild-3" width="457" height="466" /></pre>
<p>Now you are ready to go! Open up a JavaScript document and hit Shift+Crtl+H and the current document should be formatted.</p>
<p style="text-align: center;"><img class="size-full wp-image-105   aligncenter" title="bild-9" src="http://blog.netcubed.de/wp-content/uploads/2009/06/bild-9.png" alt="bild-9" width="234" height="134" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.netcubed.de/2009/06/format-javascript-in-textmate-with-javascriptbeautifier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
