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.

object in array,the first brace stays in new line

See original GitHub issue
  • Operating System (+Version): WIN10
  • VS Code Version: 1.24.0
  • beautify Version: 1.3.1 NOTE: Please provide code snippets instead of screen shots. Your issue needs to be replicated, and we need the failing code (text) to do this.

Provide the settings you use: (VS Code workspace and user settings, .jsbeautifyrc, .editorconfig) eg.: VS Code:

{
    "files.autoSave": "onFocusChange",
    "editor.snippetSuggestions": "top",
    "emmet.showSuggestionsAsSnippets": true,
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    "html.format.wrapAttributes": "force-aligned",
    "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
            "defaultHtmlOptions.wrapAttributes": "force-aligned"
        }
    },
    "emmet.includeLanguages": {
        "vue-html": "html",
        "nunjucks": "html"
    },
    "editor.tabSize": 2,
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "git.enableSmartCommit": true,
    "git.autofetch": true,
    "beautify.language": {
        "js": {
            "type": [
                "javascript",
                "json"
            ],
            "filename": [
                ".jshintrc",
                ".jsbeautify"
            ]
        },
        "css": [
            "css",
            "scss"
        ],
        "html": {
            "type": [
                "htm",
                "html",
                "nunjucks"
            ],
            "ext": [
                "nunjucks"
            ]
        }
    },
    "files.associations": {
        "*.html": "html"
    },
    "[javascript]": {},
    "emmet.showAbbreviationSuggestions": false,
    "workbench.iconTheme": "vscode-great-icons",
    "workbench.activityBar.visible": true,
    "[html]": {},
    "window.zoomLevel": 0,
    "search.location": "panel",
    "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": true,
    "javascript.format.placeOpenBraceOnNewLineForControlBlocks": true,
    "javascript.format.placeOpenBraceOnNewLineForFunctions": true,
    "html.suggest.angular1": false,
    "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
}

Action performed

Format javascript file with HookyQR.beautifyFile command provide example code

routes: [{
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld,
    },
    {
      path: '/login',
      component: Login,
    }
]

Expected results

Expected … to … provide example (expected) output

routes: [
  {
    path: '/',
    name: 'HelloWorld',
    component: HelloWorld,
  },
  {
    path: '/login',
    component: Login,
  }
]

Actual results

Details of what happened … provide example (actual) output

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
see311commented, Jun 14, 2018

@HookyQR after I use “brace_style”: “none,preserve-inline” or “brace_style”: “expand,preserve-inline”, it change to:

routes: [
{
  path: '/',
  name: 'HelloWorld',
  component: HelloWorld
},
{
  path: '/',
  name: 'HelloWorld',
  component: HelloWorld
}]

there is no indent before the brace and the last brace get together

0reactions
gregg-cbscommented, Oct 31, 2022

The last curly and square brace keep stacking on one line: }]

The opening brackets are fine but the ending arent following the same.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript braces on new line or not? [closed] - Stack Overflow
The first one will return an object with a status property, while the latter will return undefined because of semicolon insertion. 1 Douglas ......
Read more >
array of objects, have opening brace on same line as bracket ...
I'm trying to get the formatting right for an array of objects. The format I'm looking for is this: var arr = [{...
Read more >
Data Structures: Objects and Arrays - Eloquent JavaScript
Inside the braces, there is a list of properties separated by commas. Each property has a name followed by a colon and a...
Read more >
Arrays - The Modern JavaScript Tutorial
We can't insert a new property “between” the existing ones. Objects are just not ... Extracts the first element of the array and...
Read more >
Arrays - The Linux Documentation Project
To dereference (retrieve the contents of) an array element, ... #+ which means first element has index 0. echo echo "POP" echo "New...
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