{"action":"opened","issue":{"url":"https://api.github.com/repos/Microsoft/vscode/issues/20676","repository_url":"https://api.github.com/repos/Microsoft/vscode","labels_url":"https://api.github.com/repos/Microsoft/vscode/issues/20676/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/vscode/issues/20676/comments","events_url":"https://api.github.com/repos/Microsoft/vscode/issues/20676/events","html_url":"https://github.com/Microsoft/vscode/issues/20676","id":207944949,"number":20676,"title":"Command aware terminals","user":{"login":"Tyriar","id":2193314,"avatar_url":"https://avatars.githubusercontent.com/u/2193314?v=3","gravatar_id":"","url":"https://api.github.com/users/Tyriar","html_url":"https://github.com/Tyriar","followers_url":"https://api.github.com/users/Tyriar/followers","following_url":"https://api.github.com/users/Tyriar/following{/other_user}","gists_url":"https://api.github.com/users/Tyriar/gists{/gist_id}","starred_url":"https://api.github.com/users/Tyriar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tyriar/subscriptions","organizations_url":"https://api.github.com/users/Tyriar/orgs","repos_url":"https://api.github.com/users/Tyriar/repos","events_url":"https://api.github.com/users/Tyriar/events{/privacy}","received_events_url":"https://api.github.com/users/Tyriar/received_events","type":"User","site_admin":false},"labels":[{"id":272689392,"url":"https://api.github.com/repos/Microsoft/vscode/labels/feature-request","name":"feature-request","color":"bfe5bf","default":false},{"id":362694632,"url":"https://api.github.com/repos/Microsoft/vscode/labels/integrated-terminal","name":"integrated-terminal","color":"1d76db","default":false}],"state":"open","locked":false,"assignee":{"login":"Tyriar","id":2193314,"avatar_url":"https://avatars.githubusercontent.com/u/2193314?v=3","gravatar_id":"","url":"https://api.github.com/users/Tyriar","html_url":"https://github.com/Tyriar","followers_url":"https://api.github.com/users/Tyriar/followers","following_url":"https://api.github.com/users/Tyriar/following{/other_user}","gists_url":"https://api.github.com/users/Tyriar/gists{/gist_id}","starred_url":"https://api.github.com/users/Tyriar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tyriar/subscriptions","organizations_url":"https://api.github.com/users/Tyriar/orgs","repos_url":"https://api.github.com/users/Tyriar/repos","events_url":"https://api.github.com/users/Tyriar/events{/privacy}","received_events_url":"https://api.github.com/users/Tyriar/received_events","type":"User","site_admin":false},"assignees":[{"login":"Tyriar","id":2193314,"avatar_url":"https://avatars.githubusercontent.com/u/2193314?v=3","gravatar_id":"","url":"https://api.github.com/users/Tyriar","html_url":"https://github.com/Tyriar","followers_url":"https://api.github.com/users/Tyriar/followers","following_url":"https://api.github.com/users/Tyriar/following{/other_user}","gists_url":"https://api.github.com/users/Tyriar/gists{/gist_id}","starred_url":"https://api.github.com/users/Tyriar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tyriar/subscriptions","organizations_url":"https://api.github.com/users/Tyriar/orgs","repos_url":"https://api.github.com/users/Tyriar/repos","events_url":"https://api.github.com/users/Tyriar/events{/privacy}","received_events_url":"https://api.github.com/users/Tyriar/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Microsoft/vscode/milestones/8","html_url":"https://github.com/Microsoft/vscode/milestone/8","labels_url":"https://api.github.com/repos/Microsoft/vscode/milestones/8/labels","id":1412124,"number":8,"title":"Backlog","description":"Work not yet planned for a specific release.","creator":{"login":"chrisdias","id":1487073,"avatar_url":"https://avatars.githubusercontent.com/u/1487073?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisdias","html_url":"https://github.com/chrisdias","followers_url":"https://api.github.com/users/chrisdias/followers","following_url":"https://api.github.com/users/chrisdias/following{/other_user}","gists_url":"https://api.github.com/users/chrisdias/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdias/subscriptions","organizations_url":"https://api.github.com/users/chrisdias/orgs","repos_url":"https://api.github.com/users/chrisdias/repos","events_url":"https://api.github.com/users/chrisdias/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdias/received_events","type":"User","site_admin":false},"open_issues":1831,"closed_issues":1351,"state":"open","created_at":"2015-11-15T10:30:19Z","updated_at":"2017-02-15T22:12:41Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2017-02-15T22:12:41Z","updated_at":"2017-02-15T22:12:41Z","closed_at":null,"body":"This is a proposal to improve VS Code's integration with the terminal output. Currently you may have noticed that the names terminals have in the dropdown may not represent the command currently being run, especially on Windows.\r\n\r\n## Problem\r\n\r\nOn Linux and macOS the behavior is to use the name of the process executable, this does update when new processes are run but unfortunately there is up to a 200ms delay in doing this as we need to poll for it.\r\n\r\nOn Windows the behavior is to always use the *basename* of the shell process executable (eg. powershell.exe, cmd.exe, etc.), this *does not* change when there is a command run or a shell change.\r\n\r\nDue to these limitations we can't reliably tell what process/args are currently being run.\r\n\r\n## Potential Solution\r\n\r\nA setting something like this could be introduced:\r\n\r\n```js\r\n\"terminal.integrated.promptMatchers\": {\r\n  \"bash\": \"(bash-\\d\\.\\d)?$\\s(.*)\",\r\n  \"cmd.exe\": \"...\"\r\n}\r\n```\r\n\r\nThen depending on the process title we have access to described in the Problem section, we can select the valid item from `promptMatchers`. This could then be used on every line of output to detect when each command starts and finished.\r\n\r\nThis would enable, among other things, the ability to register link matchers under certain conexts. For example:\r\n\r\n```ts\r\n// Linkify \\w\\.\\w in the output of a ls command that will open the file when clicked\r\nterm.registerLinkMatcher(/\\w\\.\\w/, link => openFile(link), 0, /*context*/ 'ls');\r\n```\r\n\r\nGiven a shell with the default configuration this would allow us to linkify common commands in a relatively \r\n\r\n### Edge Cases\r\n\r\n- This wouldn't work for custom shells that are launched within a Windows terminal, for example if cmd.exe is configured and powershell.exe is launched from that terminal, the cmd.exe matcher would be used.\r\n\r\n### Questions\r\n\r\n- This would only work for certain cases when we have the cwd as part of the prompt, if the prompt doesn't contain the cwd would this just be disabled?\r\n- Is the setting too complex, especially with the possibility of adding regex indexes?\r\n- This functionality would rely on per-row link matchers upstream as described in https://github.com/sourcelair/xterm.js/pull/538#issuecomment-280146784\r\n\r\n## Related items\r\n\r\n- https://github.com/Microsoft/vscode/issues/18454 ITerminalInstance support for link detection\r\n\r\n**Blocked by**\r\n\r\n- https://github.com/Microsoft/vscode/issues/18453 ITerminalInstance.onData should be higher level\r\n- https://github.com/sourcelair/xterm.js/pull/538 xterm.js: Implement web links and custom link matcher registration"}}
{"actor":{"display_login":"Tyriar"}}