{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/42437704","id":42437704,"diff_hunk":"@@ -0,0 +1,56 @@\n+﻿// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.\n+\n+using System;\n+using System.ComponentModel.Composition;\n+using System.Windows;\n+using Microsoft.VisualStudio.Text.Operations;\n+using Microsoft.VisualStudio.Utilities;         \n+using Microsoft.CodeAnalysis.Editor.Commands;\n+using Microsoft.CodeAnalysis.Editor.Interactive;\n+\n+namespace Microsoft.CodeAnalysis.Editor.CommandHandlers\n+{\n+    [ExportCommandHandler(\"InteractivePasteCommandHandler\", ContentTypeNames.RoslynContentType)]\n+    [Order(After = PredefinedCommandHandlerNames.FormatDocument)]\n+    internal sealed class InteractivePasteCommandHandler : ICommandHandler<PasteCommandArgs>\n+    {\n+        private readonly IEditorOperationsFactoryService _editorOperationsFactoryService;\n+\n+        [ImportingConstructor]\n+        public InteractivePasteCommandHandler(IEditorOperationsFactoryService editorOperationsFactoryService)\n+        {\n+            _editorOperationsFactoryService = editorOperationsFactoryService;\n+        }\n+\n+        public void ExecuteCommand(PasteCommandArgs args, Action nextHandler)\n+        {\n+            if (args.TextView.TextBuffer.ContentType.TypeName != PredefinedInteractiveContentTypes.InteractiveContentTypeName &&\n+                Clipboard.ContainsData(ClipboardFormats.Interactive))\n+            {\n+                var editorOperation = _editorOperationsFactoryService.GetEditorOperations(args.TextView);\n+                var blocks = BufferBlock.Deserialize((string)Clipboard.GetData(ClipboardFormats.Interactive));\n+                // Paste each block separately.\n+                foreach (var block in blocks)\n+                {\n+                    switch (block.Kind)\n+                    {\n+                        case ReplSpanKind.Input:","path":"src/EditorFeatures/Core/CommandHandlers/InteractivePasteCommandHandler.cs","position":39,"original_position":37,"commit_id":"f1f050130155457e13b6c4eab800cbbb60896dfe","original_commit_id":"300c8f4ac27013b7dc5aa634e4598050956a2d1b","user":{"login":"genlu","id":788783,"avatar_url":"https://avatars.githubusercontent.com/u/788783?v=3","gravatar_id":"","url":"https://api.github.com/users/genlu","html_url":"https://github.com/genlu","followers_url":"https://api.github.com/users/genlu/followers","following_url":"https://api.github.com/users/genlu/following{/other_user}","gists_url":"https://api.github.com/users/genlu/gists{/gist_id}","starred_url":"https://api.github.com/users/genlu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genlu/subscriptions","organizations_url":"https://api.github.com/users/genlu/orgs","repos_url":"https://api.github.com/users/genlu/repos","events_url":"https://api.github.com/users/genlu/events{/privacy}","received_events_url":"https://api.github.com/users/genlu/received_events","type":"User","site_admin":false},"body":"Had an offline chat with @cston, we decided to keep this as is.","created_at":"2015-10-19T23:09:08Z","updated_at":"2015-10-19T23:09:08Z","html_url":"https://github.com/dotnet/roslyn/pull/6157#discussion_r42437704","pull_request_url":"https://api.github.com/repos/dotnet/roslyn/pulls/6157","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/42437704"},"html":{"href":"https://github.com/dotnet/roslyn/pull/6157#discussion_r42437704"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/6157"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/6157","id":48125940,"html_url":"https://github.com/dotnet/roslyn/pull/6157","diff_url":"https://github.com/dotnet/roslyn/pull/6157.diff","patch_url":"https://github.com/dotnet/roslyn/pull/6157.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/6157","number":6157,"state":"open","locked":false,"title":"Add a command handler for pasting from interactive window","user":{"login":"genlu","id":788783,"avatar_url":"https://avatars.githubusercontent.com/u/788783?v=3","gravatar_id":"","url":"https://api.github.com/users/genlu","html_url":"https://github.com/genlu","followers_url":"https://api.github.com/users/genlu/followers","following_url":"https://api.github.com/users/genlu/following{/other_user}","gists_url":"https://api.github.com/users/genlu/gists{/gist_id}","starred_url":"https://api.github.com/users/genlu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genlu/subscriptions","organizations_url":"https://api.github.com/users/genlu/orgs","repos_url":"https://api.github.com/users/genlu/repos","events_url":"https://api.github.com/users/genlu/events{/privacy}","received_events_url":"https://api.github.com/users/genlu/received_events","type":"User","site_admin":false},"body":"- The expected behavior is, when pasting text copied from interactive window into CS/VB code editor, the prompt should be dropped. See https://github.com/dotnet/roslyn/issues/5212. \r\n- `InteractivePasteCommandHandler` is created under `EditorFeatures` with related types moved over from `InteractiveWindow` to avoid MEF importing interactive assemblies in VS.\r\n- ~~Here's probably the most important part of this change**: As a result of moving things around, `PredefinedInteractiveContentTypes` is now exposed by `Microsoft.CodeAnalysis.EditorFeatures.dll` under `Microsoft.CodeAnalysis.Editor.Interactive` namespace. This change **will** affect PTVS. https://github.com/Microsoft/PTVS/search?utf8=%E2%9C%93&q=PredefinedInteractiveContentTypes~~\r\n\r\n@dotnet/interactive @dotnet/roslyn-ide \r\n@zooba @DinoV\r\n\r\nUpdate:\r\nDuplicated the string literal so no change on any public APIs.","created_at":"2015-10-19T21:02:28Z","updated_at":"2015-10-19T23:09:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1c50a9b98ff7b40d7434c6da99dc50a8234fcf33","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn/pulls/6157/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn/pulls/6157/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/6157/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/f1f050130155457e13b6c4eab800cbbb60896dfe","head":{"label":"genlu:AddHandler","ref":"AddHandler","sha":"f1f050130155457e13b6c4eab800cbbb60896dfe","user":{"login":"genlu","id":788783,"avatar_url":"https://avatars.githubusercontent.com/u/788783?v=3","gravatar_id":"","url":"https://api.github.com/users/genlu","html_url":"https://github.com/genlu","followers_url":"https://api.github.com/users/genlu/followers","following_url":"https://api.github.com/users/genlu/following{/other_user}","gists_url":"https://api.github.com/users/genlu/gists{/gist_id}","starred_url":"https://api.github.com/users/genlu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genlu/subscriptions","organizations_url":"https://api.github.com/users/genlu/orgs","repos_url":"https://api.github.com/users/genlu/repos","events_url":"https://api.github.com/users/genlu/events{/privacy}","received_events_url":"https://api.github.com/users/genlu/received_events","type":"User","site_admin":false},"repo":{"id":38650594,"name":"roslyn","full_name":"genlu/roslyn","owner":{"login":"genlu","id":788783,"avatar_url":"https://avatars.githubusercontent.com/u/788783?v=3","gravatar_id":"","url":"https://api.github.com/users/genlu","html_url":"https://github.com/genlu","followers_url":"https://api.github.com/users/genlu/followers","following_url":"https://api.github.com/users/genlu/following{/other_user}","gists_url":"https://api.github.com/users/genlu/gists{/gist_id}","starred_url":"https://api.github.com/users/genlu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genlu/subscriptions","organizations_url":"https://api.github.com/users/genlu/orgs","repos_url":"https://api.github.com/users/genlu/repos","events_url":"https://api.github.com/users/genlu/events{/privacy}","received_events_url":"https://api.github.com/users/genlu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/genlu/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":true,"url":"https://api.github.com/repos/genlu/roslyn","forks_url":"https://api.github.com/repos/genlu/roslyn/forks","keys_url":"https://api.github.com/repos/genlu/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/genlu/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/genlu/roslyn/teams","hooks_url":"https://api.github.com/repos/genlu/roslyn/hooks","issue_events_url":"https://api.github.com/repos/genlu/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/genlu/roslyn/events","assignees_url":"https://api.github.com/repos/genlu/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/genlu/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/genlu/roslyn/tags","blobs_url":"https://api.github.com/repos/genlu/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/genlu/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/genlu/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/genlu/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/genlu/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/genlu/roslyn/languages","stargazers_url":"https://api.github.com/repos/genlu/roslyn/stargazers","contributors_url":"https://api.github.com/repos/genlu/roslyn/contributors","subscribers_url":"https://api.github.com/repos/genlu/roslyn/subscribers","subscription_url":"https://api.github.com/repos/genlu/roslyn/subscription","commits_url":"https://api.github.com/repos/genlu/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/genlu/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/genlu/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/genlu/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/genlu/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/genlu/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/genlu/roslyn/merges","archive_url":"https://api.github.com/repos/genlu/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/genlu/roslyn/downloads","issues_url":"https://api.github.com/repos/genlu/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/genlu/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/genlu/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/genlu/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/genlu/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/genlu/roslyn/releases{/id}","created_at":"2015-07-06T22:48:49Z","updated_at":"2015-07-06T22:49:19Z","pushed_at":"2015-10-19T23:06:23Z","git_url":"git://github.com/genlu/roslyn.git","ssh_url":"git@github.com:genlu/roslyn.git","clone_url":"https://github.com/genlu/roslyn.git","svn_url":"https://github.com/genlu/roslyn","homepage":"","size":106269,"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":"dotnet:master","ref":"master","sha":"4e07deb17d8c1fa151e6d42d926a383132c451e7","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":29078997,"name":"roslyn","full_name":"dotnet/roslyn","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":false,"url":"https://api.github.com/repos/dotnet/roslyn","forks_url":"https://api.github.com/repos/dotnet/roslyn/forks","keys_url":"https://api.github.com/repos/dotnet/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/roslyn/teams","hooks_url":"https://api.github.com/repos/dotnet/roslyn/hooks","issue_events_url":"https://api.github.com/repos/dotnet/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/roslyn/events","assignees_url":"https://api.github.com/repos/dotnet/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/roslyn/tags","blobs_url":"https://api.github.com/repos/dotnet/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/roslyn/languages","stargazers_url":"https://api.github.com/repos/dotnet/roslyn/stargazers","contributors_url":"https://api.github.com/repos/dotnet/roslyn/contributors","subscribers_url":"https://api.github.com/repos/dotnet/roslyn/subscribers","subscription_url":"https://api.github.com/repos/dotnet/roslyn/subscription","commits_url":"https://api.github.com/repos/dotnet/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/roslyn/merges","archive_url":"https://api.github.com/repos/dotnet/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/roslyn/downloads","issues_url":"https://api.github.com/repos/dotnet/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/roslyn/releases{/id}","created_at":"2015-01-11T02:39:03Z","updated_at":"2015-10-19T21:09:52Z","pushed_at":"2015-10-19T23:06:24Z","git_url":"git://github.com/dotnet/roslyn.git","ssh_url":"git@github.com:dotnet/roslyn.git","clone_url":"https://github.com/dotnet/roslyn.git","svn_url":"https://github.com/dotnet/roslyn","homepage":"","size":212660,"stargazers_count":3539,"watchers_count":3539,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":827,"mirror_url":null,"open_issues_count":1557,"forks":827,"open_issues":1557,"watchers":3539,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/6157"},"html":{"href":"https://github.com/dotnet/roslyn/pull/6157"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/6157"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/6157/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/6157/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/6157/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn/statuses/f1f050130155457e13b6c4eab800cbbb60896dfe"}}}}