{"action":"created","issue":{"url":"https://api.github.com/repos/sublimehq/Packages/issues/229","repository_url":"https://api.github.com/repos/sublimehq/Packages","labels_url":"https://api.github.com/repos/sublimehq/Packages/issues/229/labels{/name}","comments_url":"https://api.github.com/repos/sublimehq/Packages/issues/229/comments","events_url":"https://api.github.com/repos/sublimehq/Packages/issues/229/events","html_url":"https://github.com/sublimehq/Packages/issues/229","id":138730775,"number":229,"title":"[JavaScript] certain function declarations are not being scoped properly","user":{"login":"MattDMo","id":1776358,"avatar_url":"https://avatars.githubusercontent.com/u/1776358?v=3","gravatar_id":"","url":"https://api.github.com/users/MattDMo","html_url":"https://github.com/MattDMo","followers_url":"https://api.github.com/users/MattDMo/followers","following_url":"https://api.github.com/users/MattDMo/following{/other_user}","gists_url":"https://api.github.com/users/MattDMo/gists{/gist_id}","starred_url":"https://api.github.com/users/MattDMo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MattDMo/subscriptions","organizations_url":"https://api.github.com/users/MattDMo/orgs","repos_url":"https://api.github.com/users/MattDMo/repos","events_url":"https://api.github.com/users/MattDMo/events{/privacy}","received_events_url":"https://api.github.com/users/MattDMo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-05T22:47:27Z","updated_at":"2016-03-08T21:29:07Z","closed_at":"2016-03-08T21:29:07Z","body":"I apologize for not using the correct terminology, as I'm not a JavaScript guy. As far as I can tell, there are two ways of defining named functions in JavaScript:\r\n```js\r\nfunction foo() {\r\n    // do stuff\r\n}\r\n```\r\nand\r\n```js\r\nbar: function() {\r\n    // do other stuff\r\n}\r\n```\r\nHowever, it also seems that one can use the second construct to assign arbitrary values to variables:\r\n```js\r\nbaz: \"some text\"\r\nqux: {\r\n    a: b,\r\n    c: d\r\n}\r\n```\r\nIn the current iteration of `JavaScript.sublime-syntax`, when using the top method to define a function, the function's name (`foo`, in this case) is scoped as `meta.function.declaration.js entity.name.function.js`. In JavaScriptNext, in the second form, the function name (`bar`) is scoped as `meta.function.json.js entity.name.function.js`, whereas `baz`, `qux`, `a`, and `b` are scoped as `constant.other.object.key.js string.unquoted.label.js`, allowing for them to be differentiated by a color scheme. However, `JavaScript.sublime-syntax` scopes all of them (`bar`, `baz`, `qux`, `a`, and `b`) as `entity.name.label.js`, with no differentiation between the function name and regular keys.\r\n\r\nThe new `.sublime-syntax` file is huge, and I haven't even attempted to find where the issue might be, let alone try to fix it, so this is just an issue for now. If someone who is better acquainted with the syntax definition could solve this, that would be great."},"comment":{"url":"https://api.github.com/repos/sublimehq/Packages/issues/comments/193975988","html_url":"https://github.com/sublimehq/Packages/issues/229#issuecomment-193975988","issue_url":"https://api.github.com/repos/sublimehq/Packages/issues/229","id":193975988,"user":{"login":"wbond","id":41734,"avatar_url":"https://avatars.githubusercontent.com/u/41734?v=3","gravatar_id":"","url":"https://api.github.com/users/wbond","html_url":"https://github.com/wbond","followers_url":"https://api.github.com/users/wbond/followers","following_url":"https://api.github.com/users/wbond/following{/other_user}","gists_url":"https://api.github.com/users/wbond/gists{/gist_id}","starred_url":"https://api.github.com/users/wbond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbond/subscriptions","organizations_url":"https://api.github.com/users/wbond/orgs","repos_url":"https://api.github.com/users/wbond/repos","events_url":"https://api.github.com/users/wbond/events{/privacy}","received_events_url":"https://api.github.com/users/wbond/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T21:29:07Z","updated_at":"2016-03-08T21:29:07Z","body":"df8cff8745121affba35456d099af75798717b7c improves the grammar to prevent parsing semi-broken object keys as labels."}}