2 of 6
2
TEA for Espresso, 1.0
Posted: 21 March 2009 07:35 PM   [ Ignore ]   [ # 16 ]
Newbie
Rank
Total Posts:  11
Joined  2009-03-20

Looking good. I updated my repository files so you do not have to rename them anymore.

Profile
 
 
Posted: 28 March 2009 07:28 AM   [ Ignore ]   [ # 17 ]
Moderator
RankRankRankRank
Total Posts:  816
Joined  2008-10-28

I’ve bumped TEA for Espresso up to beta 5 (beta 4 was a bugfix-only version that got bundled into Espresso 1.0 shortly after release).  Since TEA is bundled with Espresso, I don’t recommend installing beta 5 unless you’re actively using TEA to supplement your workflow, in which case this has some very important bugs fixed.  Installation instructions are inside the zip (download linked from first post in this thread).  Short version: install it inside the Espresso bundle.  No point in messing around with Application Support since you’ll need to delete the bundled version, anyway.

New Features
Indent New Line is a new action that does about what it sounds like.  Say you create a div (pipe is cursor):

<div>|</div

Invoke Indent New Line (control-shift-enter) to magically obtain the following well-indented code:

<div>
    |
</
div

If you have any code selected, it will go along for the ride.  Without Textmate-style smart indentation, this action is one of the ones that I use constantly (originally developed it for Coda), and it’s useful for any language that follows the block - indent - closing block pattern.

Improvements
TEA’s internal selection of actions is improved, and I’ve made some of them more generally useful.  That’s all I’ll say for now, because until I get custom user actions back up and running, you probably won’t give a damn.

Bug fixes
- Attempting to invoke an action with syntax awareness (like almost anything in the Format menu) no longer causes Espresso to spin out for medium to large documents
- Attempting to run actions like Insert Linebreak(s) in an empty document no longer causes an error

Let me know if you find any bugs or have any features you’d like to see!

 Signature 

Ian Beck
Part-time MacRabbit Support

My stuff:
TEA (docs / source) .:. Spice.sugar .:. HTMLBundle.sugar .:. Quiet Light & Earthworm

Profile
 
 
Posted: 28 March 2009 07:39 AM   [ Ignore ]   [ # 18 ]
Sr. Member
RankRankRankRank
Total Posts:  202
Joined  2008-10-28

Awesome work!

 Signature 

PHP.sugar

“Quick! Get in the Tardis!”

Profile
 
 
Posted: 31 March 2009 07:14 AM   [ Ignore ]   [ # 19 ]
Moderator
RankRankRankRank
Total Posts:  816
Joined  2008-10-28

I just released beta 5?  Eh, screw it.  Here’s beta 6.  This one’s actually pretty exciting (to me, at least) because you can finally add custom actions to TEA simply by creating some XML files in the right place.  “But Espresso already has built-in snippets!” I hear you say.  Yeah, it does, but will it automatically indent your multi-line snippets based on the current indentation level?  Will it allow you to wrap the currently selected text in your snippet?  Will it let you easily share collections of snippets with your friends through GitHub or other version control?  Will it let you do things like wrap a snippet around each selected line or actions even more outrageous?

Didn’t think so.

There are two major downsides to using TEA’s custom actions:

1) You must edit moderately verbose XML in order to add actions (no UI for it at this point)
2) Once you’ve enabled them, you have to relaunch Espresso once to reload actions in existing files or twice whenever you add a new file

If you can live with these limitations, then I encourage you to take a look at the TEA for Espresso wiki’s Adding your own actions page and the simple tab completions tutorial.  Once you’ve figured out how to turn snippets on and get a tab completion in there, the generic action API details the various actions you can instruct TEA to undertake. (Please note that the syntax-aware snippet features are still, as they have been since 1.0b1, extremely stupid.  My advice is not to bother with them yet.)  You can also install a third party snippet collection if you don’t want to write your own.

One last note: if you find yourself looking at the generic action API and thinking that it just doesn’t quite cover what you want to do, you can actually create your own TEA actions in Python and invoke them from your custom action XML files.  Heck, you can completely override the default actions and make them do something different if you want.  Check out adding or overriding Python scripts for more info.

Enjoy, and let me know about any bugs you encounter, questions you have, or feature requests!

 Signature 

Ian Beck
Part-time MacRabbit Support

My stuff:
TEA (docs / source) .:. Spice.sugar .:. HTMLBundle.sugar .:. Quiet Light & Earthworm

Profile
 
 
Posted: 04 April 2009 11:20 PM   [ Ignore ]   [ # 20 ]
Moderator
RankRankRankRank
Total Posts:  816
Joined  2008-10-28

I’ve released TEA for Espresso beta 7 to the wild.  This is an important update for anyone using custom user actions, as I have reworked the generic action API for better consistency (these changes are semi-backwards incompatible; if you’re using the insert_snippet you’ll be fine, but if you’re getting fancy with other options you may need to update).  Otherwise, you won’t notice much changed aside from a couple bug fixes.

Improvements
- TEA’s generic action API is now more concise uses internally consistent names.  Additionally, the actions that previously were only good for converting HTML entities and inserting HTML tags from the current word now have more general applicability.
- Other Sugar authors can, if they desire, implement custom TEA actions in Python within their Sugars and execute them through the main TEA framework
- A new syntax-context option allows actions to be enabled or disabled based on the currently active syntax (very similar to how Espresso’s built-in snippets work but located in the setup tag instead of the root action tag)

Bug fixes
- 1.0.1 reintroduced a bug that occurred when using TEA actions in a document without a language chosen; this is fixed again
- Insert Tag From Word had a couple bugs when working at the very beginning of a document that are now fixed

 Signature 

Ian Beck
Part-time MacRabbit Support

My stuff:
TEA (docs / source) .:. Spice.sugar .:. HTMLBundle.sugar .:. Quiet Light & Earthworm

Profile
 
 
Posted: 05 April 2009 10:55 PM   [ Ignore ]   [ # 21 ]
Moderator
RankRankRankRank
Total Posts:  816
Joined  2008-10-28

If I’d known how easy it would be to get arbitrary shell script execution into TEA, I wouldn’t have published beta 7.  Oh, well.  Beta 8 is now released, and the only thing added is the ability for users or Sugar authors to execute arbitrary shell scripts through a special TEALoader class.  For more information about how to do this, see Running shell scripts in the TEA wiki.  Please note that this is a very early stage of development for this functionality; let me know if you have any bug reports or feature requests!

For ordinary users not interested in testing the shell script functionality, there isn’t really any reason to update to 1.0b8 instead of beta 7.

 Signature 

Ian Beck
Part-time MacRabbit Support

My stuff:
TEA (docs / source) .:. Spice.sugar .:. HTMLBundle.sugar .:. Quiet Light & Earthworm

Profile
 
 
Posted: 08 April 2009 03:35 PM   [ Ignore ]   [ # 22 ]
Newbie
Rank
Total Posts:  1
Joined  2009-04-08

Hey Ian (or George?!),

I hate for my first post on the forum to sound all negative but I am hoping to develop a Sugar (or more than one!) using TEA actions and am getting a bit stuck!

The example copyright snippet does not work when the document is empty.
Error: <type ‘exceptions.AttributeError’>: ‘NoneType’ object has no attribute ‘typeIdentifier’

The text action I want to create is to populate an empty document so this is a bit of a show stopper!

I have looked back in this thread and it looks like you may have fixed this issue, so it could be a regression.

I would try and work out a fix myself but I have never touched Python and I’m not sure I want to start now ;) (I <3 Ruby) Let alone the fact I am just starting out on creating a Sugar.

Pretty sure I am using Beta 8, but I might have not updated it properly, is there a good way for me to check my version?

Speak soon, cheers for the great work so far!

Andy

Profile
 
 
Posted: 08 April 2009 04:33 PM   [ Ignore ]   [ # 23 ]
Moderator
RankRankRankRank
Total Posts:  816
Joined  2008-10-28

Hey Andy,

Currently the version is stored away in the Info.plist in the Contents folder.  Pop that open and look for ‘CFBundleVersion’.

I double checked, though, and beta 8 did indeed have that bug in some circumstances.  I swear, it’s like the bug that will not die.  :-D

I believe I’ve fixed this in the code currently on GitHub.  If you want to try the fix before beta 9, clone the GitHub project, navigate to the root folder and run this:

python setup.py py2app 

Replace the TEA for Espresso.sugar that you’ve currently got installed with the new one in the dist folder and you should be good to go.  Please not that if you do this and try to use shell scripts, your environmental variables will be different, though.  I’ll document this change once the code hits beta 9, but it’s currently in flux.

Let me know if you have any other problems!

 Signature 

Ian Beck
Part-time MacRabbit Support

My stuff:
TEA (docs / source) .:. Spice.sugar .:. HTMLBundle.sugar .:. Quiet Light & Earthworm

Profile
 
 
Posted: 12 April 2009 12:17 AM   [ Ignore ]   [ # 24 ]
Moderator
RankRankRankRank
Total Posts:  816
Joined  2008-10-28

I’ve released TEA 1.0b9 for those interested in keeping up with the bleeding edge.  I’m happy to say that this release includes numerous new features:

New Actions

- Spaces To Tabs… and Tabs To Spaces… allow you to swap indentation styles in your document quickly and easily.  If you have some text selected, only that text will have spaces/tabs converted.  Otherwise, your whole document will be updated.

- Trim Line(s) allows you to intelligently trim the line your cursor is on (if no selection), or all selected lines.  It will: 1) remove all trailing whitespace, and 2) remove any leading whitespace that isn’t part of the indentation.  For example, if you have your preferences set to use tabs for indenting and the line you are trimming starts with two tabs followed by two spaces, the spaces will be stripped and the tabs left alone.  In addition, there’s a new “trim” action available in the generic action API if you’d like something that performs a bit differently.

- Documentation For Tag in the HTML submenu is mainly a showcase for the new generic action “visit_url”.  When in an HTML tag, you can invoke Documentation For Tag to try to find the docs for the selection or the word under the cursor (searches HTMLHelp.com using Google, and if you’re inside an actual tag name it uses I’m Feeling Lucky to send you hopefully straight there).  Using the generic action, you can load any arbitrary URL (plus placeholder for selected text) using a text action.

Improvements/Bug Fixes
- The environmental variables for shell scripts have been completely changed in order to bring them closer in line with the upcoming ESShellScriptTextAction class from MacRabbit.  My apologies to anyone who has already coded or ported shell scripts.
- The bug that was inserting multiple newlines into indented snippets has been quashed.

Enjoy!  For those of you who are curious, TEA 1.0 is feature complete now.  I’ve got a couple portions of it that I want to improve, but I expect to be out of beta and locked into the basic featureset and API within one or two more beta releases.  If you’ve got any feedback or find any bugs, now would be a good time to speak your piece.  :-)

 Signature 

Ian Beck
Part-time MacRabbit Support

My stuff:
TEA (docs / source) .:. Spice.sugar .:. HTMLBundle.sugar .:. Quiet Light & Earthworm

Profile
 
 
Posted: 12 April 2009 01:55 AM   [ Ignore ]   [ # 25 ]
Sr. Member
RankRankRankRank
Total Posts:  196
Joined  2008-11-19

This is exciting. Especially looking forward to the tabs/spaces indentation switching. How does it decide how many spaces to a tab? Just by looking at the document and guessing?

Profile
 
 
Posted: 12 April 2009 02:07 AM   [ Ignore ]   [ # 26 ]
Moderator
RankRankRankRank
Total Posts:  816
Joined  2008-10-28

Nope, it asks you every time (with the default being whatever you’ve set in the Espresso preferences).  The implementation is essentially identical to BBEdit from a UI standpoint.  I thought about guessing, but I think guessing wrong would be more frustrating for users (and difficult to catch when it happened, considering you can’t view invisibles yet) than querying, particularly since most of the time the querying just results in one additional keypress (enter).

Plus I wanted to figure out how to get custom UI into Espresso, and this seemed like as good an action as any to learn on.  :-)

 Signature 

Ian Beck
Part-time MacRabbit Support

My stuff:
TEA (docs / source) .:. Spice.sugar .:. HTMLBundle.sugar .:. Quiet Light & Earthworm

Profile
 
 
Posted: 12 April 2009 08:51 AM   [ Ignore ]   [ # 27 ]
Newbie
Rank
Total Posts:  15
Joined  2009-02-25

Beta 9 is not working for me.

Clean install of Espresso and TEA (beta 9), I get

Error: <type ‘exceptions.KeyError’>: ‘target_action’

And the application becomes unresponsive, and I can’t continue. Any thoughts?

Profile
 
 
Posted: 12 April 2009 09:33 AM   [ Ignore ]   [ # 28 ]
Jr. Member
RankRank
Total Posts:  50
Joined  2009-04-07

It’s working ok here. :)

I was wondering if I could create my own category (so a new menu folder to put all my custom snippets), without having to edit the sugar itself, but something like a category.xml in the TEA folder in Application Support.

Profile
 
 
Posted: 12 April 2009 03:58 PM   [ Ignore ]   [ # 29 ]
Moderator
RankRankRankRank
Total Posts:  816
Joined  2008-10-28
amadeus - 12 April 2009 08:51 AM

Clean install of Espresso and TEA (beta 9), I get

Error: <type ‘exceptions.KeyError’>: ‘target_action’

And the application becomes unresponsive, and I can’t continue. Any thoughts?

Hey Amadeus,

Two possibilities spring to mind:

1) Do you have any custom user actions defined?  It sounds like there’s either a missing ‘target_action’ in XML, or else something is happening internally that’s unexpected and I need to add some error checking code.

2) Did you follow the instructions in the README and install TEA inside the Espresso application bundle?  This is an unfortunate step, but extremely necessary for TEA since otherwise it will compete with itself.

If you don’t have any custom user actions and TEA installed a single time inside the app bundle, please let me know all the Sugars that you have installed so I can try and find if one of them is utilizing TEA in a way that’s causing problems.

 Signature 

Ian Beck
Part-time MacRabbit Support

My stuff:
TEA (docs / source) .:. Spice.sugar .:. HTMLBundle.sugar .:. Quiet Light & Earthworm

Profile
 
 
Posted: 12 April 2009 04:07 PM   [ Ignore ]   [ # 30 ]
Moderator
RankRankRankRank
Total Posts:  816
Joined  2008-10-28
BloodDragon - 12 April 2009 09:33 AM
I was wondering if I could create my own category (so a new menu folder to put all my custom snippets), without having to edit the sugar itself, but something like a category.xml in the TEA folder in Application Support.

Yep, this is entirely possible.  TEA will automatically symlink anything you put in your ~/Library/Application Support/Espresso/TEA/TextAction folder once you’ve enabled custom user actions, including any category.xml files.  As per the Espresso Actions docs, category definitions must be inside an XML file whose name ends in “Categories.xml”.

For now please add something to the beginning (so it’s not just Categories.xml).  I just realized that TEA’s method of making sure there aren’t any naming conflicts would likely break Espresso’s ability to detect category and sorting files (appends numbers to the end of the symlinks).  I’ll fix this for the next beta.

 Signature 

Ian Beck
Part-time MacRabbit Support

My stuff:
TEA (docs / source) .:. Spice.sugar .:. HTMLBundle.sugar .:. Quiet Light & Earthworm

Profile
 
 
   
2 of 6
2