Block commenting Haskell code in textwrangler

1.2k views Asked by At

I am new to textwrangler and I am trying to figure out how to have a shortcut for commenting out blocks of haskell code. The available Un/Comment Block option from the menu doesn't seem to do anything.

I've used Prefix/suffix lines but that is just too awkward. Does anyone have any suggestions?

Thanks

1

There are 1 answers

0
Kartik Sabharwal On

I'm assuming you're using TextWrangler on OS X.

When you're running TextWrangler you should see a little scroll in the menu bar (the AppleScript button). Click it. Then choose the 'Open Script Editor' option. Go to your Desktop folder and click 'New Document'. Name the file something like 'comment_script'. Type the following text into the editor window that appears:

tell application "TextWrangler"
    set my_selection to selection
    set my_selection to "{-\n" & my_selection & "\n-}"
    set selection to my_selection
end tell

Save it and quit the editor. Once you're done with that, copy the comment_script file to the folder ~/Library/Application\ Support/TextWrangler/Scripts

Now you'll find comment_script in the script menu (the one with the scroll). Select some text in TextWrangler and then click on comment_script in the script menu to comment the selection.