Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: pkg/analysis_server/lib/src/domain_diagnostic.dart

Issue 1453433002: Move diagnostics to `diagnostics` domain (#24931). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: master merge Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 src.domain_experimental; 5 library src.domain_diagnostic;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:core' hide Resource; 8 import 'dart:core' hide Resource;
9 9
10 import 'package:analysis_server/plugin/protocol/protocol.dart'; 10 import 'package:analysis_server/plugin/protocol/protocol.dart';
11 import 'package:analysis_server/src/analysis_server.dart'; 11 import 'package:analysis_server/src/analysis_server.dart';
12 import 'package:analyzer/file_system/file_system.dart'; 12 import 'package:analyzer/file_system/file_system.dart';
13 import 'package:analyzer/src/context/cache.dart'; 13 import 'package:analyzer/src/context/cache.dart';
14 import 'package:analyzer/src/context/context.dart'; 14 import 'package:analyzer/src/context/context.dart';
15 import 'package:analyzer/src/generated/engine.dart' 15 import 'package:analyzer/src/generated/engine.dart'
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 exceptions.add(cacheEntry.exception.toString()); 50 exceptions.add(cacheEntry.exception.toString());
51 } 51 }
52 } 52 }
53 } 53 }
54 } 54 }
55 } 55 }
56 return new ContextData(context.name, explicitFiles, implicitFiles, workItems, 56 return new ContextData(context.name, explicitFiles, implicitFiles, workItems,
57 exceptions.toList()); 57 exceptions.toList());
58 } 58 }
59 59
60 /// Instances of the class [ExperimentalDomainHandler] implement a 60 /// Instances of the class [DiagnosticDomainHandler] implement a
61 /// [RequestHandler] that handles requests in the `experimental` domain. 61 /// [RequestHandler] that handles requests in the `diagnostic` domain.
62 class ExperimentalDomainHandler implements RequestHandler { 62 class DiagnosticDomainHandler implements RequestHandler {
63 /// The name of the request used to get diagnostic information. 63 /// The name of the request used to get diagnostic information.
64 static const String EXPERIMENTAL_DIAGNOSTICS = 'experimental.getDiagnostics'; 64 static const String DIAGNOSTICS = 'diagnostic.getDiagnostics';
65 65
66 /// The analysis server that is using this handler to process requests. 66 /// The analysis server that is using this handler to process requests.
67 final AnalysisServer server; 67 final AnalysisServer server;
68 68
69 /// Initialize a newly created handler to handle requests for the given 69 /// Initialize a newly created handler to handle requests for the given
70 /// [server]. 70 /// [server].
71 ExperimentalDomainHandler(this.server); 71 DiagnosticDomainHandler(this.server);
72 72
73 /// Answer the `experimental.diagnostics` request. 73 /// Answer the `diagnostic.diagnostics` request.
74 Response computeDiagnostics(Request request) { 74 Response computeDiagnostics(Request request) {
75 List<ContextData> infos = <ContextData>[]; 75 List<ContextData> infos = <ContextData>[];
76 server.folderMap.forEach((Folder folder, AnalysisContext context) { 76 server.folderMap.forEach((Folder folder, AnalysisContext context) {
77 infos.add(extractData(context)); 77 infos.add(extractData(context));
78 }); 78 });
79 79
80 return new ExperimentalGetDiagnosticsResult(infos).toResponse(request.id); 80 return new DiagnosticGetDiagnosticsResult(infos).toResponse(request.id);
81 } 81 }
82 82
83 @override 83 @override
84 Response handleRequest(Request request) { 84 Response handleRequest(Request request) {
85 try { 85 try {
86 String requestName = request.method; 86 String requestName = request.method;
87 if (requestName == EXPERIMENTAL_DIAGNOSTICS) { 87 if (requestName == DIAGNOSTICS) {
88 return computeDiagnostics(request); 88 return computeDiagnostics(request);
89 } 89 }
90 } on RequestFailure catch (exception) { 90 } on RequestFailure catch (exception) {
91 return exception.response; 91 return exception.response;
92 } 92 }
93 return null; 93 return null;
94 } 94 }
95 } 95 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart ('k') | pkg/analysis_server/lib/src/domain_experimental.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698