{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/Razor/pulls/comments/122512871","pull_request_review_id":44640817,"id":122512871,"diff_hunk":"@@ -1576,166 +1572,198 @@ private void EnsureDirectiveIsAtStartOfLine()\n \n         private void HandleDirective(DirectiveDescriptor descriptor)\n         {\n-            Context.Builder.CurrentBlock.Type = BlockKindInternal.Directive;\n-            Context.Builder.CurrentBlock.ChunkGenerator = new DirectiveChunkGenerator(descriptor);\n             AssertDirective(descriptor.Directive);\n \n-            AcceptAndMoveNext();\n-            Output(SpanKindInternal.MetaCode, AcceptedCharactersInternal.None);\n+            var directiveErrorSink = new ErrorSink();\n+            var savedErrorSink = Context.ErrorSink;\n+            Context.ErrorSink = directiveErrorSink;","path":"src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs","position":25,"original_position":25,"commit_id":"5fe68d1c6930b4b7107b1ae9d169af7e49375599","original_commit_id":"5fe68d1c6930b4b7107b1ae9d169af7e49375599","user":{"login":"ajaybhargavb","id":1579269,"avatar_url":"https://avatars3.githubusercontent.com/u/1579269?v=3","gravatar_id":"","url":"https://api.github.com/users/ajaybhargavb","html_url":"https://github.com/ajaybhargavb","followers_url":"https://api.github.com/users/ajaybhargavb/followers","following_url":"https://api.github.com/users/ajaybhargavb/following{/other_user}","gists_url":"https://api.github.com/users/ajaybhargavb/gists{/gist_id}","starred_url":"https://api.github.com/users/ajaybhargavb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajaybhargavb/subscriptions","organizations_url":"https://api.github.com/users/ajaybhargavb/orgs","repos_url":"https://api.github.com/users/ajaybhargavb/repos","events_url":"https://api.github.com/users/ajaybhargavb/events{/privacy}","received_events_url":"https://api.github.com/users/ajaybhargavb/received_events","type":"User","site_admin":false},"body":"Is there any significance of switching the error sink here? Looks like we are directly consuming it from `directiveErrorSink` at the end.","created_at":"2017-06-16T19:07:03Z","updated_at":"2017-06-16T19:25:22Z","html_url":"https://github.com/aspnet/Razor/pull/1430#discussion_r122512871","pull_request_url":"https://api.github.com/repos/aspnet/Razor/pulls/1430","_links":{"self":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/comments/122512871"},"html":{"href":"https://github.com/aspnet/Razor/pull/1430#discussion_r122512871"},"pull_request":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/1430"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/Razor/pulls/1430","id":125248458,"html_url":"https://github.com/aspnet/Razor/pull/1430","diff_url":"https://github.com/aspnet/Razor/pull/1430.diff","patch_url":"https://github.com/aspnet/Razor/pull/1430.patch","issue_url":"https://api.github.com/repos/aspnet/Razor/issues/1430","number":1430,"state":"open","locked":false,"title":"Implement consistent error story for directives.","user":{"login":"NTaylorMullen","id":2008729,"avatar_url":"https://avatars0.githubusercontent.com/u/2008729?v=3","gravatar_id":"","url":"https://api.github.com/users/NTaylorMullen","html_url":"https://github.com/NTaylorMullen","followers_url":"https://api.github.com/users/NTaylorMullen/followers","following_url":"https://api.github.com/users/NTaylorMullen/following{/other_user}","gists_url":"https://api.github.com/users/NTaylorMullen/gists{/gist_id}","starred_url":"https://api.github.com/users/NTaylorMullen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NTaylorMullen/subscriptions","organizations_url":"https://api.github.com/users/NTaylorMullen/orgs","repos_url":"https://api.github.com/users/NTaylorMullen/repos","events_url":"https://api.github.com/users/NTaylorMullen/events{/privacy}","received_events_url":"https://api.github.com/users/NTaylorMullen/received_events","type":"User","site_admin":false},"body":"## Basics of what's in this PR\r\n- Enforce whitespace inbetween directive tokens\r\n- Re-write malformed directives into `MalformedDirectiveIRNode`s via a `MalformedDirectiveIRPass`\r\n- Raise directive errors to the IR layer.\r\n\r\n## Goals for extensible directive error handling\r\nTried to encompass 3 primary goals when coming up with a design for our directive error story.\r\n\r\n### Consistency\r\nWhen we  encounter a malformed token when parsing an extensible directive we don't consume the token; instead, we bail out and log an appropriate error that's raised to the `DirectiveIRNode`. Therefore, a user will never have to deal with a malformed directive token state unless they're purposefully consuming `MalformedDirectiveIRNode`s.\r\n\r\n### Default simple approach for malformed directives\r\nIf a user writes a malformed directive an extensible directive author will not see it represented as a `DirectiveIRNode` as long as their pass operates after the `MalformedDirectiveIRPass`. This means for malformed directives Razor will provide IntelliSense until they have fully satisfied all tokens of a directive, at which point the directive will be valid and will make its way over to extensible directive IR pass code. \r\n\r\nSince a user never sees malformed directives, in the case of a block directive we flow the body of the malformed block directive to the execute method so that all contents continue to get IntelliSense/coloring.\r\n\r\nBasically, I made it so extensible directive code is not called until its structure is 100% while maintaining the current editing experience; this should help us avoid VS explosions and make extensible directive IR consumption code simple.\r\n\r\n### Opt-in customizable approach for malformed directive\r\nIf a user does not like how we handle malformed directives they can write an IR pass that consumes `MalformedDirectiveIRNode`s. They can have it log additional errors, modify code gen... basically whatever they want. A great example of when you'd want to do this is if you wish your malformed directive to still impact code gen to provide more verbose/specific errors (think `@model` where TModel was restricted with a `where` clause).\r\n\r\n-----------------------------------------------\r\n\r\n#1173 \r\n\r\n@ajaybhargavb @rynowak ","created_at":"2017-06-12T23:07:55Z","updated_at":"2017-06-16T19:25:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db86d1b1bafe6154807adef3dcb3943a9665ca51","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/Razor/pulls/1430/commits","review_comments_url":"https://api.github.com/repos/aspnet/Razor/pulls/1430/comments","review_comment_url":"https://api.github.com/repos/aspnet/Razor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/Razor/issues/1430/comments","statuses_url":"https://api.github.com/repos/aspnet/Razor/statuses/5fe68d1c6930b4b7107b1ae9d169af7e49375599","head":{"label":"aspnet:nimullen/1173","ref":"nimullen/1173","sha":"5fe68d1c6930b4b7107b1ae9d169af7e49375599","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars0.githubusercontent.com/u/6476660?v=3","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":15835991,"name":"Razor","full_name":"aspnet/Razor","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars0.githubusercontent.com/u/6476660?v=3","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/Razor","description":"Parser and code generator for CSHTML files used in view pages for MVC web apps.","fork":false,"url":"https://api.github.com/repos/aspnet/Razor","forks_url":"https://api.github.com/repos/aspnet/Razor/forks","keys_url":"https://api.github.com/repos/aspnet/Razor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Razor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Razor/teams","hooks_url":"https://api.github.com/repos/aspnet/Razor/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Razor/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Razor/events","assignees_url":"https://api.github.com/repos/aspnet/Razor/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Razor/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Razor/tags","blobs_url":"https://api.github.com/repos/aspnet/Razor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Razor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Razor/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Razor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Razor/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Razor/languages","stargazers_url":"https://api.github.com/repos/aspnet/Razor/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Razor/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Razor/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Razor/subscription","commits_url":"https://api.github.com/repos/aspnet/Razor/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Razor/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Razor/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Razor/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Razor/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Razor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Razor/merges","archive_url":"https://api.github.com/repos/aspnet/Razor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Razor/downloads","issues_url":"https://api.github.com/repos/aspnet/Razor/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Razor/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Razor/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Razor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Razor/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Razor/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/Razor/deployments","created_at":"2014-01-12T03:52:46Z","updated_at":"2017-06-09T05:40:39Z","pushed_at":"2017-06-16T18:16:08Z","git_url":"git://github.com/aspnet/Razor.git","ssh_url":"git@github.com:aspnet/Razor.git","clone_url":"https://github.com/aspnet/Razor.git","svn_url":"https://github.com/aspnet/Razor","homepage":"","size":8787,"stargazers_count":659,"watchers_count":659,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":181,"mirror_url":null,"open_issues_count":85,"forks":181,"open_issues":85,"watchers":659,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"85998706480eb90ae54703a042c70cb153260be4","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars0.githubusercontent.com/u/6476660?v=3","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":15835991,"name":"Razor","full_name":"aspnet/Razor","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars0.githubusercontent.com/u/6476660?v=3","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/Razor","description":"Parser and code generator for CSHTML files used in view pages for MVC web apps.","fork":false,"url":"https://api.github.com/repos/aspnet/Razor","forks_url":"https://api.github.com/repos/aspnet/Razor/forks","keys_url":"https://api.github.com/repos/aspnet/Razor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Razor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Razor/teams","hooks_url":"https://api.github.com/repos/aspnet/Razor/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Razor/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Razor/events","assignees_url":"https://api.github.com/repos/aspnet/Razor/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Razor/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Razor/tags","blobs_url":"https://api.github.com/repos/aspnet/Razor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Razor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Razor/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Razor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Razor/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Razor/languages","stargazers_url":"https://api.github.com/repos/aspnet/Razor/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Razor/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Razor/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Razor/subscription","commits_url":"https://api.github.com/repos/aspnet/Razor/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Razor/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Razor/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Razor/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Razor/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Razor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Razor/merges","archive_url":"https://api.github.com/repos/aspnet/Razor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Razor/downloads","issues_url":"https://api.github.com/repos/aspnet/Razor/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Razor/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Razor/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Razor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Razor/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Razor/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/Razor/deployments","created_at":"2014-01-12T03:52:46Z","updated_at":"2017-06-09T05:40:39Z","pushed_at":"2017-06-16T18:16:08Z","git_url":"git://github.com/aspnet/Razor.git","ssh_url":"git@github.com:aspnet/Razor.git","clone_url":"https://github.com/aspnet/Razor.git","svn_url":"https://github.com/aspnet/Razor","homepage":"","size":8787,"stargazers_count":659,"watchers_count":659,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":181,"mirror_url":null,"open_issues_count":85,"forks":181,"open_issues":85,"watchers":659,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/1430"},"html":{"href":"https://github.com/aspnet/Razor/pull/1430"},"issue":{"href":"https://api.github.com/repos/aspnet/Razor/issues/1430"},"comments":{"href":"https://api.github.com/repos/aspnet/Razor/issues/1430/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/1430/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/1430/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/Razor/statuses/5fe68d1c6930b4b7107b1ae9d169af7e49375599"}}}}
{"actor":{"display_login":"ajaybhargavb"}}