{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/codeformatter/pulls/comments/26039668","id":26039668,"diff_hunk":"@@ -0,0 +1,75 @@\n+﻿// Copyright (c) Microsoft. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+\n+using System;\n+using System.IO;\n+using System.Text;\n+using Microsoft.CodeAnalysis;\n+using Microsoft.CodeAnalysis.Host.Mef;\n+using Microsoft.CodeAnalysis.Text;\n+\n+namespace Microsoft.DotNet.CodeFormatting\n+{\n+    public sealed class ResponseFileWorkspace : Workspace\n+    {\n+        private ResponseFileWorkspace()\n+            : base(DesktopMefHostServices.DefaultServices, \"Custom\")\n+        {\n+        }\n+\n+        public static ResponseFileWorkspace Create()\n+        {\n+            return new ResponseFileWorkspace();\n+        }\n+\n+        public Project OpenCommandLineProject(string responseFile, string language)\n+        {\n+            // This line deserves better error handling, but the tools current model is just throwing exception for most errors.\n+            // Issue: #90\n+            string rspContents = File.ReadAllText(responseFile);\n+\n+            var projectInfo = CommandLineProject.CreateProjectInfo(\n+                projectName: Path.GetFileNameWithoutExtension(responseFile),\n+                language: language,\n+                commandLine: rspContents,\n+                baseDirectory: Path.GetDirectoryName(Path.GetFullPath(responseFile)),\n+                workspace: this);\n+\n+            this.OnProjectAdded(projectInfo);\n+\n+            return this.CurrentSolution.GetProject(projectInfo.Id);\n+        }\n+\n+        public override bool CanApplyChange(ApplyChangesKind feature)\n+        {\n+            return feature == ApplyChangesKind.ChangeDocument;\n+        }\n+\n+        protected override void ApplyDocumentTextChanged(DocumentId documentId, SourceText text)\n+        {\n+            var document = this.CurrentSolution.GetDocument(documentId);\n+            if (document != null)\n+            {\n+                try\n+                {\n+                    var filePath = document.FilePath;\n+                    Directory.CreateDirectory(Path.GetDirectoryName(filePath));\n+                    using (var writer = new StreamWriter(filePath, append: false, encoding: Encoding.UTF8))","path":"src/Microsoft.DotNet.CodeFormatting/ResponseFileWorkspace.cs","position":57,"original_position":57,"commit_id":"d842ecdd9c76fdb777dbde525fd68d1394a4e837","original_commit_id":"d842ecdd9c76fdb777dbde525fd68d1394a4e837","user":{"login":"dannyvv","id":11037542,"avatar_url":"https://avatars.githubusercontent.com/u/11037542?v=3","gravatar_id":"","url":"https://api.github.com/users/dannyvv","html_url":"https://github.com/dannyvv","followers_url":"https://api.github.com/users/dannyvv/followers","following_url":"https://api.github.com/users/dannyvv/following{/other_user}","gists_url":"https://api.github.com/users/dannyvv/gists{/gist_id}","starred_url":"https://api.github.com/users/dannyvv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dannyvv/subscriptions","organizations_url":"https://api.github.com/users/dannyvv/orgs","repos_url":"https://api.github.com/users/dannyvv/repos","events_url":"https://api.github.com/users/dannyvv/events{/privacy}","received_events_url":"https://api.github.com/users/dannyvv/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2015-03-09T14:34:00Z","updated_at":"2015-03-09T14:34:00Z","html_url":"https://github.com/dotnet/codeformatter/pull/91#discussion_r26039668","pull_request_url":"https://api.github.com/repos/dotnet/codeformatter/pulls/91","_links":{"self":{"href":"https://api.github.com/repos/dotnet/codeformatter/pulls/comments/26039668"},"html":{"href":"https://github.com/dotnet/codeformatter/pull/91#discussion_r26039668"},"pull_request":{"href":"https://api.github.com/repos/dotnet/codeformatter/pulls/91"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/codeformatter/pulls/91","id":30611628,"html_url":"https://github.com/dotnet/codeformatter/pull/91","diff_url":"https://github.com/dotnet/codeformatter/pull/91.diff","patch_url":"https://github.com/dotnet/codeformatter/pull/91.patch","issue_url":"https://api.github.com/repos/dotnet/codeformatter/issues/91","number":91,"state":"open","locked":false,"title":"Add support for cleaning up files without a solution or project.","user":{"login":"dannyvv","id":11037542,"avatar_url":"https://avatars.githubusercontent.com/u/11037542?v=3","gravatar_id":"","url":"https://api.github.com/users/dannyvv","html_url":"https://github.com/dannyvv","followers_url":"https://api.github.com/users/dannyvv/followers","following_url":"https://api.github.com/users/dannyvv/following{/other_user}","gists_url":"https://api.github.com/users/dannyvv/gists{/gist_id}","starred_url":"https://api.github.com/users/dannyvv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dannyvv/subscriptions","organizations_url":"https://api.github.com/users/dannyvv/orgs","repos_url":"https://api.github.com/users/dannyvv/repos","events_url":"https://api.github.com/users/dannyvv/events{/privacy}","received_events_url":"https://api.github.com/users/dannyvv/received_events","type":"User","site_admin":false},"body":"The passed file, can now not only be an msbuild project or a solution file. But also an rsp file.\r\nThe rsp file is the same file format as the commandline arguments that gets passed to csc.exe\r\n\r\nCloses #89","created_at":"2015-03-06T00:47:42Z","updated_at":"2015-03-09T14:34:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ad06e8eeb81f1a724d2ace68e66549644f1ae591","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/codeformatter/pulls/91/commits","review_comments_url":"https://api.github.com/repos/dotnet/codeformatter/pulls/91/comments","review_comment_url":"https://api.github.com/repos/dotnet/codeformatter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/codeformatter/issues/91/comments","statuses_url":"https://api.github.com/repos/dotnet/codeformatter/statuses/d842ecdd9c76fdb777dbde525fd68d1394a4e837","head":{"label":"dannyvv:master","ref":"master","sha":"d842ecdd9c76fdb777dbde525fd68d1394a4e837","user":{"login":"dannyvv","id":11037542,"avatar_url":"https://avatars.githubusercontent.com/u/11037542?v=3","gravatar_id":"","url":"https://api.github.com/users/dannyvv","html_url":"https://github.com/dannyvv","followers_url":"https://api.github.com/users/dannyvv/followers","following_url":"https://api.github.com/users/dannyvv/following{/other_user}","gists_url":"https://api.github.com/users/dannyvv/gists{/gist_id}","starred_url":"https://api.github.com/users/dannyvv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dannyvv/subscriptions","organizations_url":"https://api.github.com/users/dannyvv/orgs","repos_url":"https://api.github.com/users/dannyvv/repos","events_url":"https://api.github.com/users/dannyvv/events{/privacy}","received_events_url":"https://api.github.com/users/dannyvv/received_events","type":"User","site_admin":false},"repo":{"id":31744725,"name":"codeformatter","full_name":"dannyvv/codeformatter","owner":{"login":"dannyvv","id":11037542,"avatar_url":"https://avatars.githubusercontent.com/u/11037542?v=3","gravatar_id":"","url":"https://api.github.com/users/dannyvv","html_url":"https://github.com/dannyvv","followers_url":"https://api.github.com/users/dannyvv/followers","following_url":"https://api.github.com/users/dannyvv/following{/other_user}","gists_url":"https://api.github.com/users/dannyvv/gists{/gist_id}","starred_url":"https://api.github.com/users/dannyvv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dannyvv/subscriptions","organizations_url":"https://api.github.com/users/dannyvv/orgs","repos_url":"https://api.github.com/users/dannyvv/repos","events_url":"https://api.github.com/users/dannyvv/events{/privacy}","received_events_url":"https://api.github.com/users/dannyvv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dannyvv/codeformatter","description":"Tool that uses Roslyn to automatically rewrite the source to follow our coding styles","fork":true,"url":"https://api.github.com/repos/dannyvv/codeformatter","forks_url":"https://api.github.com/repos/dannyvv/codeformatter/forks","keys_url":"https://api.github.com/repos/dannyvv/codeformatter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dannyvv/codeformatter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dannyvv/codeformatter/teams","hooks_url":"https://api.github.com/repos/dannyvv/codeformatter/hooks","issue_events_url":"https://api.github.com/repos/dannyvv/codeformatter/issues/events{/number}","events_url":"https://api.github.com/repos/dannyvv/codeformatter/events","assignees_url":"https://api.github.com/repos/dannyvv/codeformatter/assignees{/user}","branches_url":"https://api.github.com/repos/dannyvv/codeformatter/branches{/branch}","tags_url":"https://api.github.com/repos/dannyvv/codeformatter/tags","blobs_url":"https://api.github.com/repos/dannyvv/codeformatter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dannyvv/codeformatter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dannyvv/codeformatter/git/refs{/sha}","trees_url":"https://api.github.com/repos/dannyvv/codeformatter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dannyvv/codeformatter/statuses/{sha}","languages_url":"https://api.github.com/repos/dannyvv/codeformatter/languages","stargazers_url":"https://api.github.com/repos/dannyvv/codeformatter/stargazers","contributors_url":"https://api.github.com/repos/dannyvv/codeformatter/contributors","subscribers_url":"https://api.github.com/repos/dannyvv/codeformatter/subscribers","subscription_url":"https://api.github.com/repos/dannyvv/codeformatter/subscription","commits_url":"https://api.github.com/repos/dannyvv/codeformatter/commits{/sha}","git_commits_url":"https://api.github.com/repos/dannyvv/codeformatter/git/commits{/sha}","comments_url":"https://api.github.com/repos/dannyvv/codeformatter/comments{/number}","issue_comment_url":"https://api.github.com/repos/dannyvv/codeformatter/issues/comments{/number}","contents_url":"https://api.github.com/repos/dannyvv/codeformatter/contents/{+path}","compare_url":"https://api.github.com/repos/dannyvv/codeformatter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dannyvv/codeformatter/merges","archive_url":"https://api.github.com/repos/dannyvv/codeformatter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dannyvv/codeformatter/downloads","issues_url":"https://api.github.com/repos/dannyvv/codeformatter/issues{/number}","pulls_url":"https://api.github.com/repos/dannyvv/codeformatter/pulls{/number}","milestones_url":"https://api.github.com/repos/dannyvv/codeformatter/milestones{/number}","notifications_url":"https://api.github.com/repos/dannyvv/codeformatter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dannyvv/codeformatter/labels{/name}","releases_url":"https://api.github.com/repos/dannyvv/codeformatter/releases{/id}","created_at":"2015-03-06T00:40:10Z","updated_at":"2015-03-06T02:41:06Z","pushed_at":"2015-03-06T02:41:06Z","git_url":"git://github.com/dannyvv/codeformatter.git","ssh_url":"git@github.com:dannyvv/codeformatter.git","clone_url":"https://github.com/dannyvv/codeformatter.git","svn_url":"https://github.com/dannyvv/codeformatter","homepage":"","size":1732,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"2dbd20cd000fbc4207471468101a73aaabc90582","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":28896487,"name":"codeformatter","full_name":"dotnet/codeformatter","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/codeformatter","description":"Tool that uses Roslyn to automatically rewrite the source to follow our coding styles","fork":false,"url":"https://api.github.com/repos/dotnet/codeformatter","forks_url":"https://api.github.com/repos/dotnet/codeformatter/forks","keys_url":"https://api.github.com/repos/dotnet/codeformatter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/codeformatter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/codeformatter/teams","hooks_url":"https://api.github.com/repos/dotnet/codeformatter/hooks","issue_events_url":"https://api.github.com/repos/dotnet/codeformatter/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/codeformatter/events","assignees_url":"https://api.github.com/repos/dotnet/codeformatter/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/codeformatter/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/codeformatter/tags","blobs_url":"https://api.github.com/repos/dotnet/codeformatter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/codeformatter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/codeformatter/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/codeformatter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/codeformatter/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/codeformatter/languages","stargazers_url":"https://api.github.com/repos/dotnet/codeformatter/stargazers","contributors_url":"https://api.github.com/repos/dotnet/codeformatter/contributors","subscribers_url":"https://api.github.com/repos/dotnet/codeformatter/subscribers","subscription_url":"https://api.github.com/repos/dotnet/codeformatter/subscription","commits_url":"https://api.github.com/repos/dotnet/codeformatter/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/codeformatter/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/codeformatter/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/codeformatter/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/codeformatter/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/codeformatter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/codeformatter/merges","archive_url":"https://api.github.com/repos/dotnet/codeformatter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/codeformatter/downloads","issues_url":"https://api.github.com/repos/dotnet/codeformatter/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/codeformatter/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/codeformatter/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/codeformatter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/codeformatter/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/codeformatter/releases{/id}","created_at":"2015-01-07T03:28:44Z","updated_at":"2015-03-09T01:47:42Z","pushed_at":"2015-03-09T01:47:42Z","git_url":"git://github.com/dotnet/codeformatter.git","ssh_url":"git@github.com:dotnet/codeformatter.git","clone_url":"https://github.com/dotnet/codeformatter.git","svn_url":"https://github.com/dotnet/codeformatter","homepage":"","size":1732,"stargazers_count":302,"watchers_count":302,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":26,"forks":31,"open_issues":26,"watchers":302,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/codeformatter/pulls/91"},"html":{"href":"https://github.com/dotnet/codeformatter/pull/91"},"issue":{"href":"https://api.github.com/repos/dotnet/codeformatter/issues/91"},"comments":{"href":"https://api.github.com/repos/dotnet/codeformatter/issues/91/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/codeformatter/pulls/91/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/codeformatter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/codeformatter/pulls/91/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/codeformatter/statuses/d842ecdd9c76fdb777dbde525fd68d1394a4e837"}}}}