{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/Blazor/pulls/comments/170070661","pull_request_review_id":98700900,"id":170070661,"diff_hunk":"@@ -0,0 +1,99 @@\n+﻿// Copyright (c) .NET Foundation. All rights reserved.\n+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\n+\n+using Microsoft.AspNetCore.Razor.Language;\n+using Microsoft.AspNetCore.Razor.Language.CodeGeneration;\n+using Microsoft.AspNetCore.Razor.Language.Intermediate;\n+using System;\n+using System.IO;\n+using System.Linq;\n+\n+namespace Microsoft.AspNetCore.Blazor.Razor\n+{\n+    internal class ComponentDocumentClassifierPass : DocumentClassifierPassBase, IRazorDocumentClassifierPass\n+    {\n+        protected override string DocumentKind => \"Blazor.Component-0.1\";\n+\n+        protected override bool IsMatch(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode)\n+        {\n+            // Treat everything as a component by default if Blazor is part of the configuration.\n+            return true;\n+        }\n+\n+        protected override void OnDocumentStructureCreated(\n+            RazorCodeDocument codeDocument, \n+            NamespaceDeclarationIntermediateNode @namespace, \n+            ClassDeclarationIntermediateNode @class, \n+            MethodDeclarationIntermediateNode method)\n+        {\n+            @namespace.Content = (string)codeDocument.Items[BlazorCodeDocItems.Namespace];\n+            if (@namespace.Content == null)\n+            {\n+                @namespace.Content = \"Blazor\";\n+            }\n+\n+            @class.BaseType = BlazorApi.BlazorComponent.FullTypeName;\n+            @class.ClassName = (string)codeDocument.Items[BlazorCodeDocItems.ClassName];\n+            if (@class.ClassName == null)\n+            {\n+                @class.ClassName = codeDocument.Source.FilePath == null ? null : Path.GetFileNameWithoutExtension(codeDocument.Source.FilePath);\n+            }\n+\n+            if (@class.ClassName == null)\n+            {\n+                @class.ClassName = \"__BlazorComponent\";\n+            }\n+\n+            @class.Modifiers.Clear();\n+            @class.Modifiers.Add(\"public\");\n+\n+            // Note that DefaultDocumentWriter's VisitMethodDeclaration in 2.0 is hardcoded to\n+            // emit methods with no parameters.\n+            //\n+            // This was added in 2.1, but we still need a workaround to support 2.0. In that case we\n+            // inject the parameter later in RazorCompiler.\n+            method.ReturnType = \"void\";\n+            method.MethodName = BlazorApi.BlazorComponent.BuildRenderTree;\n+            method.Modifiers.Clear();\n+            method.Modifiers.Add(\"protected\");\n+            method.Modifiers.Add(\"override\");\n+\n+            method.Parameters.Clear();\n+            method.Parameters.Add(new MethodParameter()\n+            {\n+                ParameterName = \"builder\",\n+                TypeName = BlazorApi.RenderTreeBuilder.FullTypeName,\n+            });\n+\n+            // We need to call the 'base' method as the first statement.\n+            var callBase = new CSharpCodeIntermediateNode();\n+            callBase.Children.Add(new IntermediateToken\n+            {\n+                Kind = TokenKind.CSharp,\n+                Content = $\"base.{BlazorApi.BlazorComponent.BuildRenderTree}(builder);\" + Environment.NewLine\n+            });\n+            method.Children.Insert(0, callBase);\n+        }\n+\n+        #region Workaround","path":"src/Microsoft.AspNetCore.Blazor.Razor.Extensions/ComponentDocumentClassifierPass.cs","position":73,"original_position":78,"commit_id":"08eadd04588ef8080239ae156ee14afce4e219eb","original_commit_id":"ec51cf31b560042889780b7c094293488aeb8383","user":{"login":"rynowak","id":1430011,"avatar_url":"https://avatars1.githubusercontent.com/u/1430011?v=4","gravatar_id":"","url":"https://api.github.com/users/rynowak","html_url":"https://github.com/rynowak","followers_url":"https://api.github.com/users/rynowak/followers","following_url":"https://api.github.com/users/rynowak/following{/other_user}","gists_url":"https://api.github.com/users/rynowak/gists{/gist_id}","starred_url":"https://api.github.com/users/rynowak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rynowak/subscriptions","organizations_url":"https://api.github.com/users/rynowak/orgs","repos_url":"https://api.github.com/users/rynowak/repos","events_url":"https://api.github.com/users/rynowak/events{/privacy}","received_events_url":"https://api.github.com/users/rynowak/received_events","type":"User","site_admin":false},"body":"This is simplest, most isolated workaround I could find for not being able to replace the intermediate node writer.","created_at":"2018-02-22T19:39:57Z","updated_at":"2018-02-22T19:39:57Z","html_url":"https://github.com/aspnet/Blazor/pull/152#discussion_r170070661","pull_request_url":"https://api.github.com/repos/aspnet/Blazor/pulls/152","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/aspnet/Blazor/pulls/comments/170070661"},"html":{"href":"https://github.com/aspnet/Blazor/pull/152#discussion_r170070661"},"pull_request":{"href":"https://api.github.com/repos/aspnet/Blazor/pulls/152"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/Blazor/pulls/152","id":170839384,"html_url":"https://github.com/aspnet/Blazor/pull/152","diff_url":"https://github.com/aspnet/Blazor/pull/152.diff","patch_url":"https://github.com/aspnet/Blazor/pull/152.patch","issue_url":"https://api.github.com/repos/aspnet/Blazor/issues/152","number":152,"state":"open","locked":false,"title":"Adopt more of Razor Exensibility","user":{"login":"rynowak","id":1430011,"avatar_url":"https://avatars1.githubusercontent.com/u/1430011?v=4","gravatar_id":"","url":"https://api.github.com/users/rynowak","html_url":"https://github.com/rynowak","followers_url":"https://api.github.com/users/rynowak/followers","following_url":"https://api.github.com/users/rynowak/following{/other_user}","gists_url":"https://api.github.com/users/rynowak/gists{/gist_id}","starred_url":"https://api.github.com/users/rynowak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rynowak/subscriptions","organizations_url":"https://api.github.com/users/rynowak/orgs","repos_url":"https://api.github.com/users/rynowak/repos","events_url":"https://api.github.com/users/rynowak/events{/privacy}","received_events_url":"https://api.github.com/users/rynowak/received_events","type":"User","site_admin":false},"body":"Removes some workarounds and uses Razor extensibility in a few more\r\nplaces.\r\n\r\n_ViewImports now works in VS","created_at":"2018-02-22T19:10:02Z","updated_at":"2018-02-22T19:39:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"543b54c1048351d5cc654f4b8e6973dbcc278c22","assignee":null,"assignees":[],"requested_reviewers":[{"login":"SteveSandersonMS","id":1101362,"avatar_url":"https://avatars3.githubusercontent.com/u/1101362?v=4","gravatar_id":"","url":"https://api.github.com/users/SteveSandersonMS","html_url":"https://github.com/SteveSandersonMS","followers_url":"https://api.github.com/users/SteveSandersonMS/followers","following_url":"https://api.github.com/users/SteveSandersonMS/following{/other_user}","gists_url":"https://api.github.com/users/SteveSandersonMS/gists{/gist_id}","starred_url":"https://api.github.com/users/SteveSandersonMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SteveSandersonMS/subscriptions","organizations_url":"https://api.github.com/users/SteveSandersonMS/orgs","repos_url":"https://api.github.com/users/SteveSandersonMS/repos","events_url":"https://api.github.com/users/SteveSandersonMS/events{/privacy}","received_events_url":"https://api.github.com/users/SteveSandersonMS/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/Blazor/pulls/152/commits","review_comments_url":"https://api.github.com/repos/aspnet/Blazor/pulls/152/comments","review_comment_url":"https://api.github.com/repos/aspnet/Blazor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/Blazor/issues/152/comments","statuses_url":"https://api.github.com/repos/aspnet/Blazor/statuses/08eadd04588ef8080239ae156ee14afce4e219eb","head":{"label":"aspnet:rynowak/blazor-tooling","ref":"rynowak/blazor-tooling","sha":"08eadd04588ef8080239ae156ee14afce4e219eb","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":116160755,"name":"Blazor","full_name":"aspnet/Blazor","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Blazor","description":"An experimental web UI framework using C#/Razor and HTML, running in the browser via WebAssembly","fork":false,"url":"https://api.github.com/repos/aspnet/Blazor","forks_url":"https://api.github.com/repos/aspnet/Blazor/forks","keys_url":"https://api.github.com/repos/aspnet/Blazor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Blazor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Blazor/teams","hooks_url":"https://api.github.com/repos/aspnet/Blazor/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Blazor/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Blazor/events","assignees_url":"https://api.github.com/repos/aspnet/Blazor/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Blazor/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Blazor/tags","blobs_url":"https://api.github.com/repos/aspnet/Blazor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Blazor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Blazor/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Blazor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Blazor/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Blazor/languages","stargazers_url":"https://api.github.com/repos/aspnet/Blazor/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Blazor/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Blazor/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Blazor/subscription","commits_url":"https://api.github.com/repos/aspnet/Blazor/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Blazor/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Blazor/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Blazor/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Blazor/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Blazor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Blazor/merges","archive_url":"https://api.github.com/repos/aspnet/Blazor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Blazor/downloads","issues_url":"https://api.github.com/repos/aspnet/Blazor/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Blazor/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Blazor/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Blazor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Blazor/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Blazor/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/Blazor/deployments","created_at":"2018-01-03T16:53:27Z","updated_at":"2018-02-22T19:37:02Z","pushed_at":"2018-02-22T19:38:21Z","git_url":"git://github.com/aspnet/Blazor.git","ssh_url":"git@github.com:aspnet/Blazor.git","clone_url":"https://github.com/aspnet/Blazor.git","svn_url":"https://github.com/aspnet/Blazor","homepage":"","size":54585,"stargazers_count":2227,"watchers_count":2227,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":163,"mirror_url":null,"archived":false,"open_issues_count":47,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":163,"open_issues":47,"watchers":2227,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"a32028e5ebc92d7e8a276060f3845b381c0bbe4a","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":116160755,"name":"Blazor","full_name":"aspnet/Blazor","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Blazor","description":"An experimental web UI framework using C#/Razor and HTML, running in the browser via WebAssembly","fork":false,"url":"https://api.github.com/repos/aspnet/Blazor","forks_url":"https://api.github.com/repos/aspnet/Blazor/forks","keys_url":"https://api.github.com/repos/aspnet/Blazor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Blazor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Blazor/teams","hooks_url":"https://api.github.com/repos/aspnet/Blazor/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Blazor/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Blazor/events","assignees_url":"https://api.github.com/repos/aspnet/Blazor/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Blazor/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Blazor/tags","blobs_url":"https://api.github.com/repos/aspnet/Blazor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Blazor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Blazor/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Blazor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Blazor/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Blazor/languages","stargazers_url":"https://api.github.com/repos/aspnet/Blazor/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Blazor/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Blazor/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Blazor/subscription","commits_url":"https://api.github.com/repos/aspnet/Blazor/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Blazor/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Blazor/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Blazor/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Blazor/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Blazor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Blazor/merges","archive_url":"https://api.github.com/repos/aspnet/Blazor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Blazor/downloads","issues_url":"https://api.github.com/repos/aspnet/Blazor/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Blazor/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Blazor/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Blazor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Blazor/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Blazor/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/Blazor/deployments","created_at":"2018-01-03T16:53:27Z","updated_at":"2018-02-22T19:37:02Z","pushed_at":"2018-02-22T19:38:21Z","git_url":"git://github.com/aspnet/Blazor.git","ssh_url":"git@github.com:aspnet/Blazor.git","clone_url":"https://github.com/aspnet/Blazor.git","svn_url":"https://github.com/aspnet/Blazor","homepage":"","size":54585,"stargazers_count":2227,"watchers_count":2227,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":163,"mirror_url":null,"archived":false,"open_issues_count":47,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":163,"open_issues":47,"watchers":2227,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/Blazor/pulls/152"},"html":{"href":"https://github.com/aspnet/Blazor/pull/152"},"issue":{"href":"https://api.github.com/repos/aspnet/Blazor/issues/152"},"comments":{"href":"https://api.github.com/repos/aspnet/Blazor/issues/152/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/Blazor/pulls/152/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/Blazor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/Blazor/pulls/152/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/Blazor/statuses/08eadd04588ef8080239ae156ee14afce4e219eb"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"rynowak"}}