Hi all, I've tried searching for this, and my google-fu is weak.
Does anyone know how I would be able to change the indentation behavior for just parenthesis in Javascript?
Basically, our code convention is so that when you have multiple arguments on new lines (for instance, passing an anonymous function as a closure), the closing parenthesis aligns to whatever the current tabbing level is. Currently, the curly brackets do this now, and would like to mimic the behavior, but can't make heads or tails of doing it with the current indentation patterns.
Here's what I would like: var xyz = ( \t )
Here's how it actually currently is:
var xyz = ( \t)
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?
{ decreaseIndentPattern = '^(.**/)?\s*(}|))([^{]*{)?([;,]?\s*|.[^{]*|\s*)[;\s]*)$'; increaseIndentPattern = '^.*({[^}"'']*|([^)"'']*)$'; }
Thanks in advance all!
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
Heya Daniel, I apologize for the delay. This never made it to my email, but let me just say that is EXACTLY what I was looking for :) You have just saved me hours of time in typing to correct it.
You sir, are THE man! :)
Daniel Stockman wrote:
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
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate