nabn / web-indent

Automatically exported from code.google.com/p/web-indent
0 stars 0 forks source link

functions in parentheses not indenting #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
With the following code:

var f = (function () {
  if (true) {
    //do something
  }
  return something;
}());

the indentation inside the function won't work. It is indented like this:

var f = (function () {
    if (true) {
    //do something
    }
    return something;
    }());

The only way to make the indentation work is to remove the parens wrapping the 
function (which are there to indicate that the function is being immediately 
called - a common idiom).

Original issue reported on code.google.com by skilldr...@gmail.com on 15 Nov 2010 at 5:16

GoogleCodeExporter commented 8 years ago
Hmm...I'm going to have to re-address anonymous functions from a different 
standpoint.  I'm so sorry this didn't work out for you.  I will address this as 
soon as possible and get back to you.  I'm currently overhauling the entire 
script, so if you have any input, I'd love to get your suggestions.  Thanks so 
much for your support!

Original comment by pkopr...@gmail.com on 2 Apr 2011 at 1:33

GoogleCodeExporter commented 8 years ago
Hey, I looked into your issue as well.  I was able to simply copy past your 
example and successfully indented everything.  Are you sure you're using the 
latest version?  There were lots of changes between each version.

Original comment by pkopr...@gmail.com on 17 Apr 2011 at 10:22

GoogleCodeExporter commented 8 years ago
Hi, thanks for looking into this. I think it was my fault - conflicting 
indentation code.

Original comment by skilldr...@gmail.com on 18 Apr 2011 at 8:30

GoogleCodeExporter commented 8 years ago
I'm having the same issue. From the previous comment, it appears the OP figured 
out what had happened. Any light on the subject?

I'm using vim 7.3 on a mac, pathogen 2.0, and the latest version of this plugin 
(1.0)

I have a very simple .vimrc:

call pathogen#infect()

set shiftwidth=4 tabstop=4 softtabstop=4 expandtab smarttab
set cindent autoindent smartindent
set hls incsearch
set laststatus=2
set ruler number

autocmd Filetype ruby setlocal ts=2 sw=2 sts=2 nocindent

Original comment by grignaak@gmail.com on 17 Sep 2011 at 5:11

GoogleCodeExporter commented 8 years ago
Hi grignaak

I don't know exactly how I sorted it, but have a look at my .vimrc and .vim 
directory if you want to see my current (working) setup: 
https://github.com/skilldrick/vimrc

Original comment by skilldr...@gmail.com on 17 Sep 2011 at 6:36