OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analysis_server.src.services.correction.fix_internal; | 5 library analysis_server.src.services.correction.fix_internal; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analysis_server/edit/fix/fix_core.dart'; | 9 import 'package:analysis_server/edit/fix/fix_core.dart'; |
10 import 'package:analysis_server/edit/fix/fix_dart.dart'; | 10 import 'package:analysis_server/edit/fix/fix_dart.dart'; |
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 SourceEdit edit = new SourceEdit(offset, 0, text); | 1881 SourceEdit edit = new SourceEdit(offset, 0, text); |
1882 _addEdit(target, edit); | 1882 _addEdit(target, edit); |
1883 } | 1883 } |
1884 | 1884 |
1885 /** | 1885 /** |
1886 * Adds a single linked position to [groupId]. | 1886 * Adds a single linked position to [groupId]. |
1887 */ | 1887 */ |
1888 void _addLinkedPosition(String groupId, SourceBuilder sb, SourceRange range) { | 1888 void _addLinkedPosition(String groupId, SourceBuilder sb, SourceRange range) { |
1889 // prepare offset | 1889 // prepare offset |
1890 int offset = range.offset; | 1890 int offset = range.offset; |
1891 if (sb.offset < offset) { | 1891 if (sb.offset <= offset) { |
1892 int delta = sb.length; | 1892 int delta = sb.length; |
1893 offset += delta; | 1893 offset += delta; |
1894 } | 1894 } |
1895 // prepare group | 1895 // prepare group |
1896 LinkedEditGroup group = _getLinkedPosition(groupId); | 1896 LinkedEditGroup group = _getLinkedPosition(groupId); |
1897 // add position | 1897 // add position |
1898 Position position = new Position(file, offset); | 1898 Position position = new Position(file, offset); |
1899 group.addPosition(position, range.length); | 1899 group.addPosition(position, range.length); |
1900 } | 1900 } |
1901 | 1901 |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2502 /** | 2502 /** |
2503 * Describes the location for a newly created [FieldDeclaration]. | 2503 * Describes the location for a newly created [FieldDeclaration]. |
2504 */ | 2504 */ |
2505 class _FieldLocation { | 2505 class _FieldLocation { |
2506 final String prefix; | 2506 final String prefix; |
2507 final int offset; | 2507 final int offset; |
2508 final String suffix; | 2508 final String suffix; |
2509 | 2509 |
2510 _FieldLocation(this.prefix, this.offset, this.suffix); | 2510 _FieldLocation(this.prefix, this.offset, this.suffix); |
2511 } | 2511 } |
OLD | NEW |