HTML, auto-complete and snippets (was Re: [TextMate] (no subject))
mnothrop
mnothrop at elaunceston.com
Wed Oct 6 14:01:54 UTC 2004
On 06/10/2004, at 11:14 PM, timothy martens wrote:
> Any plans for XHTML/CSS code hinting?
Tim,
I was just about to ask the same question... : )
Please don't take the following as carping complaints(!), just my
initial (self-important) impressions! ; )
I was initially very enthusiastic about TM's potential *for my use*
(i.e. not it's general potential), but I'm not so sure right now...
I see the underlying power of the text engine, and the macro/script
execution, and RegEx/patterns, but it may need a few corners smoothed,
for me to feel at home! : ) If I were a big user of Reg Ex, I'd
probably feel differently.
TM feels decidedly techie to me; and IMHO will require a more 'complex'
interface over time, to become my editor of choice, and to conversely,
be easier to use... but it will probably be perfect for the more hard
core coders, all those vi and emacs lovers! ; )
I'm afraid I find the auto-complete somewhat underwhelming; it seems
pretty basic, and (I think) belies it's simple pattern-matching basis
-- it doesn't display any knowledge of syntax (e.g. will suggest 'body'
in the context of a div tag, instead of 'border'), and is strict in
it's matching (will match 'cellS...' for cellSpacing, but not
'cells...' -- oh, and hitting Escape each time isn't the most ergonomic
aspect of editing.
One area that really shines are the snippets. I've been playing with
snippets, and obviously see the power in the trigger mechanism above
the key commands that other editors use; it gives a pretty good
semblance of an auto-complete feature with code hinting. The keyboard
trigger is the key feature, as opposed to mentally mapping a keyboard
command to a snippet (of which there is also a smaller pool of
options.)
In particular the tab stops are one of the killer features I've been
seeking in a 'syntax editor' for a long time; I would like this concept
spread to the syntax (with my emphasise on X/HTML, CSS etc.), so that
perhaps with a modifier, so as not to over-ride entering tabs, you are
able to tab between editing points according to the syntax, i.e. tab
from outside a tag, successively into the tag's attributes, into the
'label section' of appropriate tags (e.g. hrefs) and to outside the end
angle to enter a new tag, or tab through subsequent tags.
This is how predefined snippets operate, and it's great. Consider
typing html, to get:
<html>
<head>
<title>*TAB1*</title>
</head>
<body>
*TAB2*
</body>
</html>
...but of course, at the moment, you've got to do the heavy lifting! It
would take some time to enter a useful set of snippets, but I've
started... If anyone else has, we must share!
Folding is nicely done, though it might be good to have some more
obvious folding controls; while the 'Toggle Foldings at Level x'
function is useful, some more basic Un/Fold All would be good, to also
reset folds. (BTW might that command be better phrased 'Toggle Folds at
Level x'?
I own skEdit, and really like it's auto-complete feature, which you
might consider more traditional, in that it's implemented similarly to
other apps (e.g. Dreamweaver, HomeSite); it suggests the likely tag
*as* you type, with a drop down menu that is likewise filtered in
real-time.
In comparing the features you quickly see that skEdit's approach
augment's the user's knowledge and memory of syntax (either
reminding/reinforcing, or teaching), whereas TM requires a mental
mapping of not only specifics of syntax, but an additional aspect, in
the triggers. It may just be my perspective on this feature (i.e.
largely reliably, and strict syntax of HTML, vs. highly variable,
creative arrangements of syntax in programming languages,) but I don't
find this approach as convenient for X/HTML editing.
Having said that, once I had a full compliment of HTML snippets,
defining my coding standards (e.g. always include certain attributes,
like class, id etc.), I could see it feeling more efficient... I guess
the problem becomes finding the balances between these two different
approaches, but the way I envisage it, my snippent menu will go on for
ever!
Snippets obviously come into their own when completing large blocks of
code, such as an HTML document skeleton, and tables, I'm not sure that
there are a reliable enough set of 'primitives' that I can use to make
this more productive that syntax-specific hinting supported by snippets
-- it all depends on the granularity of the snippets.
skEdit also offers rudimentary syntax awareness, in that once you've
typed a tag, it will suggest (mostly) valid attributes for that
element. This is an invaluable feature, and can assist in producing
valid markup (similar in theory to entry control in database
applications.) Ideally this would go further and strictly conform to
the syntax (e.g. only allow a single class attribute per tag, etc.)
Anyway, it's has gone long enough -- I'll be interested to see how TM
develops.
marc
On 06/10/2004, at 11:14 PM, timothy martens wrote:
> Any plans for XHTML/CSS code hinting?
>
> And what about browser previews other than the built in safari
> rendering?
>
> Also, can we just have the project drawer show up by default. There's
> hardly ever an instance where I wouldn't need/want it in view.
>
> -t
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/mailman/listinfo/textmate
>
More information about the textmate
mailing list