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

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

Issue 492243002: Introduce convenience methods into generated analysis server classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/computer/element.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
11 import 'package:analysis_server/src/analysis_logger.dart'; 11 import 'package:analysis_server/src/analysis_logger.dart';
12 import 'package:analysis_server/src/channel.dart'; 12 import 'package:analysis_server/src/channel.dart';
13 import 'package:analysis_server/src/constants.dart'; 13 import 'package:analysis_server/src/constants.dart';
14 import 'package:analysis_server/src/context_manager.dart'; 14 import 'package:analysis_server/src/context_manager.dart';
15 import 'package:analysis_server/src/operation/operation_analysis.dart'; 15 import 'package:analysis_server/src/operation/operation_analysis.dart';
16 import 'package:analysis_server/src/operation/operation.dart'; 16 import 'package:analysis_server/src/operation/operation.dart';
17 import 'package:analysis_server/src/operation/operation_queue.dart'; 17 import 'package:analysis_server/src/operation/operation_queue.dart';
18 import 'package:analysis_server/src/package_map_provider.dart'; 18 import 'package:analysis_server/src/package_map_provider.dart';
19 import 'package:analysis_server/src/protocol.dart'; 19 import 'package:analysis_server/src/protocol.dart';
20 import 'package:analysis_server/src/protocol2.dart' show AnalysisService, 20 import 'package:analysis_server/src/protocol2.dart' show AnalysisService,
21 ServerService, AddContentOverlay, ChangeContentOverlay, 21 ServerService, AddContentOverlay, ChangeContentOverlay,
22 RemoveContentOverlay; 22 RemoveContentOverlay, SourceEdit;
23 import 'package:analyzer/source/package_map_resolver.dart'; 23 import 'package:analyzer/source/package_map_resolver.dart';
24 import 'package:analyzer/src/generated/ast.dart'; 24 import 'package:analyzer/src/generated/ast.dart';
25 import 'package:analyzer/src/generated/engine.dart'; 25 import 'package:analyzer/src/generated/engine.dart';
26 import 'package:analyzer/src/generated/source.dart'; 26 import 'package:analyzer/src/generated/source.dart';
27 import 'package:analyzer/src/generated/sdk.dart'; 27 import 'package:analyzer/src/generated/sdk.dart';
28 import 'package:analyzer/src/generated/source_io.dart'; 28 import 'package:analyzer/src/generated/source_io.dart';
29 import 'package:analyzer/src/generated/java_engine.dart'; 29 import 'package:analyzer/src/generated/java_engine.dart';
30 import 'package:analysis_server/src/services/correction/change.dart';
31 import 'package:analysis_server/src/services/index/index.dart'; 30 import 'package:analysis_server/src/services/index/index.dart';
32 import 'package:analysis_server/src/services/search/search_engine.dart'; 31 import 'package:analysis_server/src/services/search/search_engine.dart';
33 import 'package:analyzer/src/generated/element.dart'; 32 import 'package:analyzer/src/generated/element.dart';
34 import 'package:analysis_server/src/services/correction/namespace.dart'; 33 import 'package:analysis_server/src/services/correction/namespace.dart';
35 34
36 35
37 class ServerContextManager extends ContextManager { 36 class ServerContextManager extends ContextManager {
38 final AnalysisServer analysisServer; 37 final AnalysisServer analysisServer;
39 38
40 /** 39 /**
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 // and user modifies a file in package B). 486 // and user modifies a file in package B).
488 if (analysisContext != null) { 487 if (analysisContext != null) {
489 Source source = getSource(file); 488 Source source = getSource(file);
490 if (change is AddContentOverlay) { 489 if (change is AddContentOverlay) {
491 analysisContext.setContents(source, change.content); 490 analysisContext.setContents(source, change.content);
492 } else if (change is ChangeContentOverlay) { 491 } else if (change is ChangeContentOverlay) {
493 // TODO(paulberry): an error should be generated if source is not 492 // TODO(paulberry): an error should be generated if source is not
494 // currently in the content cache. 493 // currently in the content cache.
495 TimestampedData<String> oldContents = analysisContext.getContents( 494 TimestampedData<String> oldContents = analysisContext.getContents(
496 source); 495 source);
497 String newContents = applySequence(oldContents.data, change.edits); 496 String newContents = SourceEdit.applySequence(oldContents.data, change .edits);
498 // TODO(paulberry): to aid in incremental processing it would be 497 // TODO(paulberry): to aid in incremental processing it would be
499 // better to use setChangedContents. 498 // better to use setChangedContents.
500 analysisContext.setContents(source, newContents); 499 analysisContext.setContents(source, newContents);
501 } else if (change is RemoveContentOverlay) { 500 } else if (change is RemoveContentOverlay) {
502 analysisContext.setContents(source, null); 501 analysisContext.setContents(source, null);
503 } else { 502 } else {
504 // Protocol parsing should have ensured that we never get here. 503 // Protocol parsing should have ensured that we never get here.
505 throw new AnalysisException('Illegal change type'); 504 throw new AnalysisException('Illegal change type');
506 } 505 }
507 schedulePerformAnalysisOperation(analysisContext); 506 schedulePerformAnalysisOperation(analysisContext);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 Notification notification = new Notification(SERVER_ERROR); 807 Notification notification = new Notification(SERVER_ERROR);
809 notification.setParameter(FATAL, true); 808 notification.setParameter(FATAL, true);
810 notification.setParameter(MESSAGE, exceptionString); 809 notification.setParameter(MESSAGE, exceptionString);
811 notification.setParameter(STACK_TRACE, stackTraceString); 810 notification.setParameter(STACK_TRACE, stackTraceString);
812 channel.sendNotification(notification); 811 channel.sendNotification(notification);
813 } 812 }
814 } 813 }
815 814
816 815
817 typedef void OptionUpdater(AnalysisOptionsImpl options); 816 typedef void OptionUpdater(AnalysisOptionsImpl options);
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/computer/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698