[TxMt] Javascript indentation
Daniel Stockman
daniel.stockman at gmail.com
Wed Apr 30 16:44:48 UTC 2008
> Here's what I would like:
> var xyz = (
> \t
> )
>
> [snip]
>
> Here are my current indenation rules, could anyone help me get what
> I'm
> looking for, or have I been looking in the wrong place?
What you're actually looking for is a snippet, not indentation regex.
I would also suggest using Thomas Aylott's refactored JavaScript
bundle, currently in the Review section of the repository. It adds
scopes for the various braces that makes this much simpler to
implement (among many other reasons for using it).
The basic pattern is the same as the snippet in the HTML bundle named
"Special: Return Inside Empty Open / Close Tags". It relies on the
meta.scope.between-tag-pair selector, which is defined in the language
grammar. The content of the snippet for JavaScript is exactly the
same, you'll just need to adjust the scope selector according to the
particular flavour of JavaScript.tmbundle you are using.
I've attached my own take on it, which also applies to array literals
( [] ).
Hope this helps,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Hanging Indent.tmSnippet
Type: application/octet-stream
Size: 552 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20080430/d8cd47b8/attachment.tmSnippet>
-------------- next part --------------
More information about the textmate
mailing list