elixir-editors/vim-elixir

Please do not re-indent the content of multiline strings/heredocs

vais opened this issue · 2 comments

vais commented

It could be argued that the content of multiline strings/heredocs shall not be altered when indenting. At least that's how indentation works in both Ruby and JavaScript Vim plugins. Vim-elixir currently re-indents the contents:

Before indenting:

defp sql do
  """
  SELECT *
    FROM table
   WHERE column = 123
     AND another_column = 456
  """
end

Actual (after indenting)

defp sql do
  """
  SELECT *
  FROM table
  WHERE column = 123
  AND another_column = 456
  """
end

Expected (content inside multiline string shall remain the same before and after indenting)

defp sql do
  """
  SELECT *
    FROM table
   WHERE column = 123
     AND another_column = 456
  """
end

Related: #346

One idea for how we could implement this: check if the beginning of the line is a string; if it is, don't indent the line. We may need to do something about quotes and sigils