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

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

Issue 346963006: Index Dart/HTML units after analysis. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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
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 socket.server; 5 library socket.server;
6 6
7 import 'dart:io' as io;
8
7 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
8 import 'package:analysis_server/src/channel.dart'; 10 import 'package:analysis_server/src/channel.dart';
9 import 'package:analysis_server/src/domain_analysis.dart'; 11 import 'package:analysis_server/src/domain_analysis.dart';
10 import 'package:analysis_server/src/domain_completion.dart'; 12 import 'package:analysis_server/src/domain_completion.dart';
11 import 'package:analysis_server/src/domain_edit.dart'; 13 import 'package:analysis_server/src/domain_edit.dart';
12 import 'package:analysis_server/src/domain_search.dart'; 14 import 'package:analysis_server/src/domain_search.dart';
13 import 'package:analysis_server/src/domain_server.dart'; 15 import 'package:analysis_server/src/domain_server.dart';
16 import 'package:analysis_server/src/index/index.dart';
14 import 'package:analysis_server/src/package_map_provider.dart'; 17 import 'package:analysis_server/src/package_map_provider.dart';
15 import 'package:analysis_server/src/protocol.dart'; 18 import 'package:analysis_server/src/protocol.dart';
16 import 'package:analysis_server/src/resource.dart'; 19 import 'package:analysis_server/src/resource.dart';
20 import 'package:analyzer/src/generated/index.dart';
21 import 'package:path/path.dart' as pathos;
22
23
24 /**
25 * Creates and runs an [Index].
26 */
27 Index _createIndex() {
28 String tempPath = io.Directory.systemTemp.path;
29 String indexPath = pathos.join(tempPath, 'AnalysisServer_index');
30 io.Directory indexDirectory = new io.Directory(indexPath);
31 if (indexDirectory.existsSync()) {
32 indexDirectory.deleteSync(recursive: true);
33 }
34 if (!indexDirectory.existsSync()) {
35 indexDirectory.createSync();
36 }
37 print('indexDirectory: $indexDirectory');
Brian Wilkerson 2014/06/25 20:57:18 Debugging code?
scheglov 2014/06/25 21:13:38 Removed.
38 Index index = createLocalFileSplitIndex(indexDirectory);
39 index.run();
40 return index;
41 }
42
17 43
18 /** 44 /**
19 * Instances of the class [SocketServer] implement the common parts of 45 * Instances of the class [SocketServer] implement the common parts of
20 * http-based and stdio-based analysis servers. The primary responsibility of 46 * http-based and stdio-based analysis servers. The primary responsibility of
21 * the SocketServer is to manage the lifetime of the AnalysisServer and to 47 * the SocketServer is to manage the lifetime of the AnalysisServer and to
22 * encode and decode the JSON messages exchanged with the client. 48 * encode and decode the JSON messages exchanged with the client.
23 */ 49 */
24 class SocketServer { 50 class SocketServer {
25 /** 51 /**
26 * The analysis server that was created when a client established a 52 * The analysis server that was created when a client established a
(...skipping 12 matching lines...) Expand all
39 serverChannel.listen((Request request) { 65 serverChannel.listen((Request request) {
40 serverChannel.sendResponse(new Response(request.id, error)); 66 serverChannel.sendResponse(new Response(request.id, error));
41 }); 67 });
42 return; 68 return;
43 } 69 }
44 PhysicalResourceProvider resourceProvider = PhysicalResourceProvider.INSTANC E; 70 PhysicalResourceProvider resourceProvider = PhysicalResourceProvider.INSTANC E;
45 analysisServer = new AnalysisServer( 71 analysisServer = new AnalysisServer(
46 serverChannel, 72 serverChannel,
47 resourceProvider, 73 resourceProvider,
48 new PubPackageMapProvider(resourceProvider), 74 new PubPackageMapProvider(resourceProvider),
75 _createIndex(),
49 rethrowExceptions: false); 76 rethrowExceptions: false);
50 _initializeHandlers(analysisServer); 77 _initializeHandlers(analysisServer);
51 } 78 }
52 79
53 /** 80 /**
54 * Initialize the handlers to be used by the given [server]. 81 * Initialize the handlers to be used by the given [server].
55 */ 82 */
56 void _initializeHandlers(AnalysisServer server) { 83 void _initializeHandlers(AnalysisServer server) {
57 server.handlers = [ 84 server.handlers = [
58 new ServerDomainHandler(server), 85 new ServerDomainHandler(server),
59 new AnalysisDomainHandler(server), 86 new AnalysisDomainHandler(server),
60 new EditDomainHandler(server), 87 new EditDomainHandler(server),
61 new SearchDomainHandler(server), 88 new SearchDomainHandler(server),
62 new CompletionDomainHandler(server), 89 new CompletionDomainHandler(server),
63 ]; 90 ];
64 } 91 }
65
66 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698