GithubHelp home page GithubHelp logo

onecrayon / tea-for-espresso Goto Github PK

View Code? Open in Web Editor NEW
58.0 3.0 3.0 3.17 MB

An Espresso Sugar containing Textmate-style Text Editor Actions

Home Page: http://onecrayon.com/tea/

Objective-C 17.73% Python 82.27%

tea-for-espresso's Introduction

Text Editor Actions for Espresso

This version of TEA for Espresso is officially deprecated as of Espresso 2.0. If you are interested in leveraging TEA, please email MacRabbit for more information.

Text Editor Actions (TEA) for Espresso is an Espresso plugin that provides numerous bundled actions and an infrastructure for easily creating more, whether you are a Sugar developer or not.

TEA has been bundled with Espresso since version 1.0, so you do not need to download it (unless you want to test bleeding edge improvements).

For more info about TEA (including documentation) see the TEA website:

http://onecrayon.com/tea/

Found something about TEA that makes you unhappy? Submit a bug report or feature request (requires free GitHub account) or drop me a line.

Building from source

Since you're here, odds are you want to mess around with TEA's source code. To compile TEA first clone it from GitHub (if you don't have Git installed, download it instead):

git clone git://github.com/onecrayon/tea-for-espresso.git

In order to compile, TEA for Espresso needs to know where your Espresso installation lives. By default it will look in your /Applications folder, but if you have Espresso installed somewhere else, you can create a symbolic link to it that the compiler will follow like this:

ln -s /path/to/Espresso.app /Applications/Espresso.app

To compile, just open the Xcode project and hit the build button!

To override the bundled version of TEA in Espresso, make sure to increment the CFBundleVersion in Info.plist before compiling TEA.

tea-for-espresso's People

Contributors

onecrayon avatar sergeche avatar

Stargazers

eg avatar Angus H. avatar  avatar  avatar Derek Reynoldq avatar  avatar Carl Topham avatar matt avatar Don Myers avatar Dennis Tang avatar Jorge Vega Sánchez avatar Tom Law avatar Christopher Chiu avatar Renato Longobardi avatar jaywest avatar Marcus Lindén avatar Pablo avatar  avatar Boston Dell-Vandenberg avatar Shawn Grimes avatar Oleg Melnychuk avatar Jordan Singer avatar Jannis Gundermann avatar Jennie Robinson Faber avatar  avatar Henrik Cederblad avatar Sergey Safonov avatar Michał Ordon avatar Steven Roebert avatar Stijn De Meyere avatar Maik Kempe avatar Alan avatar Nicholas Penree avatar Tench avatar  avatar Nelly M. avatar Connor Lowe avatar Christoffer Winterkvist avatar Ben avatar Oscar Cortez avatar Brent Cartier avatar Brett Terpstra avatar Marcio Barrios avatar Dennis Leung avatar Donovan avatar lnsoso avatar Robert Dougan avatar gpt dev avatar Chris Messina avatar Derek Reynolds avatar Andrew Disley avatar Leon Berenschot avatar  avatar Sean Patrick Murphy avatar  avatar Neil Lee avatar Andy Pearson avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

tea-for-espresso's Issues

Add detection for XHTML

Currently, whatever is the default in the preferences is what is always used. I need to figure out a way to detect XHTML vs. HTML as often as possible, and only default to what's in preferences if nothing is detected.

Convert core classes to Objective-C

Apparently the Python interpreter is screwing with launch speeds; need to convert the core classes to Objective-C.

Will I still be able to pass arbitrary lists of keyword arguments? Need to check to see if this is going to be a problem, since it's a core portion of TEA's functionality.

Add Hard Wrap... command

Requires a custom sheet.

Options:

  • choose a character width (stored in preferences)
  • prefix lines with character? (would be useful for custom Markdown commands)
  • indent options? (flush, first line, lines other than first)
  • should I replicate BBEdit's "paragraph fill" option?

Allowing the action to bypass the sheet would also be potentially useful, too.

Current TEA HEAD fails to load in Espresso

The -performActionWithContext:error: methods of all TEA classes have a signature mismatch due to omitting the error parameter.

Patch available at: http://gist.github.com/135771

Traceback:
25.06.09 11:57:48 Espresso[85041] TEA for Espresso has encountered a fatal error, and will now terminate.
25.06.09 11:57:48 Espresso[85041] An uncaught exception was raised during execution of the main script:

BadPrototypeError: Python signature doesn't match implied Objective-C signature for <unbound selector performActionWithContext:error: of TEAforEspresso at 0x180bcec0>

This may mean that an unexpected error has occurred, or that you do not have all of the dependencies for this bundle.
25.06.09 11:57:48 [0x0-0x163062f].com.macrabbit.Espresso[85041] Traceback (most recent call last):
25.06.09 11:57:48 [0x0-0x163062f].com.macrabbit.Espresso[85041] File "/Users/mkhl/Projects/Espresso/tea-for-espresso/dist/TEA for Espresso.sugar/Contents/Resources/boot.py", line 42, in
25.06.09 11:57:48 [0x0-0x163062f].com.macrabbit.Espresso[85041]
25.06.09 11:57:48 [0x0-0x163062f].com.macrabbit.Espresso[85041] _run('main.py')
25.06.09 11:57:48 [0x0-0x163062f].com.macrabbit.Espresso[85041] File "/Users/mkhl/Projects/Espresso/tea-for-espresso/dist/TEA for Espresso.sugar/Contents/Resources/boot.py", line 39, in _run
25.06.09 11:57:48 [0x0-0x163062f].com.macrabbit.Espresso[85041] execfile(path, globals(), globals())
25.06.09 11:57:48 [0x0-0x163062f].com.macrabbit.Espresso[85041] File "/Users/mkhl/Projects/Espresso/tea-for-espresso/dist/TEA for Espresso.sugar/Contents/Resources/main.py", line 29, in
25.06.09 11:57:48 [0x0-0x163062f].com.macrabbit.Espresso[85041] import TEAforEspresso
25.06.09 11:57:48 [0x0-0x163062f].com.macrabbit.Espresso[85041] File "/Users/mkhl/Projects/Espresso/tea-for-espresso/dist/TEA for Espresso.sugar/Contents/Resources/TEAforEspresso.py", line 12, in
25.06.09 11:57:48 [0x0-0x163062f].com.macrabbit.Espresso[85041] class TEAforEspresso(NSObject):
25.06.09 11:57:48 [0x0-0x163062f].com.macrabbit.Espresso[85041] objc.BadPrototypeError: Python signature doesn't match implied Objective-C signature for <unbound selector performActionWithContext:error: of TEAforEspresso at 0x180bcec0>

Add more syntax options to formatting menu actions

XML for formatting options somewhat supports Markdown; be nice to also support Textile.

Also need to figure out if the Wrap In Link functionality belongs in the HTML menu since its capable of multiple syntaxes.

Word grabbing regex messes up with PHP closing delimiters

Given this code:

<?php //stuff ?>p

Running Expand Abbreviation incorrectly harvests the > in the closing delimiter for PHP. Probably a problem for similar languages like ASP, too. Need to add logic to exclude that for both HTML tags and closing delimiters.

"Go to" command

Generic action: select_line? Something else? In any case, highlight the chosen line (should jump the editor to that point).

Idea is to provide the ability to jump to a portion of the document based on the user's selection (or the current word, etc.). Potentially useful for jumping to function definitions, etc.

Originally intended mainly to provide "go to line" functionality, but Jan says that's coming in the near future.

Add support for $E_XHTML variable to snippets

Need several things:

  1. Preference to set the XHTML string (probably / the same with preceding space)
  2. Preference to set whether to use XHTML by default (if doctype isn't detected)
  3. Logic to detect doctype if it exists
  4. Insertion logic in tea_actions

TEAforEspresso may crash while opening a new Window.

It seems that, in some circumstances, the canPerformActionWithContext_
method can be invoked on TEA actions with a partially initialized syntax
context. This manifests itself as a crash with an AttributeError for
length on NoneType. A bit of digging revealed this to be the length call
on line 80 in the canPerformActionWithContext_ method, where
context.string() returned None.

Patch available: http://gist.github.com/119700
This change prevents the crash by checking the context’s string for None and
bailing out in that case.

If you want to digg into this issue some more, I can provide two action definitions that seem to “enable” the crash. (They’re part of a sugar not ready for public consumption.) With any of those installed, the way to reproduce is:

  1. Launch Espresso
  2. Close the initial untitled window. (⌘W)
  3. Open a new window. (⌘N)

Combine Expand Abbreviations with Insert Tag From Word

I'm on the fence about this, and not sure what I'd call the new action. Possibilities:

  • Stick with Expand Abbreviation (good, since it's not HTML-specific)
  • Insert Tag(s) From Word or Insert Tag(s) From Abbreviation
  • Expand Word
  • Expand Abbreviation From Word

Something else?

Also, if I do this, should I move Expand Abbreviation out to the root menu? It's HTML and CSS-specific, but sticking it in the HTML menu is kind of silly for CSS. Then again, it's primary use for me is HTML, and I suspect that's the case for others.

Replace TEA menu with a TEA preferences sheet

Some useful things to track:

  • Enable/disable custom user actions (with some verbiage for where to find out about them)
  • Tell TEA to use XHTML or HTML for things like self-closing tags

Down the road, I could either add custom user action editing to the preferences, or just have that be its own separate thing (probably preferable, since it would be a fairly in-depth thing).

Allow actions to require a selection

How to handle this? Need to allow actions to require:

  • No selection (just a cursor)
  • Single selection
  • Multiple selections

How about <required-selection>:

  • none
  • one
  • multiple

Zen counters aren't working

I should be able to do something like ul>li$.item$*5, but it just eats the text at the moment (need to test to see if this is a TEA/Espresso problem or a Zen-coding thing).

Expand Abbreviations fails when used in XML docs

Fails with the following error:

<type 'exceptions.NameError'>: global name 'defaults' is not defined

Not really sure what the heck is going on, since none of the files responsible for the action reference defaults that I can find.

Add ability to change menu title

The TEA->Toggle Actions menu item is confusing at best. At bare minimum I need to be able to flip between titles based on a boolean in the preferences.

Considering figuring out a way to make this useful for regular actions, too; maybe vary it based on the current syntax context?

Note to self: return None in order to leave title as default.

* It is currently impossible from Python to default to the <title>. Need to report to Jan that returning None does not cause the default to trigger.*

Figure out why environmental variables are persistent, even after being deleted

If you run a shell script, then delete a custom environmental variable in TEA preferences, then run the script again, the environmental variable will still be around. This isn't as it should be, particularly considering that the environmental variables are only supposed to stick around for one iteration of the script.

Zen Coding counter issues

Consider the following example:
write
ul>li*4
The cursor should be inside first LI item. Now write something, hit Tab and write something again. You sould see that descending LI items will be edited as well as second item.

The ultimate soilution for this problem is to use place_ins_point method from TextMate bundle that will increment dollar placeholder for each item:

point_ix = 0
def place_ins_point(text):
    globals()['point_ix'] += 1
    return '$%s' % point_ix

Then point zen's insertion point properties to this method:
zen_core.insertion_point = place_ins_point
zen_core.sub_insertion_point = place_ins_point

Paste and match indentation

Need to check with Jan to see if this kind of thing is likely to show up in Espresso core, but if not a stop-gap "paste and match indentation" action would be a beautiful thing.

Prefs: adding new row to table fails to highlight the row

Adding new rows to the table of custom shell variables is currently useless because they're invisible (not highlighted, even). I need to have the first column automatically placed in editing mode so the user can just type the name of the variable and get going.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.