{"action":"created","issue":{"url":"https://api.github.com/repos/atom/atom/issues/15143","repository_url":"https://api.github.com/repos/atom/atom","labels_url":"https://api.github.com/repos/atom/atom/issues/15143/labels{/name}","comments_url":"https://api.github.com/repos/atom/atom/issues/15143/comments","events_url":"https://api.github.com/repos/atom/atom/issues/15143/events","html_url":"https://github.com/atom/atom/issues/15143","id":247479944,"number":15143,"title":"Support Command Metadata","user":{"login":"wbinnssmith","id":755844,"avatar_url":"https://avatars0.githubusercontent.com/u/755844?v=4","gravatar_id":"","url":"https://api.github.com/users/wbinnssmith","html_url":"https://github.com/wbinnssmith","followers_url":"https://api.github.com/users/wbinnssmith/followers","following_url":"https://api.github.com/users/wbinnssmith/following{/other_user}","gists_url":"https://api.github.com/users/wbinnssmith/gists{/gist_id}","starred_url":"https://api.github.com/users/wbinnssmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbinnssmith/subscriptions","organizations_url":"https://api.github.com/users/wbinnssmith/orgs","repos_url":"https://api.github.com/users/wbinnssmith/repos","events_url":"https://api.github.com/users/wbinnssmith/events{/privacy}","received_events_url":"https://api.github.com/users/wbinnssmith/received_events","type":"User","site_admin":false},"labels":[{"id":118249520,"url":"https://api.github.com/repos/atom/atom/labels/api","name":"api","color":"c7def8","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-08-02T18:25:39Z","updated_at":"2018-03-31T01:36:56Z","closed_at":"2017-08-29T15:54:42Z","author_association":"CONTRIBUTOR","body":"Atom commands should be able to reference arbitrary metadata, along with a human-written displayName and a description of what to expect when a command is executed.\r\n\r\nThis way, tools like the command palette could surface something potentially friendlier than the `_.humanizeEventName` version of the name string of the command, which is more of an implementation detail.\r\n\r\nPotential arbitrary metadata could be keywords (which could or could not surface themselves in search results), aliases, search weight, etc.\r\n\r\nIt's possible to retain and simply augment the existing command registration API by supporting a complex object everywhere a callback function might be expected:\r\n\r\n```js\r\natom.commands.add(\r\n  'atom-text-editor', \r\n  'user:insert-date',\r\n  {\r\n    displayName: 'Insert a really awesome date',\r\n    description: 'Whereever your cursor is, it inserts the current date!',\r\n    keywords: ['timestamp', 'time', 'today', 'now'],\r\n    aliases: ['user:insert-now'],\r\n    callback(e) {\r\n      const editor = this.getModel();\r\n      editor.insertText(new Date().toLocaleString());\r\n    },\r\n  },\r\n  true // throwOnInvalidSelector\r\n);\r\n```\r\n\r\nor\r\n\r\n```js\r\natom.commands.add(\r\n  'atom-text-editor', \r\n  {\r\n    'user:insert-date': {\r\n      displayName: 'Insert a really awesome date',\r\n      description: 'Whereever your cursor is, it inserts the current date!',\r\n      callback(e) {\r\n        const editor = this.getModel();\r\n        editor.insertText(new Date().toLocaleString());\r\n      },\r\n    },\r\n    'user:some-other-command': {\r\n      displayName: 'Does something really cool',\r\n      description: 'Really, it\\'s super awesome',\r\n      callback(e) {\r\n        editor = this.getModel();\r\n        editor.insertText('yay!');\r\n      },\r\n    }\r\n  },\r\n  true // throwOnInvalidSelector\r\n);\r\n```\r\n\r\nI'm not 100% of whether this metadata should be declared at registration time, and what the consequences are for the same command name registered multiple times with different targets (something I assume from looking at the api is supported?).\r\n\r\nAnother thought I had was either declaratively defining this metadata in `package.json`, or registering metadata bound to command names separately, in the same way keybindings are decoupled from commands:\r\n\r\n```js\r\natom.commands.register({\r\n  'user:insert-date': {\r\n      displayName: 'Insert a really awesome date',\r\n      description: 'Whereever your cursor is, it inserts the current date!',\r\n      keywords: ['timestamp', 'time', 'today', 'now'],\r\n      aliases: ['user:insert-now'],\r\n    },\r\n  },\r\n)\r\n```\r\n\r\ncc @matthewwithanm @hansonw @captbaritone @jinface @karincurkowicz"},"comment":{"url":"https://api.github.com/repos/atom/atom/issues/comments/377656729","html_url":"https://github.com/atom/atom/issues/15143#issuecomment-377656729","issue_url":"https://api.github.com/repos/atom/atom/issues/15143","id":377656729,"user":{"login":"lock[bot]","id":33595554,"avatar_url":"https://avatars1.githubusercontent.com/in/6672?v=4","gravatar_id":"","url":"https://api.github.com/users/lock%5Bbot%5D","html_url":"https://github.com/apps/lock","followers_url":"https://api.github.com/users/lock%5Bbot%5D/followers","following_url":"https://api.github.com/users/lock%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/lock%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/lock%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lock%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/lock%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/lock%5Bbot%5D/repos","events_url":"https://api.github.com/users/lock%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/lock%5Bbot%5D/received_events","type":"Bot","site_admin":false},"created_at":"2018-03-31T01:36:56Z","updated_at":"2018-03-31T01:36:56Z","author_association":"NONE","body":"This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in [Safe Mode](https://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode) then please open a new issue and fill out [the entire issue template](https://github.com/atom/atom/blob/master/ISSUE_TEMPLATE.md) to ensure that we have enough information to address your issue. Thanks!\n"}}
{"actor":{"display_login":"lock"}}