Hi there, I've just downloaded Textmate and am really enjoying using it though there is one basic feature that I can't seem to find:
-how do I auto-format my code?
I program in Actionscript and am used to pressing the 'Auto Format' button in the Flash Actions panel to tidy up my formatting.
I've looked at the manual and through the documentation but I can't seem to figure this out!
Any help much appreciated and if anyone has any other specific tips for AS users using Textmate please let me know :)
Thanks, Ali
On 9/10/07, Alistair Colling alistair.colling@gmail.com wrote:
-how do I auto-format my code?
That would be Command + A (Select All) and then Command + Alt + [ (Indent Selection)
Any help much appreciated and if anyone has any other specific tips for AS users using Textmate please let me know :)
I post updates to the bundle on my blog http://bomberstudios.com and plan on writing some more about general TextMate tips (including AS stuff :)
Thanks Ale that's great, and one more I forgot to ask, is there a shortcut for 'check syntax'? Thanks for the heads up on yr blog, the growl plugin looks v interesting:) Kind regards, Ali
On 10 Sep 2007, at 21:59, Ale Muñoz wrote:
On 9/10/07, Alistair Colling alistair.colling@gmail.com wrote:
-how do I auto-format my code?
That would be Command + A (Select All) and then Command + Alt + [ (Indent Selection)
Any help much appreciated and if anyone has any other specific tips for AS users using Textmate please let me know :)
I post updates to the bundle on my blog http://bomberstudios.com and plan on writing some more about general TextMate tips (including AS stuff :)
-- Ale Muñoz http://sofanaranja.com http://bomberstudios.com
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 9/10/07, Alistair Colling alistair.colling@gmail.com wrote:
is there a shortcut for 'check syntax'?
Hmmm... there's no 'Check Syntax' command on the ActionScript bundle... but now that you mention it, it looks like a good addition to the arsenal...
Will look into it when I have some free time...
On 9/10/07, Ale Muñoz bomberstudios@gmail.com wrote:
Hmmm... there's no 'Check Syntax' command on the ActionScript bundle... but now that you mention it, it looks like a good addition to the arsenal...
Talk about good timing. I had to debug some stuff for a project, and thought this command would be *very* useful.
Thus, I've pushed a new "Validate Syntax" command to the repository. It's bound to Control + Shift + V, for consistency with other bundles.
Please try it and see if it works for you.
Hey Ale, thanks for your help and sorry it's taken so long for me to reply. I have started putting some effort into using Textmate and am really enjoying it. I've tried to get your 'Validate Syntax' snippet to work but I get an error message:
/tmp/temp_textmate.dRzeHI:32: syntax error if errors.empty? && warnings.empty?
I think it is probably down to me copying the code for the snippet incorrectly but I'm not totally sure what I'm doing, I copied the code in the string node (below) If you could point out what I'm doing wrong I would be really grateful. Cheers! Ali
http://www.nabble.com/file/p13290317/validate%2Bsyntax.jpg #!/usr/bin/env ruby
require 'open3' require ENV["TM_SUPPORT_PATH"] + "/lib/web_preview" require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes"
filename = ENV['TM_FILEPATH']
cmd = "'#{ENV['TM_BUNDLE_SUPPORT']}/bin/mtasc' '#{filename}'"
stdin, stdout, stderr = Open3.popen3(cmd)
warnings = [] errors = [] while err = stderr.gets if err[0, 10] == 'Warning : ' warnings.push(err.chomp) else m = /(.+):([0-9]+): characters ([0-9]+)-([0-9]+) : (.+)/.match(err) if m != nil if /^//.match(m[1]) real_path = m[1] else real_path = Dir.pwd + "/" + m[1] end a = "txmt://open?url=file://#{real_path}&line=#{m[2]}&column=#{m[3].to_i + 1}" err = "<a href="#{a}">#{File.basename(m[1])}, Line: #{m[2]} Column: #{m[3].to_i + 1} - #{m[5]}</a>" end errors.push(err.chomp) end end if errors.empty? && warnings.empty? puts "Syntax Ok" TextMate.exit_show_tool_tip else html_header("Validating Syntax for #{File.basename(filename)}","Validate Syntax") if !errors.empty? puts "<h2>Errors</h2>" puts errors end if !warnings.empty? puts "<h2>Warnings</h2>" puts warnings end html_footer TextMate.exit_show_html end
bomberstudios wrote:
On 9/10/07, Ale Muñoz bomberstudios@gmail.com wrote:
Hmmm... there's no 'Check Syntax' command on the ActionScript bundle... but now that you mention it, it looks like a good addition to the arsenal...
Talk about good timing. I had to debug some stuff for a project, and thought this command would be *very* useful.
Thus, I've pushed a new "Validate Syntax" command to the repository. It's bound to Control + Shift + V, for consistency with other bundles.
Please try it and see if it works for you.
-- Ale Muñoz http://sofanaranja.com http://bomberstudios.com
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
2007/10/19, AliAli ali@tombola.com:
I think it is probably down to me copying the code for the snippet incorrectly but I'm not totally sure what I'm doing, I copied the code in the string node (below)
Looks like you copied the code from the plist and pasted it on the bundle editor.
Try pasting this code instead:
http://pastie.textmate.org/108891
:)
Thanks again Ale :)
I have this working now. My new problem is I need to learn how to add new definitions to the help file as I am getting this error:
VersionChecker.as, Line: 137 Column: 9 - type error Unknown variable _url
If you could let me know how to do this that would be great as I can't seem to find a list of variables in the Bundles section and I think I need to add _url as a keyword or something.
Also I am getting this error: VersionChecker.as, Line: 147 Column: 41 - type error Unknown variable mcLoaded, this is the line of code:
mclListener.onLoadInit = mcLoaded(mc);
I have one last request as I am trying to compile using Textmate and MTASC but keep getting this error message:
sh: line 1: /Users/Ali/Library/Application Support/TextMate/Bundles/ActionScript.tmbundle/Support/bin/mtasc: No such file or directory
"/Users/Ali/Library/Application Support/TextMate/Bundles/ActionScript.tmbundle/Support/bin/mtasc" "myClass.as" -version 8 -header 800:600:31 -swf myApplication.swf
I've read through the help files but can't get this to work either. If you could direct me to a tutorial and send me a zip archive that I can open in Textmate and compile myself that would be great then I should be able to so it myself.
Sorry to keep nagging you, I don't tknow where else to go! please let me know if there is somewhere else I should be loooking :)
Kind regards, Ali
bomberstudios wrote:
2007/10/19, AliAli ali@tombola.com:
I think it is probably down to me copying the code for the snippet incorrectly but I'm not totally sure what I'm doing, I copied the code in the string node (below)
Looks like you copied the code from the plist and pasted it on the bundle editor.
Try pasting this code instead:
http://pastie.textmate.org/108891
:)
-- Ale Muñoz http://sofanaranja.com http://bomberstudios.com
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate