question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to have newlines inside array?

See original GitHub issue

Hello guys.

I’ll be glad to see option “elements of array on new line” in close future.

Example:

Source:
{"explicitMods": ["Adds 7-15 Physical Damage", "+27 to Dexterity", "7% increased Fire Damage", "+16 to Evasion Rating", "+4 Life gained on Kill"]}

Current Output:

{
  "explicitMods": ["Adds 7-15 Physical Damage", "+27 to Dexterity", "7% increased Fire Damage", "+16 to Evasion Rating", "+4 Life gained on Kill"]
}

What I want to see:

{
  "explicitMods": [
    "Adds 7-15 Physical Damage",
    "+27 to Dexterity",
    "7% increased Fire Damage",
    "+16 to Evasion Rating",
    "+4 Life gained on Kill"
  ]
}

Issue Analytics

  • State:open
  • Created 10 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
drastickcommented, Jun 10, 2015

+1

0reactions
bitwisemancommented, Feb 13, 2014

Also note, that the input below maps to the same output:

{
    "explicitMods": [
        "Adds 7-15 Physical Damage", "+27 to Dexterity", "7% increased Fire Damage",
        "+16 to Evasion Rating", "+4 Life gained on Kill"
    ]
}

But this also gets you:

// input, set wordwrap to 80
{
    "explicitMods": [
        "Adds 7-15 Physical Damage", "+27 to Dexterity", "7% increased Fire Damage", "+16 to Evasion Rating",
        "+4 Life gained on Kill"
    ]
}

// output
{
    "explicitMods": [
        "Adds 7-15 Physical Damage", "+27 to Dexterity",
        "7% increased Fire Damage", "+16 to Evasion Rating",
        "+4 Life gained on Kill"
    ]
}

What I think would make sense is this:

// input, output is the same 
{
    "explicitMods": [ "a", "c", "d"]
}

// input 
{
    "explicitMods": [
      "a", "c", "d"]
}

// output - once we see a in the input newline inside an array, wrap all remaining items
{
    "explicitMods": [
        "a",
        "c",
        "d"
    ]
}

// input 
{
    "explicitMods": ["a", "b",
      "c", "d"]
}

// output (not ideal) - once we see a newline inside an array, wrap all remaining items
// This is the example of where that logic falls down... It's not great, but it allows for the previous input to work
{
    "explicitMods": ["a", "b",
        "c",
        "d"
    ]
}
// input, set wordwrap to 80
{
    "explicitMods": [
        "Adds 7-15 Physical Damage", "+27 to Dexterity", "7% increased Fire Damage", "+16 to Evasion Rating",
        "+4 Life gained on Kill"
    ]
}

// output (ideally) - if we start wrapping an array, go back and put each item on a separate line.
// this part would be hard due to #200 and that we don't back track well 
{
    "explicitMods": [
        "Adds 7-15 Physical Damage",
        "+27 to Dexterity",
        "7% increased Fire Damage",
        "+16 to Evasion Rating",
        "+4 Life gained on Kill"
    ]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I make new line or break in array? - Stack Overflow
So you have to use <br/> to add an explicit line-break in HTML. However, now, in rails for safety any string will be...
Read more >
How can I add a new line in string in array
Everything works fine. I just thinking about the possibility of formating the text. I tried to insert "NewLine" variable, Unicode for new line....
Read more >
Guide on How to Add a New Line in JavaScript | Simplilearn
The newline character is \n in JavaScript and many other languages. All you need to do is add \n character whenever you require...
Read more >
How to put string in array, split by new line in PHP
Given a string concatenated with several new line character. The task is to split that string and store them into array such that...
Read more >
JavaScript Program to Replace All Line Breaks with <br>
I am Learning JavaScript.<br>JavaScript is fun.<br>JavaScript is easy. In the above example, the built- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found