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 protocol.server; | 5 library protocol.server; |
6 | 6 |
7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:analysis_server/src/services/correction/fix.dart'; |
8 import 'package:analysis_server/src/services/search/search_engine.dart' | 9 import 'package:analysis_server/src/services/search/search_engine.dart' |
9 as engine; | 10 as engine; |
10 import 'package:analyzer/src/generated/ast.dart' as engine; | 11 import 'package:analyzer/src/generated/ast.dart' as engine; |
11 import 'package:analyzer/src/generated/element.dart' as engine; | 12 import 'package:analyzer/src/generated/element.dart' as engine; |
12 import 'package:analyzer/src/generated/engine.dart' as engine; | 13 import 'package:analyzer/src/generated/engine.dart' as engine; |
13 import 'package:analyzer/src/generated/error.dart' as engine; | 14 import 'package:analyzer/src/generated/error.dart' as engine; |
14 import 'package:analyzer/src/generated/source.dart' as engine; | 15 import 'package:analyzer/src/generated/source.dart' as engine; |
15 import 'package:analyzer/src/generated/utilities_dart.dart' as engine; | 16 import 'package:analyzer/src/generated/utilities_dart.dart' as engine; |
16 | 17 |
17 export 'package:analysis_server/src/protocol.dart'; | 18 export 'package:analysis_server/src/protocol.dart'; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 startColumn = lineLocation.columnNumber; | 86 startColumn = lineLocation.columnNumber; |
86 } | 87 } |
87 } | 88 } |
88 location = new Location(file, offset, length, startLine, startColumn); | 89 location = new Location(file, offset, length, startLine, startColumn); |
89 } | 90 } |
90 // done | 91 // done |
91 var severity = new AnalysisErrorSeverity(errorCode.errorSeverity.name); | 92 var severity = new AnalysisErrorSeverity(errorCode.errorSeverity.name); |
92 var type = new AnalysisErrorType(errorCode.type.name); | 93 var type = new AnalysisErrorType(errorCode.type.name); |
93 String message = error.message; | 94 String message = error.message; |
94 String correction = error.correction; | 95 String correction = error.correction; |
| 96 bool fix = hasFix(error.errorCode); |
95 return new AnalysisError(severity, type, location, message, | 97 return new AnalysisError(severity, type, location, message, |
96 correction: correction); | 98 correction: correction, hasFix: fix); |
97 } | 99 } |
98 | 100 |
99 /** | 101 /** |
100 * Construct based on a value from the analyzer engine. | 102 * Construct based on a value from the analyzer engine. |
101 */ | 103 */ |
102 Element newElement_fromEngine(engine.Element element) { | 104 Element newElement_fromEngine(engine.Element element) { |
103 String name = element.displayName; | 105 String name = element.displayName; |
104 String elementTypeParameters = _getTypeParametersString(element); | 106 String elementTypeParameters = _getTypeParametersString(element); |
105 String elementParameters = _getParametersString(element); | 107 String elementParameters = _getParametersString(element); |
106 String elementReturnType = getReturnTypeString(element); | 108 String elementReturnType = getReturnTypeString(element); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 if (lineInfo != null) { | 433 if (lineInfo != null) { |
432 engine.LineInfo_Location offsetLocation = | 434 engine.LineInfo_Location offsetLocation = |
433 lineInfo.getLocation(range.offset); | 435 lineInfo.getLocation(range.offset); |
434 startLine = offsetLocation.lineNumber; | 436 startLine = offsetLocation.lineNumber; |
435 startColumn = offsetLocation.columnNumber; | 437 startColumn = offsetLocation.columnNumber; |
436 } | 438 } |
437 } | 439 } |
438 return new Location( | 440 return new Location( |
439 source.fullName, range.offset, range.length, startLine, startColumn); | 441 source.fullName, range.offset, range.length, startLine, startColumn); |
440 } | 442 } |
OLD | NEW |