{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/3572","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/3572/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/3572/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/3572/events","html_url":"https://github.com/dart-lang/sdk/issues/3572","id":84510490,"number":3572,"title":"Highlighting and error checking in Dartdoc code","user":{"login":"alan-knight","id":3476088,"avatar_url":"https://avatars.githubusercontent.com/u/3476088?v=3","gravatar_id":"","url":"https://api.github.com/users/alan-knight","html_url":"https://github.com/alan-knight","followers_url":"https://api.github.com/users/alan-knight/followers","following_url":"https://api.github.com/users/alan-knight/following{/other_user}","gists_url":"https://api.github.com/users/alan-knight/gists{/gist_id}","starred_url":"https://api.github.com/users/alan-knight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alan-knight/subscriptions","organizations_url":"https://api.github.com/users/alan-knight/orgs","repos_url":"https://api.github.com/users/alan-knight/repos","events_url":"https://api.github.com/users/alan-knight/events{/privacy}","received_events_url":"https://api.github.com/users/alan-knight/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dart-lang/sdk/labels/Analyzer-Hint","name":"Analyzer-Hint","color":"ededed"},{"url":"https://api.github.com/repos/dart-lang/sdk/labels/Area-Analyzer","name":"Area-Analyzer","color":"ededed"},{"url":"https://api.github.com/repos/dart-lang/sdk/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/dart-lang/sdk/labels/Triaged","name":"Triaged","color":"ededed"},{"url":"https://api.github.com/repos/dart-lang/sdk/labels/Type-Enhancement","name":"Type-Enhancement","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2012-06-12T17:29:45Z","updated_at":"2015-10-09T17:02:19Z","closed_at":null,"body":"We often have code examples in DartDoc. They get out of sync with the actual code very easily, and are harder to read because they aren't syntax highlighted. It would be really nice if the editor could recognize code fragments in DartDoc comments and do syntax highlighting and error checking on them. There are already mechanisms that DartDoc uses to indicate code fragments, so this ought to be recognizable. There might be an issue with needing to recognize that this code isn't actually part of the file, as it might break, or two different code fragments might define a function with the same name, so each needs to be treated somewhat separately, and not compiled as part of the file. But it would be really really nice.\n"},"comment":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/comments/146932531","html_url":"https://github.com/dart-lang/sdk/issues/3572#issuecomment-146932531","issue_url":"https://api.github.com/repos/dart-lang/sdk/issues/3572","id":146932531,"user":{"login":"srawlins","id":103167,"avatar_url":"https://avatars.githubusercontent.com/u/103167?v=3","gravatar_id":"","url":"https://api.github.com/users/srawlins","html_url":"https://github.com/srawlins","followers_url":"https://api.github.com/users/srawlins/followers","following_url":"https://api.github.com/users/srawlins/following{/other_user}","gists_url":"https://api.github.com/users/srawlins/gists{/gist_id}","starred_url":"https://api.github.com/users/srawlins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srawlins/subscriptions","organizations_url":"https://api.github.com/users/srawlins/orgs","repos_url":"https://api.github.com/users/srawlins/repos","events_url":"https://api.github.com/users/srawlins/events{/privacy}","received_events_url":"https://api.github.com/users/srawlins/received_events","type":"User","site_admin":false},"created_at":"2015-10-09T17:02:19Z","updated_at":"2015-10-09T17:02:19Z","body":"This seems like it would be impossible to do without false positive warnings. The following code blocks, that might be found in Dartdoc comments, would produce false analyzer warnings:\r\n\r\n1. Dart code with pseudocode:\r\n    ```\r\n    callAFunction();\r\n    callSomethingElse();\r\n    ...\r\n    var a = foo();\r\n    ```\r\n\r\n2. Code blocks that don't contain Dart:\r\n    ```\r\n    <p>This is html. Not dart. The analyzer probably wouldn't take kindly to that.</p>\r\n    ```\r\n\r\n3. Code with undeclared identifiers. Would the analyzer know that only a subset of warnings are valid in example code?\r\n    ```\r\n    someFunction(myVariable);\r\n    ```\r\n\r\nThis would also pull in package:markdown as a dependency to the analyzer."}}