| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library trydart.editor; | 5 library trydart.editor; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 | 8 |
| 9 import 'package:compiler/implementation/scanner/scannerlib.dart' show | 9 import 'package:compiler/implementation/scanner/scannerlib.dart' show |
| 10 EOF_TOKEN, | 10 EOF_TOKEN, |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 } | 250 } |
| 251 if (tokenInfo == 'keyword') return currentTheme.keyword; | 251 if (tokenInfo == 'keyword') return currentTheme.keyword; |
| 252 if (tokenInfo == 'comment') return currentTheme.singleLineComment; | 252 if (tokenInfo == 'comment') return currentTheme.singleLineComment; |
| 253 if (tokenInfo == 'malformed input') { | 253 if (tokenInfo == 'malformed input') { |
| 254 isMalformedInput = true; | 254 isMalformedInput = true; |
| 255 return new DiagnosticDecoration('error', tokenValue); | 255 return new DiagnosticDecoration('error', tokenValue); |
| 256 } | 256 } |
| 257 return currentTheme.foreground; | 257 return currentTheme.foreground; |
| 258 } | 258 } |
| 259 | 259 |
| 260 diagnostic(text, tip) { | 260 diagnostic(content, tip) { |
| 261 if (text is String) { | 261 if (content is String) { |
| 262 text = new Text(text); | 262 content = new Text(content); |
| 263 } |
| 264 if (content is! List) { |
| 265 content = [content]; |
| 263 } | 266 } |
| 264 return new AnchorElement() | 267 return new AnchorElement() |
| 265 ..classes.add('diagnostic') | 268 ..classes.add('diagnostic') |
| 266 ..append(text) | 269 ..append(tip) // Should be first for better Firefox editing. |
| 267 ..append(tip); | 270 ..nodes.addAll(content); |
| 268 } | 271 } |
| OLD | NEW |