Author Topic: array formatting / indentation  (Read 978 times)

greggman

  • Senior Community Member
  • Posts: 273
  • Hero Points: 13
array formatting / indentation
« on: May 18, 2014, 07:38:53 am »
Is there a way or setting I'm not seeing for making array formatting work similar to paren formatting? Specifically when I press enter after an `[` I'd like it to indent 1 tab or N spaces on the next line just like it does for paren. Instead what I get is it indents one character more than the `[`

In other words

What I get:
Code: [Select]
someFunction([
              | <-cursor is here

What I want

Code: [Select]
someFunction([
  | <-cursor is here

Graeme

  • Senior Community Member
  • Posts: 2017
  • Hero Points: 237
Re: array formatting / indentation
« Reply #1 on: May 19, 2014, 05:29:48 am »
If this is C or C++ your code doesn't make sense syntactically.  Can you post some more context?
If you meant this
        char some_array [45];
        foo1(some_array[
then try tools  -> options -> languages -> c/c++ -> formatting -> click the edit button -> indent -> continuation indent

- try changing "function parameter alignment" to continuation indent.

(Alternatively, click tools -> beautify -> edit current profile.)


greggman

  • Senior Community Member
  • Posts: 273
  • Hero Points: 13
Re: array formatting / indentation
« Reply #2 on: May 19, 2014, 06:04:30 am »
My code is JavaScript. It's common to declare arrays inline for certain use cases in JavaScript.  For example a list of dependencies

Code: [Select]
require([
  'somelib',
  'someotherlib',
  '3rdparty/somelib',
]);

I don't know what continuation indent is supposed to do but right now slickedit isn't indenting anything :( I don't know why :(

Graeme

  • Senior Community Member
  • Posts: 2017
  • Hero Points: 237
Re: array formatting / indentation
« Reply #3 on: May 19, 2014, 07:35:53 am »
Did you try enabling "use continuation indent on function parameters" on the javascript formatting page.  Search the pdf version of the help file for "use continuation indent"  - no quotes.


greggman

  • Senior Community Member
  • Posts: 273
  • Hero Points: 13
Re: array formatting / indentation
« Reply #4 on: May 19, 2014, 08:07:22 am »
Yes, thanks. That seems to work.