| OLD | NEW |
| 1 # Providing Highlighting Information | 1 # Providing Highlighting Information |
| 2 | 2 |
| 3 Highlighting information is used by clients to help users identify different | 3 Highlighting information is used by clients to help users identify different |
| 4 syntactic and semantic regions of their code. | 4 syntactic and semantic regions of their code. |
| 5 | 5 |
| 6 Syntactic highlighting is highlighting that is based completely on the syntax of | 6 Syntactic highlighting is highlighting that is based completely on the syntax of |
| 7 the code. For example, editors will often provide unique colors for comments, | 7 the code. For example, editors will often provide unique colors for comments, |
| 8 string literals, and numeric literals. | 8 string literals, and numeric literals. |
| 9 | 9 |
| 10 Semantic highlighting is highlighting that is based on semantic information. For | 10 Semantic highlighting is highlighting that is based on semantic information. For |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 class HighlightsVisitor extends RecursiveAstVisitor { | 65 class HighlightsVisitor extends RecursiveAstVisitor { |
| 66 final HighlightsCollector collector; | 66 final HighlightsCollector collector; |
| 67 | 67 |
| 68 HighlightsVisitor(this.collector); | 68 HighlightsVisitor(this.collector); |
| 69 | 69 |
| 70 @override | 70 @override |
| 71 void visitSimpleIdentifier(ClassDeclaration node) { | 71 void visitSimpleIdentifier(SimpleIdentifier node) { |
| 72 // ... | 72 // ... |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 ``` | 75 ``` |
| 76 | 76 |
| 77 Given a contributor like the one above, you can implement your plugin similar to | 77 Given a contributor like the one above, you can implement your plugin similar to |
| 78 the following: | 78 the following: |
| 79 | 79 |
| 80 ```dart | 80 ```dart |
| 81 class MyPlugin extends ServerPlugin with HighlightsMixin, DartHighlightsMixin { | 81 class MyPlugin extends ServerPlugin with HighlightsMixin, DartHighlightsMixin { |
| 82 // ... | 82 // ... |
| 83 | 83 |
| 84 @override | 84 @override |
| 85 List<HighlightsContributor> getHighlightsContributors(String path) { | 85 List<HighlightsContributor> getHighlightsContributors(String path) { |
| 86 return <HighlightsContributor>[new MyHighlightsContributor()]; | 86 return <HighlightsContributor>[new MyHighlightsContributor()]; |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 ``` | 89 ``` |
| OLD | NEW |