Incorrect indentation when parallel assignment used in parameter block #213

Open
gltarsa opened this Issue May 28, 2014 · 0 comments

Comments

Projects
None yet
2 participants

gltarsa commented May 28, 2014

When using gvim, I discovered that a multi-level block indents incorrectly if the block parameters are enclosed in parentheses (to enable parallel assignment). Here is an example code which I have pared down to a minimum.

class Spinach::Features::ManageStudyDocuments < Spinach::FeatureSteps
  STUDY_DOCUMENT_PROPERTIES = [
    [ 0, 'Type', 'type' ],
    [ 1, 'Iter', 'iterations'],
    [ 2, 'Document Name', 'full_name' ],
  ]

  # this block indents acceptably
  STUDY_DOCUMENT_PROPERTIES.each do |(offset, _, method)|
    value = values[offset].text
    if study_document.respond_to?("#{method}=")
      study_document.send("#{method}=", value)
    end
  end

  # the addition of an extra level of step blocks cause a problem.
  STUDY_DOCUMENT_PROPERTIES.each do |(offset, column, method)|
    step "I sort by '#{column}'" do
    element = find("th.sortable:nth-child(#{offset + 1})")
    element.click
  end

  # this block should be indented one more level than it is.
  step "I sort by '#{column}' again" do
    find("th.sortable:nth-child(#{offset + 1})").click
  end
  end

  # removing the parentheses from the parameter list allows for proper indentation, 
  # but I need the parallel assignment.
  STUDY_DOCUMENT_PROPERTIES.each do |offset, column, method|
    step "I sort by '#{column}'" do
      element = find("th.sortable:nth-child(#{offset + 1})")
      element.click
    end

    step "I sort by '#{column}' again" do
      find("th.sortable:nth-child(#{offset + 1})").click
    end
  end
end # end class

@dkearns dkearns added the indent label Sep 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment