| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 // A thin Dart-API to communicate with an editor service that is running in a | |
| 6 // separate isolate. | |
| 7 #library("editors"); | |
| 8 | |
| 9 /** An editor factory that creates new editor instances. */ | |
| 10 interface EditorFactory { | |
| 11 | |
| 12 /** | |
| 13 * Create an editor of a specific [type] (dart, js, html) and display it under | |
| 14 * a DOM element with the given [id]. | |
| 15 */ | |
| 16 Future<Editor> newEditor(String id, String type, [Function changeListener]); | |
| 17 } | |
| 18 | |
| 19 /** A remote-editor interface. */ | |
| 20 interface Editor { | |
| 21 | |
| 22 /** Asynchronously retrieve the contents of the editor. */ | |
| 23 Future<String> getText(); | |
| 24 | |
| 25 /** | |
| 26 * Asynchronously update the contents of the editor. The returned future will | |
| 27 * be completed when the text has been updated. | |
| 28 */ | |
| 29 Future setText(String value); | |
| 30 | |
| 31 /** Create an error or warning marker between [start] and [end]. */ | |
| 32 Future<Marker> mark(Position start, Position end, int kind); | |
| 33 | |
| 34 /** | |
| 35 * Ensure that an editor is visible and up to date. Sometimes editors are not | |
| 36 * up to date if the UI is hidden when it was rendered. | |
| 37 */ | |
| 38 Future refresh(); | |
| 39 } | |
| 40 | |
| 41 /** Interface for a text-marker in an editor. */ | |
| 42 interface Marker { | |
| 43 Future clear(); | |
| 44 } | |
| 45 | |
| 46 /** Enumeration of kinds of markers. */ | |
| 47 class Marks { | |
| 48 static final NONE = 0; | |
| 49 static final ERROR = 1; | |
| 50 static final WARNING = 2; | |
| 51 static final INFO = 3; | |
| 52 } | |
| 53 | |
| 54 /** Represents a position in the editor. */ | |
| 55 class Position { | |
| 56 int line; | |
| 57 int column; | |
| 58 Position(this.line, this.column); | |
| 59 } | |
| OLD | NEW |