{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/vscode/issues/11506","repository_url":"https://api.github.com/repos/Microsoft/vscode","labels_url":"https://api.github.com/repos/Microsoft/vscode/issues/11506/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/vscode/issues/11506/comments","events_url":"https://api.github.com/repos/Microsoft/vscode/issues/11506/events","html_url":"https://github.com/Microsoft/vscode/issues/11506","id":174925886,"number":11506,"title":"Feature Request: Remove extension command registeration from package.json ","user":{"login":"Jakobud","id":87356,"avatar_url":"https://avatars.githubusercontent.com/u/87356?v=3","gravatar_id":"","url":"https://api.github.com/users/Jakobud","html_url":"https://github.com/Jakobud","followers_url":"https://api.github.com/users/Jakobud/followers","following_url":"https://api.github.com/users/Jakobud/following{/other_user}","gists_url":"https://api.github.com/users/Jakobud/gists{/gist_id}","starred_url":"https://api.github.com/users/Jakobud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jakobud/subscriptions","organizations_url":"https://api.github.com/users/Jakobud/orgs","repos_url":"https://api.github.com/users/Jakobud/repos","events_url":"https://api.github.com/users/Jakobud/events{/privacy}","received_events_url":"https://api.github.com/users/Jakobud/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/vscode/labels/api","name":"api","color":"1d76db"},{"url":"https://api.github.com/repos/Microsoft/vscode/labels/duplicate","name":"duplicate","color":"E2A1C2"},{"url":"https://api.github.com/repos/Microsoft/vscode/labels/question","name":"question","color":"E2A1C2"}],"state":"closed","locked":false,"assignee":{"login":"jrieken","id":1794099,"avatar_url":"https://avatars.githubusercontent.com/u/1794099?v=3","gravatar_id":"","url":"https://api.github.com/users/jrieken","html_url":"https://github.com/jrieken","followers_url":"https://api.github.com/users/jrieken/followers","following_url":"https://api.github.com/users/jrieken/following{/other_user}","gists_url":"https://api.github.com/users/jrieken/gists{/gist_id}","starred_url":"https://api.github.com/users/jrieken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrieken/subscriptions","organizations_url":"https://api.github.com/users/jrieken/orgs","repos_url":"https://api.github.com/users/jrieken/repos","events_url":"https://api.github.com/users/jrieken/events{/privacy}","received_events_url":"https://api.github.com/users/jrieken/received_events","type":"User","site_admin":false},"assignees":[{"login":"jrieken","id":1794099,"avatar_url":"https://avatars.githubusercontent.com/u/1794099?v=3","gravatar_id":"","url":"https://api.github.com/users/jrieken","html_url":"https://github.com/jrieken","followers_url":"https://api.github.com/users/jrieken/followers","following_url":"https://api.github.com/users/jrieken/following{/other_user}","gists_url":"https://api.github.com/users/jrieken/gists{/gist_id}","starred_url":"https://api.github.com/users/jrieken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrieken/subscriptions","organizations_url":"https://api.github.com/users/jrieken/orgs","repos_url":"https://api.github.com/users/jrieken/repos","events_url":"https://api.github.com/users/jrieken/events{/privacy}","received_events_url":"https://api.github.com/users/jrieken/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-09-04T01:19:31Z","updated_at":"2016-09-05T13:50:39Z","closed_at":"2016-09-05T07:58:11Z","body":"Currently, you register an extension command by defining it in the `package.json` and also registering it within your code.\r\n\r\nMy request is to remove commands from needing to be defined in `package.json` contributions and make them definable and registerable only within your code.\r\n\r\nThis would open up the door for new functionality and flexibility and dynamic extension command registrations. For example being able to register a command on the fly only for specific languages.\r\n\r\nThe other part of this request is to be able to unregister commands so that they do not show up in the command palette anymore. I don't see a way in the API to unregister commands.\r\n\r\nAgain, a use case for this would be unregistering a command that is language specific. For example if you have a command you want available only for the HTML language. The way you would accomplish this:\r\n\r\n1. Make your extension activate on the `\"onLanguage:html\"` activationEvent.\r\n2. Register your extension command in your code so now its available for HTML language\r\n3. When you switch to a different language, your extension deactivates, you code could deregister the command in you code, so now its no longer available for other extensions\r\n\r\nSo now you have an extension command that is limited only to a certain language. This is just a simple example but I imagine there are many other use cases that would come from being able to dynamically register/deregister commands on the fly without needed them to be hardcoded in `package.json`."},"comment":{"url":"https://api.github.com/repos/Microsoft/vscode/issues/comments/244751638","html_url":"https://github.com/Microsoft/vscode/issues/11506#issuecomment-244751638","issue_url":"https://api.github.com/repos/Microsoft/vscode/issues/11506","id":244751638,"user":{"login":"Jakobud","id":87356,"avatar_url":"https://avatars.githubusercontent.com/u/87356?v=3","gravatar_id":"","url":"https://api.github.com/users/Jakobud","html_url":"https://github.com/Jakobud","followers_url":"https://api.github.com/users/Jakobud/followers","following_url":"https://api.github.com/users/Jakobud/following{/other_user}","gists_url":"https://api.github.com/users/Jakobud/gists{/gist_id}","starred_url":"https://api.github.com/users/Jakobud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jakobud/subscriptions","organizations_url":"https://api.github.com/users/Jakobud/orgs","repos_url":"https://api.github.com/users/Jakobud/repos","events_url":"https://api.github.com/users/Jakobud/events{/privacy}","received_events_url":"https://api.github.com/users/Jakobud/received_events","type":"User","site_admin":false},"created_at":"2016-09-05T13:50:39Z","updated_at":"2016-09-05T13:50:39Z","body":"Okay perhaps I'm a bit confused. If I remove the command from the `contributes` in `package.json`, and set my extension to activate `onLanguage:html`, and then register my command inside the `activate` method, I don't see it show up in the command palette. I don't see a way to set the title and description of the command dynamically. And I don't see even the command id `myExtension.myCommand` in the command palette.\r\n\r\nI figure this topic may not have been explored much yet so there is probably just a lack of documentation on the subject. :-) If you could help clear up what I'm misunderstanding I would appreciate it!"}}
{"actor":{"display_login":"Jakobud"}}