onecrayon / tea-for-espresso Goto Github PK
View Code? Open in Web Editor NEWAn Espresso Sugar containing Textmate-style Text Editor Actions
Home Page: http://onecrayon.com/tea/
An Espresso Sugar containing Textmate-style Text Editor Actions
Home Page: http://onecrayon.com/tea/
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>
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.
Since there's no newline, it's one character short of the whole line.
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.
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.
This applies to tea_actions.get_tag_closestring(context)
, which currently just returns the closestring based on the user preferred default. Need to sniff for doctypes and so forth.
Probably just for TEALoader at the moment.
Need to verify if this is just the particular text I'm using, or all text. Haven't tested Spaces to Tabs to see if it happens there.
Specific text is being copy and pasted from Script Debugger; maybe test the line endings.
Zen coding currently ignores the XHTML preferences in TEA's preference window; this needs to change.
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.
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.
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.
I'm not sure why, but the closing tag is coming after the newline now.
Requires a custom sheet.
Options:
Allowing the action to bypass the sheet would also be potentially useful, too.
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.*
I'm on the fence about this, and not sure what I'd call the new action. Possibilities:
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.
Will likely need a script to parse the zen dictionary and output action XML for each abbreviation to be run as part of setup.py.
Need to look into whether I can access previous word as part of a tab trigger.
Original discussion thread: http://wiki.macrabbit.com/forums/viewreply/2901/
Syntax zone sniffing is dumb as a stump; perhaps use itemizers to detect the type of language currently being edited?
Initially developed by Colin Fyfe; include &
, <
, etc.:
http://colinfyfe.wordpress.com/2009/04/29/custom-keyboard-shortcuts-for-espresso/
Need to verify that my string searching will actually work for new goto command; also need to test outlying cases like empty documents, caret at end of document, etc.
Need several things:
/
the same with preceding space)This is probably a 32 bit vs. 64 bit or similar problem; py2app is doing something incorrectly.
See http://github.com/onecrayon/JSCocoaLoader-sugar/issues#issue/4 for full directory list as laid out for JSCocoaLoader.
Need to test this more, but anecdotally I'm noticing issues with snippets and brackets (noticed it with emphasized first off).
For example: if I'm reading in selection OR document, I want the output to replace selection OR document.
How to handle this? Need to allow actions to require:
How about <required-selection>
:
I'm getting an error when trying to do a simple expansion with the zen action:
div.inner
Working with a compiled version of beta13.
For example, Wrap Selection In Tag with I made $100 today!
results in I made today!
.
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.
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.
These might be useful general-use additions to TEA; need to check with Jan to see if he's likely to implement them in Espresso core anytime soon.
I'm not sure if this is future-friendly (for when I use the XHTML string even if HTML is the default when I detect an XHTML doctype).
For example, $E_FILENAME could be useful in snippets as well as shell scripts.
When the text field for the XHTML closing string is empty, the example text falls back to the default value ' /'; need to check if it's even possible to enter an empty string in the defaults. That's also a bug, if not.
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).
For instance, right now html:xt
gives you a document with a language of Russian instead; should be customizable.
The organization of these docs makes some sense for people reading through them for the first time, but serves as a terrible reference. Need to improve on that.
Action file, script itself, and the error.
I'm not sure how this would work or look, but it would be really helpful if shell scripts could change the selected range without modifying the document text.
See for instance http://wiki.macrabbit.com/forums/viewthread/482/
See the Aptana video for more info (starts about 1:50):
http://www.youtube.com/watch?v=ug84Ypwqfzk&feature=player_embedded
More specific info available from the Zen-coding site:
Some useful things to track:
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).
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.
Currently only the first line of the text is indented the proper amount for a multi-line snippet.
Need to test exactly when this occurs, but it throws an error if there's a space at the line end along with the cursor.
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:
For instance, if line starts with one tab followed by two spaces running "Spaces to Tabs..." with 2 spaces per tab will not convert the two spaces.
Need to look into this a bit more, but CocoaDialog looks like a potentially excellent way to allow command-line scripts access to arbitrary GUI elements.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.