{"action":"created","issue":{"url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3581","labels_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3581/labels{/name}","comments_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3581/comments","events_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3581/events","html_url":"https://github.com/codemirror/CodeMirror/issues/3581","id":110369719,"number":3581,"title":"JavaScript callbacks (or similar) don't respect Allman style indentation","user":{"login":"mattbell87","id":2722612,"avatar_url":"https://avatars.githubusercontent.com/u/2722612?v=3","gravatar_id":"","url":"https://api.github.com/users/mattbell87","html_url":"https://github.com/mattbell87","followers_url":"https://api.github.com/users/mattbell87/followers","following_url":"https://api.github.com/users/mattbell87/following{/other_user}","gists_url":"https://api.github.com/users/mattbell87/gists{/gist_id}","starred_url":"https://api.github.com/users/mattbell87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattbell87/subscriptions","organizations_url":"https://api.github.com/users/mattbell87/orgs","repos_url":"https://api.github.com/users/mattbell87/repos","events_url":"https://api.github.com/users/mattbell87/events{/privacy}","received_events_url":"https://api.github.com/users/mattbell87/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-08T04:08:02Z","updated_at":"2015-10-09T16:12:12Z","closed_at":null,"body":"Currently when you write a callback or anything similar in CodeMirror it indents to the wrong place if you're using Allman style indentation. I've tested this with the latest development snapshot of Brackets and the demo editor on https://codemirror.net/.\r\n\r\nHere's how to reproduce this issue. If you type the following JavaScript line:\r\n```javascript\r\n$('element').click(function()\r\n```\r\nThen press enter and type a { bracket, it will indent like this:\r\n```javascript\r\n$('element').click(function()\r\n\t\t\t\t   {\r\n```\r\nThis also happens outside of callbacks in some cases, for example when I create a single instance object:\r\n```javascript\r\nvar obj = new (Class.extend\r\n\t\t\t   ({\r\n```\r\nThe desired outcome would be for the indentation of the bracket to match the previous line, for example:\r\n```javascript\r\n$('element').click(function()\r\n{\r\n\t...\r\n});\r\n```\r\n```javascript\r\nvar obj = new (Class.extend\r\n({\r\n\t...\r\n}));\r\n```"},"comment":{"url":"https://api.github.com/repos/codemirror/CodeMirror/issues/comments/146913814","html_url":"https://github.com/codemirror/CodeMirror/issues/3581#issuecomment-146913814","issue_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3581","id":146913814,"user":{"login":"baconface","id":4763342,"avatar_url":"https://avatars.githubusercontent.com/u/4763342?v=3","gravatar_id":"","url":"https://api.github.com/users/baconface","html_url":"https://github.com/baconface","followers_url":"https://api.github.com/users/baconface/followers","following_url":"https://api.github.com/users/baconface/following{/other_user}","gists_url":"https://api.github.com/users/baconface/gists{/gist_id}","starred_url":"https://api.github.com/users/baconface/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baconface/subscriptions","organizations_url":"https://api.github.com/users/baconface/orgs","repos_url":"https://api.github.com/users/baconface/repos","events_url":"https://api.github.com/users/baconface/events{/privacy}","received_events_url":"https://api.github.com/users/baconface/received_events","type":"User","site_admin":false},"created_at":"2015-10-09T16:12:12Z","updated_at":"2015-10-09T16:12:12Z","body":"Yup, you can return it using:\r\n```javascript\r\nvar obj =\r\n{\r\n    a: \"A\",\r\n    b: \"B\"\r\n};\r\n\r\nreturn obj;\r\n```\r\nJust figured I would let you know. ASI is typically why Allman is not used in a lot of JavaScript projects. I am unsure if that factors into why CodeMirror handles it this way though."}}