{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/RTVS/pulls/comments/63593223","id":63593223,"diff_hunk":"@@ -0,0 +1,63 @@\n+﻿// Copyright (c) Microsoft Corporation. All rights reserved.\n+// Licensed under the MIT License. See LICENSE in the project root for license information.\n+\n+using Microsoft.Common.Core.Shell;\n+using Microsoft.R.Components.ContentTypes;\n+using Microsoft.R.Components.Controller;\n+using Microsoft.R.Components.Extensions;\n+using Microsoft.R.Components.InteractiveWorkflow;\n+using Microsoft.VisualStudio.Text.Editor;\n+\n+namespace Microsoft.VisualStudio.R.Package.Repl.Commands {\n+    public sealed class SourceRScriptCommand : IMenuCommand {\n+        private readonly IRInteractiveWorkflow _interactiveWorkflow;\n+        private readonly IActiveWpfTextViewTracker _activeTextViewTracker;\n+        private readonly bool _echo;\n+\n+        public SourceRScriptCommand(\n+            IRInteractiveWorkflow interactiveWorkflow,\n+            IActiveWpfTextViewTracker activeTextViewTracker,\n+            bool echo\n+        ) {\n+            _interactiveWorkflow = interactiveWorkflow;\n+            _activeTextViewTracker = activeTextViewTracker;\n+            _echo = echo;\n+        }\n+\n+        public CommandStatus Status {\n+            get {\n+                var status = CommandStatus.Supported;\n+                if (_interactiveWorkflow.ActiveWindow == null) {\n+                    status |= CommandStatus.Invisible;\n+                } else if (!string.IsNullOrEmpty(GetFilePath())) {\n+                    status |= CommandStatus.Enabled;\n+                }\n+                return status;\n+            }\n+        }\n+\n+        public CommandResult Invoke(object inputArg, ref object outputArg) {","path":"src/R/Components/Impl/Repl/Commands/SourceRScriptCommand.cs","position":39,"original_position":39,"commit_id":"00a3e2b87ac1f536f0dcd2ba5f85d49d99b43da9","original_commit_id":"00a3e2b87ac1f536f0dcd2ba5f85d49d99b43da9","user":{"login":"int19h","id":1175142,"avatar_url":"https://avatars.githubusercontent.com/u/1175142?v=3","gravatar_id":"","url":"https://api.github.com/users/int19h","html_url":"https://github.com/int19h","followers_url":"https://api.github.com/users/int19h/followers","following_url":"https://api.github.com/users/int19h/following{/other_user}","gists_url":"https://api.github.com/users/int19h/gists{/gist_id}","starred_url":"https://api.github.com/users/int19h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/int19h/subscriptions","organizations_url":"https://api.github.com/users/int19h/orgs","repos_url":"https://api.github.com/users/int19h/repos","events_url":"https://api.github.com/users/int19h/events{/privacy}","received_events_url":"https://api.github.com/users/int19h/received_events","type":"User","site_admin":false},"body":"Renaming is suggested because the existing interface occupies the \"ICommand\" name that would really be more appropriate for the new thing (and even though they're in different namespaces, a lot of code that uses the interface needs both of them, causing conflicts). The proposed approach is a simple mechanical renaming of existing ICommand to IEditorCommand (or something along these lines), so it would be a simple Refactor -> Rename, not requiring any particular effort.\r\n\r\n---\r\nIn reply to: [63592100](https://github.com/Microsoft/RTVS/pull/1785#discussion_r63592100) [](ancestors = 63592100)","created_at":"2016-05-17T20:03:17Z","updated_at":"2016-05-17T20:03:17Z","html_url":"https://github.com/Microsoft/RTVS/pull/1785#discussion_r63593223","pull_request_url":"https://api.github.com/repos/Microsoft/RTVS/pulls/1785","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/RTVS/pulls/comments/63593223"},"html":{"href":"https://github.com/Microsoft/RTVS/pull/1785#discussion_r63593223"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/RTVS/pulls/1785"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/RTVS/pulls/1785","id":70290215,"html_url":"https://github.com/Microsoft/RTVS/pull/1785","diff_url":"https://github.com/Microsoft/RTVS/pull/1785.diff","patch_url":"https://github.com/Microsoft/RTVS/pull/1785.patch","issue_url":"https://api.github.com/repos/Microsoft/RTVS/issues/1785","number":1785,"state":"open","locked":false,"title":"Command refactoring","user":{"login":"int19h","id":1175142,"avatar_url":"https://avatars.githubusercontent.com/u/1175142?v=3","gravatar_id":"","url":"https://api.github.com/users/int19h","html_url":"https://github.com/int19h","followers_url":"https://api.github.com/users/int19h/followers","following_url":"https://api.github.com/users/int19h/following{/other_user}","gists_url":"https://api.github.com/users/int19h/gists{/gist_id}","starred_url":"https://api.github.com/users/int19h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/int19h/subscriptions","organizations_url":"https://api.github.com/users/int19h/orgs","repos_url":"https://api.github.com/users/int19h/repos","events_url":"https://api.github.com/users/int19h/events{/privacy}","received_events_url":"https://api.github.com/users/int19h/received_events","type":"User","site_admin":false},"body":"Add a generic interface for commands that has no references to VS APIs, and a helper wrapper to produce PackageCommand, to improve testability.\r\n\r\nConvert SourceRScript to the new interface + wrapper, and move it to the R.Components assembly.\r\n\r\nChange SourceRScript test to use non-mocked IInteractiveWindow, and verify side effect of the code being executed, instead of the code itself.","created_at":"2016-05-17T02:12:00Z","updated_at":"2016-05-17T20:03:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12c55af67dfb86f77b730e5f99c196e5c80ea154","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/RTVS/pulls/1785/commits","review_comments_url":"https://api.github.com/repos/Microsoft/RTVS/pulls/1785/comments","review_comment_url":"https://api.github.com/repos/Microsoft/RTVS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/RTVS/issues/1785/comments","statuses_url":"https://api.github.com/repos/Microsoft/RTVS/statuses/00a3e2b87ac1f536f0dcd2ba5f85d49d99b43da9","head":{"label":"int19h:cmd","ref":"cmd","sha":"00a3e2b87ac1f536f0dcd2ba5f85d49d99b43da9","user":{"login":"int19h","id":1175142,"avatar_url":"https://avatars.githubusercontent.com/u/1175142?v=3","gravatar_id":"","url":"https://api.github.com/users/int19h","html_url":"https://github.com/int19h","followers_url":"https://api.github.com/users/int19h/followers","following_url":"https://api.github.com/users/int19h/following{/other_user}","gists_url":"https://api.github.com/users/int19h/gists{/gist_id}","starred_url":"https://api.github.com/users/int19h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/int19h/subscriptions","organizations_url":"https://api.github.com/users/int19h/orgs","repos_url":"https://api.github.com/users/int19h/repos","events_url":"https://api.github.com/users/int19h/events{/privacy}","received_events_url":"https://api.github.com/users/int19h/received_events","type":"User","site_admin":false},"repo":{"id":53513140,"name":"RTVS","full_name":"int19h/RTVS","owner":{"login":"int19h","id":1175142,"avatar_url":"https://avatars.githubusercontent.com/u/1175142?v=3","gravatar_id":"","url":"https://api.github.com/users/int19h","html_url":"https://github.com/int19h","followers_url":"https://api.github.com/users/int19h/followers","following_url":"https://api.github.com/users/int19h/following{/other_user}","gists_url":"https://api.github.com/users/int19h/gists{/gist_id}","starred_url":"https://api.github.com/users/int19h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/int19h/subscriptions","organizations_url":"https://api.github.com/users/int19h/orgs","repos_url":"https://api.github.com/users/int19h/repos","events_url":"https://api.github.com/users/int19h/events{/privacy}","received_events_url":"https://api.github.com/users/int19h/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/int19h/RTVS","description":"R Tools for Visual Studio.","fork":true,"url":"https://api.github.com/repos/int19h/RTVS","forks_url":"https://api.github.com/repos/int19h/RTVS/forks","keys_url":"https://api.github.com/repos/int19h/RTVS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/int19h/RTVS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/int19h/RTVS/teams","hooks_url":"https://api.github.com/repos/int19h/RTVS/hooks","issue_events_url":"https://api.github.com/repos/int19h/RTVS/issues/events{/number}","events_url":"https://api.github.com/repos/int19h/RTVS/events","assignees_url":"https://api.github.com/repos/int19h/RTVS/assignees{/user}","branches_url":"https://api.github.com/repos/int19h/RTVS/branches{/branch}","tags_url":"https://api.github.com/repos/int19h/RTVS/tags","blobs_url":"https://api.github.com/repos/int19h/RTVS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/int19h/RTVS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/int19h/RTVS/git/refs{/sha}","trees_url":"https://api.github.com/repos/int19h/RTVS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/int19h/RTVS/statuses/{sha}","languages_url":"https://api.github.com/repos/int19h/RTVS/languages","stargazers_url":"https://api.github.com/repos/int19h/RTVS/stargazers","contributors_url":"https://api.github.com/repos/int19h/RTVS/contributors","subscribers_url":"https://api.github.com/repos/int19h/RTVS/subscribers","subscription_url":"https://api.github.com/repos/int19h/RTVS/subscription","commits_url":"https://api.github.com/repos/int19h/RTVS/commits{/sha}","git_commits_url":"https://api.github.com/repos/int19h/RTVS/git/commits{/sha}","comments_url":"https://api.github.com/repos/int19h/RTVS/comments{/number}","issue_comment_url":"https://api.github.com/repos/int19h/RTVS/issues/comments{/number}","contents_url":"https://api.github.com/repos/int19h/RTVS/contents/{+path}","compare_url":"https://api.github.com/repos/int19h/RTVS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/int19h/RTVS/merges","archive_url":"https://api.github.com/repos/int19h/RTVS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/int19h/RTVS/downloads","issues_url":"https://api.github.com/repos/int19h/RTVS/issues{/number}","pulls_url":"https://api.github.com/repos/int19h/RTVS/pulls{/number}","milestones_url":"https://api.github.com/repos/int19h/RTVS/milestones{/number}","notifications_url":"https://api.github.com/repos/int19h/RTVS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/int19h/RTVS/labels{/name}","releases_url":"https://api.github.com/repos/int19h/RTVS/releases{/id}","deployments_url":"https://api.github.com/repos/int19h/RTVS/deployments","created_at":"2016-03-09T16:28:28Z","updated_at":"2016-03-09T16:28:34Z","pushed_at":"2016-05-17T02:11:36Z","git_url":"git://github.com/int19h/RTVS.git","ssh_url":"git@github.com:int19h/RTVS.git","clone_url":"https://github.com/int19h/RTVS.git","svn_url":"https://github.com/int19h/RTVS","homepage":null,"size":46213,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"4982f69cd7eb3d5368d482fc0845ee579bd9ea4d","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":38640473,"name":"RTVS","full_name":"Microsoft/RTVS","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/RTVS","description":"R Tools for Visual Studio.","fork":false,"url":"https://api.github.com/repos/Microsoft/RTVS","forks_url":"https://api.github.com/repos/Microsoft/RTVS/forks","keys_url":"https://api.github.com/repos/Microsoft/RTVS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/RTVS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/RTVS/teams","hooks_url":"https://api.github.com/repos/Microsoft/RTVS/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/RTVS/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/RTVS/events","assignees_url":"https://api.github.com/repos/Microsoft/RTVS/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/RTVS/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/RTVS/tags","blobs_url":"https://api.github.com/repos/Microsoft/RTVS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/RTVS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/RTVS/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/RTVS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/RTVS/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/RTVS/languages","stargazers_url":"https://api.github.com/repos/Microsoft/RTVS/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/RTVS/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/RTVS/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/RTVS/subscription","commits_url":"https://api.github.com/repos/Microsoft/RTVS/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/RTVS/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/RTVS/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/RTVS/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/RTVS/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/RTVS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/RTVS/merges","archive_url":"https://api.github.com/repos/Microsoft/RTVS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/RTVS/downloads","issues_url":"https://api.github.com/repos/Microsoft/RTVS/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/RTVS/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/RTVS/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/RTVS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/RTVS/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/RTVS/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/RTVS/deployments","created_at":"2015-07-06T19:14:09Z","updated_at":"2016-05-11T06:20:21Z","pushed_at":"2016-05-17T16:41:43Z","git_url":"git://github.com/Microsoft/RTVS.git","ssh_url":"git@github.com:Microsoft/RTVS.git","clone_url":"https://github.com/Microsoft/RTVS.git","svn_url":"https://github.com/Microsoft/RTVS","homepage":null,"size":46719,"stargazers_count":150,"watchers_count":150,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":252,"forks":34,"open_issues":252,"watchers":150,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/RTVS/pulls/1785"},"html":{"href":"https://github.com/Microsoft/RTVS/pull/1785"},"issue":{"href":"https://api.github.com/repos/Microsoft/RTVS/issues/1785"},"comments":{"href":"https://api.github.com/repos/Microsoft/RTVS/issues/1785/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/RTVS/pulls/1785/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/RTVS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/RTVS/pulls/1785/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/RTVS/statuses/00a3e2b87ac1f536f0dcd2ba5f85d49d99b43da9"}}}}