{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/nodejstools/pulls/comments/69594060","id":69594060,"diff_hunk":"@@ -141,9 +143,73 @@ internal sealed class DiagnosticsCommand : Command {\n                     jsAnalyzer.DumpLog(writer);\n                 }\n             }\n+            res.AppendLine(\"Files:\");\n+            res.AppendLine(Indent(4, GetProjectFileInfo(project)));\n+            return res.ToString();\n+        }\n+\n+        /// <summary>\n+        /// Stores information about a collection of files of a given type.\n+        /// </summary>\n+        private class FileTypeInfo {\n+            private int _count = 0;\n+            private int _maxLineLength = 0;\n+            private int _totalLineLength = 0;\n+\n+            public int Count {\n+                get { return _count; }\n+            }\n+\n+            public int MaxLineLength {\n+                get { return _maxLineLength; }\n+            }\n+\n+            public int AverageLineLength {\n+                get { return _count > 0 ? _totalLineLength / _count : 0; }\n+            }\n+\n+            public void UpdateForFile(string file) {\n+                try {\n+                    int length = File.ReadLines(file).Count();\n+                    ++_count;\n+                    _totalLineLength += length;\n+                    _maxLineLength = Math.Max(_maxLineLength, length);\n+                } catch (IOException) {\n+                    // noop\n+                }\n+            }\n+        }\n+\n+        private static string GetProjectFileInfo(Project.NodejsProjectNode project) {\n+            var fileTypeInfo = new Dictionary<string, FileTypeInfo>();\n+            foreach (var node in project.DiskNodes) {\n+                if (node.Value.ItemNode?.IsExcluded ?? true) {\n+                    continue;\n+                }\n+                var file = node.Key;\n+                var ext = Path.GetExtension(file).ToLowerInvariant();","path":"Nodejs/Product/Nodejs/Commands/DiagnosticsCommand.cs","position":227,"original_position":64,"commit_id":"4ecf6fc168b55cc6d5304c130939a5b0d3f9edc1","original_commit_id":"4ecf6fc168b55cc6d5304c130939a5b0d3f9edc1","user":{"login":"mousetraps","id":762848,"avatar_url":"https://avatars.githubusercontent.com/u/762848?v=3","gravatar_id":"","url":"https://api.github.com/users/mousetraps","html_url":"https://github.com/mousetraps","followers_url":"https://api.github.com/users/mousetraps/followers","following_url":"https://api.github.com/users/mousetraps/following{/other_user}","gists_url":"https://api.github.com/users/mousetraps/gists{/gist_id}","starred_url":"https://api.github.com/users/mousetraps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mousetraps/subscriptions","organizations_url":"https://api.github.com/users/mousetraps/orgs","repos_url":"https://api.github.com/users/mousetraps/repos","events_url":"https://api.github.com/users/mousetraps/events{/privacy}","received_events_url":"https://api.github.com/users/mousetraps/received_events","type":"User","site_admin":false},"body":"We should abort here if the extension doesn't match a particular file type otherwise we might end up reading enormous binary files or something. We mostly care about .js, .jsx, .tsx, .ts, .d.ts, .html","created_at":"2016-07-05T16:24:38Z","updated_at":"2016-07-05T16:24:38Z","html_url":"https://github.com/Microsoft/nodejstools/pull/1119#discussion_r69594060","pull_request_url":"https://api.github.com/repos/Microsoft/nodejstools/pulls/1119","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/nodejstools/pulls/comments/69594060"},"html":{"href":"https://github.com/Microsoft/nodejstools/pull/1119#discussion_r69594060"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/nodejstools/pulls/1119"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/nodejstools/pulls/1119","id":75898029,"html_url":"https://github.com/Microsoft/nodejstools/pull/1119","diff_url":"https://github.com/Microsoft/nodejstools/pull/1119.diff","patch_url":"https://github.com/Microsoft/nodejstools/pull/1119.patch","issue_url":"https://api.github.com/repos/Microsoft/nodejstools/issues/1119","number":1119,"state":"open","locked":false,"title":"Add Project File Info to Diagnostics Window Output","user":{"login":"mjbvz","id":12821956,"avatar_url":"https://avatars.githubusercontent.com/u/12821956?v=3","gravatar_id":"","url":"https://api.github.com/users/mjbvz","html_url":"https://github.com/mjbvz","followers_url":"https://api.github.com/users/mjbvz/followers","following_url":"https://api.github.com/users/mjbvz/following{/other_user}","gists_url":"https://api.github.com/users/mjbvz/gists{/gist_id}","starred_url":"https://api.github.com/users/mjbvz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjbvz/subscriptions","organizations_url":"https://api.github.com/users/mjbvz/orgs","repos_url":"https://api.github.com/users/mjbvz/repos","events_url":"https://api.github.com/users/mjbvz/events{/privacy}","received_events_url":"https://api.github.com/users/mjbvz/received_events","type":"User","site_admin":false},"body":"This builds on #1118 to add some additional information about what a user's project looks like in the Diagnostics window.\r\n\r\nIssue #1116 \r\n\r\n##### Bug\r\nFor perf investigations, we would like to be able to understand what type of projects users are working with\r\n\r\n##### Fix\r\nAdd first patch of information: information about the number and type of files found in the project to the diagnostics window. Here's some example output:\r\n\r\n```\r\nUse Ctrl-C to copy contents\r\n\r\nProjects:\r\n    Project: ExpressApp11\\ExpressApp11.njsproj\r\n        Kind: Node.js\r\n        StartupFile: C:\\Users\\matb.REDMOND\\documents\\visual studio 2015\\Projects\\ExpressApp11\\ExpressApp11\\bin\\www\r\n        WorkingDirectory: .\r\n        PublishUrl: <undefined>\r\n        SearchPath: <undefined>\r\n        CommandLineArguments: <undefined>\r\n        Analysis Log: \r\n        Analysis loading...\r\n        Files:\r\n            .js:\r\n                Number of Files: 3\r\n                Average Line Count: 26\r\n                Max Line Count: 61\r\n            .json:\r\n                Number of Files: 2\r\n                Average Line Count: 18\r\n                Max Line Count: 22\r\n            .styl:\r\n                Number of Files: 1\r\n                Average Line Count: 5\r\n                Max Line Count: 5\r\n            .md:\r\n                Number of Files: 1\r\n                Average Line Count: 3\r\n                Max Line Count: 3\r\n            .jade:\r\n                Number of Files: 3\r\n                Average Line Count: 6\r\n                Max Line Count: 7\r\n```","created_at":"2016-06-30T22:01:12Z","updated_at":"2016-07-05T16:24:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2416c6bf936e7d35b8bdf8d2598c2fe8280b7f95","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/nodejstools/pulls/1119/commits","review_comments_url":"https://api.github.com/repos/Microsoft/nodejstools/pulls/1119/comments","review_comment_url":"https://api.github.com/repos/Microsoft/nodejstools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/nodejstools/issues/1119/comments","statuses_url":"https://api.github.com/repos/Microsoft/nodejstools/statuses/4ecf6fc168b55cc6d5304c130939a5b0d3f9edc1","head":{"label":"mjbvz:add-file-info-to-diag-window","ref":"add-file-info-to-diag-window","sha":"4ecf6fc168b55cc6d5304c130939a5b0d3f9edc1","user":{"login":"mjbvz","id":12821956,"avatar_url":"https://avatars.githubusercontent.com/u/12821956?v=3","gravatar_id":"","url":"https://api.github.com/users/mjbvz","html_url":"https://github.com/mjbvz","followers_url":"https://api.github.com/users/mjbvz/followers","following_url":"https://api.github.com/users/mjbvz/following{/other_user}","gists_url":"https://api.github.com/users/mjbvz/gists{/gist_id}","starred_url":"https://api.github.com/users/mjbvz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjbvz/subscriptions","organizations_url":"https://api.github.com/users/mjbvz/orgs","repos_url":"https://api.github.com/users/mjbvz/repos","events_url":"https://api.github.com/users/mjbvz/events{/privacy}","received_events_url":"https://api.github.com/users/mjbvz/received_events","type":"User","site_admin":false},"repo":{"id":52391688,"name":"nodejstools","full_name":"mjbvz/nodejstools","owner":{"login":"mjbvz","id":12821956,"avatar_url":"https://avatars.githubusercontent.com/u/12821956?v=3","gravatar_id":"","url":"https://api.github.com/users/mjbvz","html_url":"https://github.com/mjbvz","followers_url":"https://api.github.com/users/mjbvz/followers","following_url":"https://api.github.com/users/mjbvz/following{/other_user}","gists_url":"https://api.github.com/users/mjbvz/gists{/gist_id}","starred_url":"https://api.github.com/users/mjbvz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjbvz/subscriptions","organizations_url":"https://api.github.com/users/mjbvz/orgs","repos_url":"https://api.github.com/users/mjbvz/repos","events_url":"https://api.github.com/users/mjbvz/events{/privacy}","received_events_url":"https://api.github.com/users/mjbvz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mjbvz/nodejstools","description":"Node.js Tools for Visual Studio","fork":true,"url":"https://api.github.com/repos/mjbvz/nodejstools","forks_url":"https://api.github.com/repos/mjbvz/nodejstools/forks","keys_url":"https://api.github.com/repos/mjbvz/nodejstools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mjbvz/nodejstools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mjbvz/nodejstools/teams","hooks_url":"https://api.github.com/repos/mjbvz/nodejstools/hooks","issue_events_url":"https://api.github.com/repos/mjbvz/nodejstools/issues/events{/number}","events_url":"https://api.github.com/repos/mjbvz/nodejstools/events","assignees_url":"https://api.github.com/repos/mjbvz/nodejstools/assignees{/user}","branches_url":"https://api.github.com/repos/mjbvz/nodejstools/branches{/branch}","tags_url":"https://api.github.com/repos/mjbvz/nodejstools/tags","blobs_url":"https://api.github.com/repos/mjbvz/nodejstools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mjbvz/nodejstools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mjbvz/nodejstools/git/refs{/sha}","trees_url":"https://api.github.com/repos/mjbvz/nodejstools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mjbvz/nodejstools/statuses/{sha}","languages_url":"https://api.github.com/repos/mjbvz/nodejstools/languages","stargazers_url":"https://api.github.com/repos/mjbvz/nodejstools/stargazers","contributors_url":"https://api.github.com/repos/mjbvz/nodejstools/contributors","subscribers_url":"https://api.github.com/repos/mjbvz/nodejstools/subscribers","subscription_url":"https://api.github.com/repos/mjbvz/nodejstools/subscription","commits_url":"https://api.github.com/repos/mjbvz/nodejstools/commits{/sha}","git_commits_url":"https://api.github.com/repos/mjbvz/nodejstools/git/commits{/sha}","comments_url":"https://api.github.com/repos/mjbvz/nodejstools/comments{/number}","issue_comment_url":"https://api.github.com/repos/mjbvz/nodejstools/issues/comments{/number}","contents_url":"https://api.github.com/repos/mjbvz/nodejstools/contents/{+path}","compare_url":"https://api.github.com/repos/mjbvz/nodejstools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mjbvz/nodejstools/merges","archive_url":"https://api.github.com/repos/mjbvz/nodejstools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mjbvz/nodejstools/downloads","issues_url":"https://api.github.com/repos/mjbvz/nodejstools/issues{/number}","pulls_url":"https://api.github.com/repos/mjbvz/nodejstools/pulls{/number}","milestones_url":"https://api.github.com/repos/mjbvz/nodejstools/milestones{/number}","notifications_url":"https://api.github.com/repos/mjbvz/nodejstools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mjbvz/nodejstools/labels{/name}","releases_url":"https://api.github.com/repos/mjbvz/nodejstools/releases{/id}","deployments_url":"https://api.github.com/repos/mjbvz/nodejstools/deployments","created_at":"2016-02-23T21:06:55Z","updated_at":"2016-02-23T21:07:01Z","pushed_at":"2016-07-01T01:07:41Z","git_url":"git://github.com/mjbvz/nodejstools.git","ssh_url":"git@github.com:mjbvz/nodejstools.git","clone_url":"https://github.com/mjbvz/nodejstools.git","svn_url":"https://github.com/mjbvz/nodejstools","homepage":"http://aka.ms/explorentvs","size":93424,"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":"1f12aef5dd608a7cbb502a94004a02ea5e6ea678","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":33017149,"name":"nodejstools","full_name":"Microsoft/nodejstools","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/nodejstools","description":"Node.js Tools for Visual Studio","fork":false,"url":"https://api.github.com/repos/Microsoft/nodejstools","forks_url":"https://api.github.com/repos/Microsoft/nodejstools/forks","keys_url":"https://api.github.com/repos/Microsoft/nodejstools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/nodejstools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/nodejstools/teams","hooks_url":"https://api.github.com/repos/Microsoft/nodejstools/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/nodejstools/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/nodejstools/events","assignees_url":"https://api.github.com/repos/Microsoft/nodejstools/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/nodejstools/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/nodejstools/tags","blobs_url":"https://api.github.com/repos/Microsoft/nodejstools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/nodejstools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/nodejstools/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/nodejstools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/nodejstools/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/nodejstools/languages","stargazers_url":"https://api.github.com/repos/Microsoft/nodejstools/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/nodejstools/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/nodejstools/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/nodejstools/subscription","commits_url":"https://api.github.com/repos/Microsoft/nodejstools/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/nodejstools/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/nodejstools/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/nodejstools/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/nodejstools/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/nodejstools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/nodejstools/merges","archive_url":"https://api.github.com/repos/Microsoft/nodejstools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/nodejstools/downloads","issues_url":"https://api.github.com/repos/Microsoft/nodejstools/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/nodejstools/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/nodejstools/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/nodejstools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/nodejstools/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/nodejstools/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/nodejstools/deployments","created_at":"2015-03-28T01:37:20Z","updated_at":"2016-07-05T05:55:06Z","pushed_at":"2016-07-01T01:12:53Z","git_url":"git://github.com/Microsoft/nodejstools.git","ssh_url":"git@github.com:Microsoft/nodejstools.git","clone_url":"https://github.com/Microsoft/nodejstools.git","svn_url":"https://github.com/Microsoft/nodejstools","homepage":"http://aka.ms/explorentvs","size":95086,"stargazers_count":1281,"watchers_count":1281,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":215,"mirror_url":null,"open_issues_count":221,"forks":215,"open_issues":221,"watchers":1281,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/nodejstools/pulls/1119"},"html":{"href":"https://github.com/Microsoft/nodejstools/pull/1119"},"issue":{"href":"https://api.github.com/repos/Microsoft/nodejstools/issues/1119"},"comments":{"href":"https://api.github.com/repos/Microsoft/nodejstools/issues/1119/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/nodejstools/pulls/1119/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/nodejstools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/nodejstools/pulls/1119/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/nodejstools/statuses/4ecf6fc168b55cc6d5304c130939a5b0d3f9edc1"}}}}
{"actor":{"display_login":"mousetraps"}}