mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:27:39 +00:00
Remove domain 'kythe' from DAS.
Change-Id: I66f0e538dce6eead6ba1c98b9cf0e3d747450130 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264895 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
3e587da7f0
commit
671bb192ab
File diff suppressed because one or more lines are too long
|
@ -375,13 +375,6 @@ class Response {
|
||||||
RequestErrorCode.GET_IMPORTED_ELEMENTS_INVALID_FILE,
|
RequestErrorCode.GET_IMPORTED_ELEMENTS_INVALID_FILE,
|
||||||
'Error during `analysis.getImportedElements`: invalid file.'));
|
'Error during `analysis.getImportedElements`: invalid file.'));
|
||||||
|
|
||||||
/// Initialize a newly created instance to represent the
|
|
||||||
/// GET_KYTHE_ENTRIES_INVALID_FILE error condition.
|
|
||||||
Response.getKytheEntriesInvalidFile(Request request)
|
|
||||||
: this(request.id,
|
|
||||||
error: RequestError(RequestErrorCode.GET_KYTHE_ENTRIES_INVALID_FILE,
|
|
||||||
'Error during `analysis.getKytheEntries`: invalid file.'));
|
|
||||||
|
|
||||||
/// Initialize a newly created instance to represent the
|
/// Initialize a newly created instance to represent the
|
||||||
/// GET_NAVIGATION_INVALID_FILE error condition.
|
/// GET_NAVIGATION_INVALID_FILE error condition.
|
||||||
Response.getNavigationInvalidFile(Request request)
|
Response.getNavigationInvalidFile(Request request)
|
||||||
|
|
|
@ -313,10 +313,6 @@ const String FLUTTER_REQUEST_SET_WIDGET_PROPERTY_VALUE_ID = 'id';
|
||||||
const String FLUTTER_REQUEST_SET_WIDGET_PROPERTY_VALUE_VALUE = 'value';
|
const String FLUTTER_REQUEST_SET_WIDGET_PROPERTY_VALUE_VALUE = 'value';
|
||||||
const String FLUTTER_RESPONSE_GET_WIDGET_DESCRIPTION_PROPERTIES = 'properties';
|
const String FLUTTER_RESPONSE_GET_WIDGET_DESCRIPTION_PROPERTIES = 'properties';
|
||||||
const String FLUTTER_RESPONSE_SET_WIDGET_PROPERTY_VALUE_CHANGE = 'change';
|
const String FLUTTER_RESPONSE_SET_WIDGET_PROPERTY_VALUE_CHANGE = 'change';
|
||||||
const String KYTHE_REQUEST_GET_KYTHE_ENTRIES = 'kythe.getKytheEntries';
|
|
||||||
const String KYTHE_REQUEST_GET_KYTHE_ENTRIES_FILE = 'file';
|
|
||||||
const String KYTHE_RESPONSE_GET_KYTHE_ENTRIES_ENTRIES = 'entries';
|
|
||||||
const String KYTHE_RESPONSE_GET_KYTHE_ENTRIES_FILES = 'files';
|
|
||||||
const String SEARCH_NOTIFICATION_RESULTS = 'search.results';
|
const String SEARCH_NOTIFICATION_RESULTS = 'search.results';
|
||||||
const String SEARCH_NOTIFICATION_RESULTS_ID = 'id';
|
const String SEARCH_NOTIFICATION_RESULTS_ID = 'id';
|
||||||
const String SEARCH_NOTIFICATION_RESULTS_IS_LAST = 'isLast';
|
const String SEARCH_NOTIFICATION_RESULTS_IS_LAST = 'isLast';
|
||||||
|
|
|
@ -12941,158 +12941,6 @@ class InlineMethodOptions extends RefactoringOptions {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// kythe.getKytheEntries params
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "file": FilePath
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
class KytheGetKytheEntriesParams implements RequestParams {
|
|
||||||
/// The file containing the code for which the Kythe Entry objects are being
|
|
||||||
/// requested.
|
|
||||||
String file;
|
|
||||||
|
|
||||||
KytheGetKytheEntriesParams(this.file);
|
|
||||||
|
|
||||||
factory KytheGetKytheEntriesParams.fromJson(
|
|
||||||
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
|
|
||||||
json ??= {};
|
|
||||||
if (json is Map) {
|
|
||||||
String file;
|
|
||||||
if (json.containsKey('file')) {
|
|
||||||
file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'file');
|
|
||||||
}
|
|
||||||
return KytheGetKytheEntriesParams(file);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(
|
|
||||||
jsonPath, 'kythe.getKytheEntries params', json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
factory KytheGetKytheEntriesParams.fromRequest(Request request) {
|
|
||||||
return KytheGetKytheEntriesParams.fromJson(
|
|
||||||
RequestDecoder(request), 'params', request.params);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Object> toJson() {
|
|
||||||
var result = <String, Object>{};
|
|
||||||
result['file'] = file;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Request toRequest(String id) {
|
|
||||||
return Request(id, 'kythe.getKytheEntries', toJson());
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(toJson());
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(other) {
|
|
||||||
if (other is KytheGetKytheEntriesParams) {
|
|
||||||
return file == other.file;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => file.hashCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// kythe.getKytheEntries result
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "entries": List<KytheEntry>
|
|
||||||
/// "files": List<FilePath>
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
class KytheGetKytheEntriesResult implements ResponseResult {
|
|
||||||
/// The list of KytheEntry objects for the queried file.
|
|
||||||
List<KytheEntry> entries;
|
|
||||||
|
|
||||||
/// The set of files paths that were required, but not in the file system, to
|
|
||||||
/// give a complete and accurate Kythe graph for the file. This could be due
|
|
||||||
/// to a referenced file that does not exist or generated files not being
|
|
||||||
/// generated or passed before the call to "getKytheEntries".
|
|
||||||
List<String> files;
|
|
||||||
|
|
||||||
KytheGetKytheEntriesResult(this.entries, this.files);
|
|
||||||
|
|
||||||
factory KytheGetKytheEntriesResult.fromJson(
|
|
||||||
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
|
|
||||||
json ??= {};
|
|
||||||
if (json is Map) {
|
|
||||||
List<KytheEntry> entries;
|
|
||||||
if (json.containsKey('entries')) {
|
|
||||||
entries = jsonDecoder.decodeList(
|
|
||||||
'$jsonPath.entries',
|
|
||||||
json['entries'],
|
|
||||||
(String jsonPath, Object? json) =>
|
|
||||||
KytheEntry.fromJson(jsonDecoder, jsonPath, json));
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'entries');
|
|
||||||
}
|
|
||||||
List<String> files;
|
|
||||||
if (json.containsKey('files')) {
|
|
||||||
files = jsonDecoder.decodeList(
|
|
||||||
'$jsonPath.files', json['files'], jsonDecoder.decodeString);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'files');
|
|
||||||
}
|
|
||||||
return KytheGetKytheEntriesResult(entries, files);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(
|
|
||||||
jsonPath, 'kythe.getKytheEntries result', json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
factory KytheGetKytheEntriesResult.fromResponse(Response response) {
|
|
||||||
return KytheGetKytheEntriesResult.fromJson(
|
|
||||||
ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
|
|
||||||
'result',
|
|
||||||
response.result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Object> toJson() {
|
|
||||||
var result = <String, Object>{};
|
|
||||||
result['entries'] =
|
|
||||||
entries.map((KytheEntry value) => value.toJson()).toList();
|
|
||||||
result['files'] = files;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Response toResponse(String id) {
|
|
||||||
return Response(id, result: toJson());
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(toJson());
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(other) {
|
|
||||||
if (other is KytheGetKytheEntriesResult) {
|
|
||||||
return listEqual(
|
|
||||||
entries, other.entries, (KytheEntry a, KytheEntry b) => a == b) &&
|
|
||||||
listEqual(files, other.files, (String a, String b) => a == b);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
Object.hashAll(entries),
|
|
||||||
Object.hashAll(files),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// LibraryPathSet
|
/// LibraryPathSet
|
||||||
///
|
///
|
||||||
/// {
|
/// {
|
||||||
|
@ -13866,7 +13714,6 @@ class RequestError implements HasToJson {
|
||||||
/// GET_ERRORS_INVALID_FILE
|
/// GET_ERRORS_INVALID_FILE
|
||||||
/// GET_FIXES_INVALID_FILE
|
/// GET_FIXES_INVALID_FILE
|
||||||
/// GET_IMPORTED_ELEMENTS_INVALID_FILE
|
/// GET_IMPORTED_ELEMENTS_INVALID_FILE
|
||||||
/// GET_KYTHE_ENTRIES_INVALID_FILE
|
|
||||||
/// GET_NAVIGATION_INVALID_FILE
|
/// GET_NAVIGATION_INVALID_FILE
|
||||||
/// GET_REACHABLE_SOURCES_INVALID_FILE
|
/// GET_REACHABLE_SOURCES_INVALID_FILE
|
||||||
/// GET_SIGNATURE_INVALID_FILE
|
/// GET_SIGNATURE_INVALID_FILE
|
||||||
|
@ -13955,11 +13802,6 @@ class RequestErrorCode implements Enum {
|
||||||
static const RequestErrorCode GET_IMPORTED_ELEMENTS_INVALID_FILE =
|
static const RequestErrorCode GET_IMPORTED_ELEMENTS_INVALID_FILE =
|
||||||
RequestErrorCode._('GET_IMPORTED_ELEMENTS_INVALID_FILE');
|
RequestErrorCode._('GET_IMPORTED_ELEMENTS_INVALID_FILE');
|
||||||
|
|
||||||
/// An "analysis.getKytheEntries" request specified a FilePath that does not
|
|
||||||
/// match a file that is currently subject to analysis.
|
|
||||||
static const RequestErrorCode GET_KYTHE_ENTRIES_INVALID_FILE =
|
|
||||||
RequestErrorCode._('GET_KYTHE_ENTRIES_INVALID_FILE');
|
|
||||||
|
|
||||||
/// An "analysis.getNavigation" request specified a FilePath which does not
|
/// An "analysis.getNavigation" request specified a FilePath which does not
|
||||||
/// match a file currently subject to analysis.
|
/// match a file currently subject to analysis.
|
||||||
static const RequestErrorCode GET_NAVIGATION_INVALID_FILE =
|
static const RequestErrorCode GET_NAVIGATION_INVALID_FILE =
|
||||||
|
@ -14079,7 +13921,6 @@ class RequestErrorCode implements Enum {
|
||||||
GET_ERRORS_INVALID_FILE,
|
GET_ERRORS_INVALID_FILE,
|
||||||
GET_FIXES_INVALID_FILE,
|
GET_FIXES_INVALID_FILE,
|
||||||
GET_IMPORTED_ELEMENTS_INVALID_FILE,
|
GET_IMPORTED_ELEMENTS_INVALID_FILE,
|
||||||
GET_KYTHE_ENTRIES_INVALID_FILE,
|
|
||||||
GET_NAVIGATION_INVALID_FILE,
|
GET_NAVIGATION_INVALID_FILE,
|
||||||
GET_REACHABLE_SOURCES_INVALID_FILE,
|
GET_REACHABLE_SOURCES_INVALID_FILE,
|
||||||
GET_SIGNATURE_INVALID_FILE,
|
GET_SIGNATURE_INVALID_FILE,
|
||||||
|
@ -14135,8 +13976,6 @@ class RequestErrorCode implements Enum {
|
||||||
return GET_FIXES_INVALID_FILE;
|
return GET_FIXES_INVALID_FILE;
|
||||||
case 'GET_IMPORTED_ELEMENTS_INVALID_FILE':
|
case 'GET_IMPORTED_ELEMENTS_INVALID_FILE':
|
||||||
return GET_IMPORTED_ELEMENTS_INVALID_FILE;
|
return GET_IMPORTED_ELEMENTS_INVALID_FILE;
|
||||||
case 'GET_KYTHE_ENTRIES_INVALID_FILE':
|
|
||||||
return GET_KYTHE_ENTRIES_INVALID_FILE;
|
|
||||||
case 'GET_NAVIGATION_INVALID_FILE':
|
case 'GET_NAVIGATION_INVALID_FILE':
|
||||||
return GET_NAVIGATION_INVALID_FILE;
|
return GET_NAVIGATION_INVALID_FILE;
|
||||||
case 'GET_REACHABLE_SOURCES_INVALID_FILE':
|
case 'GET_REACHABLE_SOURCES_INVALID_FILE':
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
|
|
||||||
// for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:analysis_server/protocol/protocol.dart';
|
|
||||||
import 'package:analysis_server/protocol/protocol_generated.dart';
|
|
||||||
import 'package:analysis_server/src/handler/legacy/legacy_handler.dart';
|
|
||||||
import 'package:analysis_server/src/legacy_analysis_server.dart';
|
|
||||||
import 'package:analysis_server/src/plugin/result_merger.dart';
|
|
||||||
import 'package:analysis_server/src/request_handler_mixin.dart';
|
|
||||||
import 'package:analysis_server/src/services/kythe/kythe_visitors.dart';
|
|
||||||
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
|
|
||||||
import 'package:analyzer_plugin/protocol/protocol_common.dart';
|
|
||||||
import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
|
|
||||||
|
|
||||||
/// The handler for the `kythe.getKytheEntries` request.
|
|
||||||
class KytheGetKytheEntriesHandler extends LegacyHandler
|
|
||||||
with RequestHandlerMixin<LegacyAnalysisServer> {
|
|
||||||
/// Initialize a newly created handler to be able to service requests for the
|
|
||||||
/// [server].
|
|
||||||
KytheGetKytheEntriesHandler(
|
|
||||||
super.server, super.request, super.cancellationToken);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> handle() async {
|
|
||||||
var file = KytheGetKytheEntriesParams.fromRequest(request).file;
|
|
||||||
var driver = server.getAnalysisDriver(file);
|
|
||||||
if (driver == null) {
|
|
||||||
sendResponse(Response.getKytheEntriesInvalidFile(request));
|
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// Allow plugins to start computing entries.
|
|
||||||
//
|
|
||||||
var requestParams = plugin.KytheGetKytheEntriesParams(file);
|
|
||||||
var pluginFutures = server.pluginManager.broadcastRequest(
|
|
||||||
requestParams,
|
|
||||||
contextRoot: driver.analysisContext!.contextRoot,
|
|
||||||
);
|
|
||||||
//
|
|
||||||
// Compute entries generated by server.
|
|
||||||
//
|
|
||||||
var allResults = <KytheGetKytheEntriesResult>[];
|
|
||||||
var result = await server.getResolvedUnit(file);
|
|
||||||
if (result != null) {
|
|
||||||
var entries = <KytheEntry>[];
|
|
||||||
// TODO(brianwilkerson) Figure out how to get the list of files.
|
|
||||||
var files = <String>[];
|
|
||||||
result.unit.accept(KytheDartVisitor(server.resourceProvider, entries,
|
|
||||||
file, InheritanceManager3(), result.content));
|
|
||||||
allResults.add(KytheGetKytheEntriesResult(entries, files));
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Add the entries produced by plugins to the server-generated entries.
|
|
||||||
//
|
|
||||||
var responses = await waitForResponses(pluginFutures,
|
|
||||||
requestParameters: requestParams);
|
|
||||||
for (var response in responses) {
|
|
||||||
var result = plugin.KytheGetKytheEntriesResult.fromResponse(response);
|
|
||||||
allResults
|
|
||||||
.add(KytheGetKytheEntriesResult(result.entries, result.files));
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Return the result.
|
|
||||||
//
|
|
||||||
var merger = ResultMerger();
|
|
||||||
var mergedResults = merger.mergeKytheEntries(allResults);
|
|
||||||
sendResult(KytheGetKytheEntriesResult(
|
|
||||||
mergedResults.entries, mergedResults.files));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -64,7 +64,6 @@ import 'package:analysis_server/src/handler/legacy/execution_set_subscriptions.d
|
||||||
import 'package:analysis_server/src/handler/legacy/flutter_get_widget_description.dart';
|
import 'package:analysis_server/src/handler/legacy/flutter_get_widget_description.dart';
|
||||||
import 'package:analysis_server/src/handler/legacy/flutter_set_subscriptions.dart';
|
import 'package:analysis_server/src/handler/legacy/flutter_set_subscriptions.dart';
|
||||||
import 'package:analysis_server/src/handler/legacy/flutter_set_widget_property_value.dart';
|
import 'package:analysis_server/src/handler/legacy/flutter_set_widget_property_value.dart';
|
||||||
import 'package:analysis_server/src/handler/legacy/kythe_get_kythe_entries.dart';
|
|
||||||
import 'package:analysis_server/src/handler/legacy/legacy_handler.dart';
|
import 'package:analysis_server/src/handler/legacy/legacy_handler.dart';
|
||||||
import 'package:analysis_server/src/handler/legacy/search_find_element_references.dart';
|
import 'package:analysis_server/src/handler/legacy/search_find_element_references.dart';
|
||||||
import 'package:analysis_server/src/handler/legacy/search_find_member_declarations.dart';
|
import 'package:analysis_server/src/handler/legacy/search_find_member_declarations.dart';
|
||||||
|
@ -235,8 +234,6 @@ class LegacyAnalysisServer extends AnalysisServer {
|
||||||
FlutterSetWidgetPropertyValueHandler.new,
|
FlutterSetWidgetPropertyValueHandler.new,
|
||||||
FLUTTER_REQUEST_SET_SUBSCRIPTIONS: FlutterSetSubscriptionsHandler.new,
|
FLUTTER_REQUEST_SET_SUBSCRIPTIONS: FlutterSetSubscriptionsHandler.new,
|
||||||
//
|
//
|
||||||
KYTHE_REQUEST_GET_KYTHE_ENTRIES: KytheGetKytheEntriesHandler.new,
|
|
||||||
//
|
|
||||||
SEARCH_REQUEST_FIND_ELEMENT_REFERENCES:
|
SEARCH_REQUEST_FIND_ELEMENT_REFERENCES:
|
||||||
SearchFindElementReferencesHandler.new,
|
SearchFindElementReferencesHandler.new,
|
||||||
SEARCH_REQUEST_FIND_MEMBER_DECLARATIONS:
|
SEARCH_REQUEST_FIND_MEMBER_DECLARATIONS:
|
||||||
|
|
|
@ -183,23 +183,6 @@ class ResultMerger {
|
||||||
return mergedRegions;
|
return mergedRegions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return kythe entry result parameters composed by merging the parameters in
|
|
||||||
/// the [partialResultList].
|
|
||||||
///
|
|
||||||
/// The resulting list will contain all of the kythe entries from all of the
|
|
||||||
/// plugins. If a plugin contributes a kythe entry that is the same as the
|
|
||||||
/// entry from a different plugin, the entry will appear twice in the list.
|
|
||||||
KytheGetKytheEntriesResult mergeKytheEntries(
|
|
||||||
List<KytheGetKytheEntriesResult> partialResultList) {
|
|
||||||
var mergedEntries = <KytheEntry>[];
|
|
||||||
var mergedFiles = <String>{};
|
|
||||||
for (var partialResult in partialResultList) {
|
|
||||||
mergedEntries.addAll(partialResult.entries);
|
|
||||||
mergedFiles.addAll(partialResult.files);
|
|
||||||
}
|
|
||||||
return KytheGetKytheEntriesResult(mergedEntries, mergedFiles.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return navigation notification parameters composed by merging the
|
/// Return navigation notification parameters composed by merging the
|
||||||
/// parameters in the [partialResultList].
|
/// parameters in the [partialResultList].
|
||||||
///
|
///
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -93,9 +93,6 @@ server calls. This file is validated by `coverage_test.dart`.
|
||||||
- [x] analytics.sendEvent
|
- [x] analytics.sendEvent
|
||||||
- [x] analytics.sendTiming
|
- [x] analytics.sendTiming
|
||||||
|
|
||||||
## kythe domain
|
|
||||||
- [x] kythe.getKytheEntries
|
|
||||||
|
|
||||||
## flutter domain
|
## flutter domain
|
||||||
- [ ] flutter.getChangeAddForDesignTimeConstructor
|
- [ ] flutter.getChangeAddForDesignTimeConstructor
|
||||||
- [ ] flutter.setSubscriptions
|
- [ ] flutter.setSubscriptions
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
||||||
// for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
import 'package:analyzer/src/util/file_paths.dart' as file_paths;
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
|
||||||
|
|
||||||
import '../support/integration_tests.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
defineReflectiveSuite(() {
|
|
||||||
defineReflectiveTests(GetKytheEntriesTest);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@reflectiveTest
|
|
||||||
class GetKytheEntriesTest extends AbstractAnalysisServerIntegrationTest {
|
|
||||||
Future<void> test_getKytheEntries() async {
|
|
||||||
writeFile(sourcePath(file_paths.blazeWorkspaceMarker), '');
|
|
||||||
var pathname = sourcePath('pkg/test.dart');
|
|
||||||
var text = r'''
|
|
||||||
class Foo {}
|
|
||||||
|
|
||||||
class Bar {
|
|
||||||
Foo foo;
|
|
||||||
}
|
|
||||||
''';
|
|
||||||
writeFile(pathname, text);
|
|
||||||
await standardAnalysisSetup();
|
|
||||||
|
|
||||||
await analysisFinished;
|
|
||||||
|
|
||||||
var result = await sendKytheGetKytheEntries(pathname);
|
|
||||||
expect(result.entries, isNotEmpty);
|
|
||||||
expect(result.files, isEmpty);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
||||||
// for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
|
||||||
|
|
||||||
import 'get_kythe_entries_test.dart' as get_kythe_entries_test;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
defineReflectiveSuite(() {
|
|
||||||
get_kythe_entries_test.main();
|
|
||||||
}, name: 'kythe');
|
|
||||||
}
|
|
|
@ -2469,41 +2469,6 @@ abstract class IntegrationTestMixin {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the list of KytheEntry objects for some file, given the current
|
|
||||||
/// state of the file system populated by "analysis.updateContent".
|
|
||||||
///
|
|
||||||
/// If a request is made for a file that does not exist, or that is not
|
|
||||||
/// currently subject to analysis (e.g. because it is not associated with any
|
|
||||||
/// analysis root specified to analysis.setAnalysisRoots), an error of type
|
|
||||||
/// GET_KYTHE_ENTRIES_INVALID_FILE will be generated.
|
|
||||||
///
|
|
||||||
/// Parameters
|
|
||||||
///
|
|
||||||
/// file: FilePath
|
|
||||||
///
|
|
||||||
/// The file containing the code for which the Kythe Entry objects are
|
|
||||||
/// being requested.
|
|
||||||
///
|
|
||||||
/// Returns
|
|
||||||
///
|
|
||||||
/// entries: List<KytheEntry>
|
|
||||||
///
|
|
||||||
/// The list of KytheEntry objects for the queried file.
|
|
||||||
///
|
|
||||||
/// files: List<FilePath>
|
|
||||||
///
|
|
||||||
/// The set of files paths that were required, but not in the file system,
|
|
||||||
/// to give a complete and accurate Kythe graph for the file. This could be
|
|
||||||
/// due to a referenced file that does not exist or generated files not
|
|
||||||
/// being generated or passed before the call to "getKytheEntries".
|
|
||||||
Future<KytheGetKytheEntriesResult> sendKytheGetKytheEntries(
|
|
||||||
String file) async {
|
|
||||||
var params = KytheGetKytheEntriesParams(file).toJson();
|
|
||||||
var result = await server.send('kythe.getKytheEntries', params);
|
|
||||||
var decoder = ResponseDecoder(null);
|
|
||||||
return KytheGetKytheEntriesResult.fromJson(decoder, 'result', result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return the description of the widget instance at the given location.
|
/// Return the description of the widget instance at the given location.
|
||||||
///
|
///
|
||||||
/// If the location does not have a support widget, an error of type
|
/// If the location does not have a support widget, an error of type
|
||||||
|
|
|
@ -1055,41 +1055,6 @@ final Matcher isIncludedSuggestionSet = LazyMatcher(() => MatchesJsonObject(
|
||||||
'IncludedSuggestionSet', {'id': isInt, 'relevance': isInt},
|
'IncludedSuggestionSet', {'id': isInt, 'relevance': isInt},
|
||||||
optionalFields: {'displayUri': isString}));
|
optionalFields: {'displayUri': isString}));
|
||||||
|
|
||||||
/// KytheEntry
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "source": KytheVName
|
|
||||||
/// "kind": optional String
|
|
||||||
/// "target": optional KytheVName
|
|
||||||
/// "fact": String
|
|
||||||
/// "value": optional List<int>
|
|
||||||
/// }
|
|
||||||
final Matcher isKytheEntry = LazyMatcher(() => MatchesJsonObject('KytheEntry', {
|
|
||||||
'source': isKytheVName,
|
|
||||||
'fact': isString
|
|
||||||
}, optionalFields: {
|
|
||||||
'kind': isString,
|
|
||||||
'target': isKytheVName,
|
|
||||||
'value': isListOf(isInt)
|
|
||||||
}));
|
|
||||||
|
|
||||||
/// KytheVName
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "signature": String
|
|
||||||
/// "corpus": String
|
|
||||||
/// "root": String
|
|
||||||
/// "path": String
|
|
||||||
/// "language": String
|
|
||||||
/// }
|
|
||||||
final Matcher isKytheVName = LazyMatcher(() => MatchesJsonObject('KytheVName', {
|
|
||||||
'signature': isString,
|
|
||||||
'corpus': isString,
|
|
||||||
'root': isString,
|
|
||||||
'path': isString,
|
|
||||||
'language': isString
|
|
||||||
}));
|
|
||||||
|
|
||||||
/// LibraryPathSet
|
/// LibraryPathSet
|
||||||
///
|
///
|
||||||
/// {
|
/// {
|
||||||
|
@ -1430,7 +1395,6 @@ final Matcher isRequestError = LazyMatcher(() => MatchesJsonObject(
|
||||||
/// GET_ERRORS_INVALID_FILE
|
/// GET_ERRORS_INVALID_FILE
|
||||||
/// GET_FIXES_INVALID_FILE
|
/// GET_FIXES_INVALID_FILE
|
||||||
/// GET_IMPORTED_ELEMENTS_INVALID_FILE
|
/// GET_IMPORTED_ELEMENTS_INVALID_FILE
|
||||||
/// GET_KYTHE_ENTRIES_INVALID_FILE
|
|
||||||
/// GET_NAVIGATION_INVALID_FILE
|
/// GET_NAVIGATION_INVALID_FILE
|
||||||
/// GET_REACHABLE_SOURCES_INVALID_FILE
|
/// GET_REACHABLE_SOURCES_INVALID_FILE
|
||||||
/// GET_SIGNATURE_INVALID_FILE
|
/// GET_SIGNATURE_INVALID_FILE
|
||||||
|
@ -1466,7 +1430,6 @@ final Matcher isRequestErrorCode = MatchesEnum('RequestErrorCode', [
|
||||||
'GET_ERRORS_INVALID_FILE',
|
'GET_ERRORS_INVALID_FILE',
|
||||||
'GET_FIXES_INVALID_FILE',
|
'GET_FIXES_INVALID_FILE',
|
||||||
'GET_IMPORTED_ELEMENTS_INVALID_FILE',
|
'GET_IMPORTED_ELEMENTS_INVALID_FILE',
|
||||||
'GET_KYTHE_ENTRIES_INVALID_FILE',
|
|
||||||
'GET_NAVIGATION_INVALID_FILE',
|
'GET_NAVIGATION_INVALID_FILE',
|
||||||
'GET_REACHABLE_SOURCES_INVALID_FILE',
|
'GET_REACHABLE_SOURCES_INVALID_FILE',
|
||||||
'GET_SIGNATURE_INVALID_FILE',
|
'GET_SIGNATURE_INVALID_FILE',
|
||||||
|
@ -2884,24 +2847,6 @@ final Matcher isInlineMethodFeedback = LazyMatcher(() => MatchesJsonObject(
|
||||||
final Matcher isInlineMethodOptions = LazyMatcher(() => MatchesJsonObject(
|
final Matcher isInlineMethodOptions = LazyMatcher(() => MatchesJsonObject(
|
||||||
'inlineMethod options', {'deleteSource': isBool, 'inlineAll': isBool}));
|
'inlineMethod options', {'deleteSource': isBool, 'inlineAll': isBool}));
|
||||||
|
|
||||||
/// kythe.getKytheEntries params
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "file": FilePath
|
|
||||||
/// }
|
|
||||||
final Matcher isKytheGetKytheEntriesParams = LazyMatcher(() =>
|
|
||||||
MatchesJsonObject('kythe.getKytheEntries params', {'file': isFilePath}));
|
|
||||||
|
|
||||||
/// kythe.getKytheEntries result
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "entries": List<KytheEntry>
|
|
||||||
/// "files": List<FilePath>
|
|
||||||
/// }
|
|
||||||
final Matcher isKytheGetKytheEntriesResult = LazyMatcher(() =>
|
|
||||||
MatchesJsonObject('kythe.getKytheEntries result',
|
|
||||||
{'entries': isListOf(isKytheEntry), 'files': isListOf(isFilePath)}));
|
|
||||||
|
|
||||||
/// moveFile feedback
|
/// moveFile feedback
|
||||||
final Matcher isMoveFileFeedback = isNull;
|
final Matcher isMoveFileFeedback = isNull;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import 'coverage_test.dart' as coverage_test;
|
||||||
import 'diagnostic/test_all.dart' as diagnostic;
|
import 'diagnostic/test_all.dart' as diagnostic;
|
||||||
import 'edit/test_all.dart' as edit;
|
import 'edit/test_all.dart' as edit;
|
||||||
import 'execution/test_all.dart' as execution;
|
import 'execution/test_all.dart' as execution;
|
||||||
import 'kythe/test_all.dart' as kythe;
|
|
||||||
import 'linter/test_all.dart' as linter;
|
import 'linter/test_all.dart' as linter;
|
||||||
import 'lsp_server/test_all.dart' as lsp_server;
|
import 'lsp_server/test_all.dart' as lsp_server;
|
||||||
import 'search/test_all.dart' as search;
|
import 'search/test_all.dart' as search;
|
||||||
|
@ -26,7 +25,6 @@ void main() {
|
||||||
diagnostic.main();
|
diagnostic.main();
|
||||||
edit.main();
|
edit.main();
|
||||||
execution.main();
|
execution.main();
|
||||||
kythe.main();
|
|
||||||
linter.main();
|
linter.main();
|
||||||
lsp_server.main();
|
lsp_server.main();
|
||||||
search.main();
|
search.main();
|
||||||
|
|
|
@ -881,20 +881,6 @@ public interface AnalysisServer {
|
||||||
*/
|
*/
|
||||||
public boolean isSocketOpen();
|
public boolean isSocketOpen();
|
||||||
|
|
||||||
/**
|
|
||||||
* {@code kythe.getKytheEntries}
|
|
||||||
*
|
|
||||||
* Return the list of KytheEntry objects for some file, given the current state of the file system
|
|
||||||
* populated by "analysis.updateContent".
|
|
||||||
*
|
|
||||||
* If a request is made for a file that does not exist, or that is not currently subject to
|
|
||||||
* analysis (e.g. because it is not associated with any analysis root specified to
|
|
||||||
* analysis.setAnalysisRoots), an error of type GET_KYTHE_ENTRIES_INVALID_FILE will be generated.
|
|
||||||
*
|
|
||||||
* @param file The file containing the code for which the Kythe Entry objects are being requested.
|
|
||||||
*/
|
|
||||||
public void kythe_getKytheEntries(String file, GetKytheEntriesConsumer consumer);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the given listener from the list of listeners that will receive notification when new
|
* Remove the given listener from the list of listeners that will receive notification when new
|
||||||
* analysis results become available.
|
* analysis results become available.
|
||||||
|
|
|
@ -1,194 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
||||||
* for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
* BSD-style license that can be found in the LICENSE file.
|
|
||||||
*
|
|
||||||
* This file has been automatically generated. Please do not edit it manually.
|
|
||||||
* To regenerate the file, use the script "pkg/analysis_server/tool/spec/generate_files".
|
|
||||||
*/
|
|
||||||
package org.dartlang.analysis.server.protocol;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.dart.server.utilities.general.JsonUtilities;
|
|
||||||
import com.google.dart.server.utilities.general.ObjectUtilities;
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonPrimitive;
|
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This object matches the format and documentation of the Entry object documented in the Kythe
|
|
||||||
* Storage Model.
|
|
||||||
*
|
|
||||||
* @coverage dart.server.generated.types
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public class KytheEntry {
|
|
||||||
|
|
||||||
public static final KytheEntry[] EMPTY_ARRAY = new KytheEntry[0];
|
|
||||||
|
|
||||||
public static final List<KytheEntry> EMPTY_LIST = Lists.newArrayList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ticket of the source node.
|
|
||||||
*/
|
|
||||||
private final KytheVName source;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An edge label. The schema defines which labels are meaningful.
|
|
||||||
*/
|
|
||||||
private final String kind;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ticket of the target node.
|
|
||||||
*/
|
|
||||||
private final KytheVName target;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A fact label. The schema defines which fact labels are meaningful.
|
|
||||||
*/
|
|
||||||
private final String fact;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The String value of the fact.
|
|
||||||
*/
|
|
||||||
private final int[] value;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for {@link KytheEntry}.
|
|
||||||
*/
|
|
||||||
public KytheEntry(KytheVName source, String kind, KytheVName target, String fact, int[] value) {
|
|
||||||
this.source = source;
|
|
||||||
this.kind = kind;
|
|
||||||
this.target = target;
|
|
||||||
this.fact = fact;
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj instanceof KytheEntry) {
|
|
||||||
KytheEntry other = (KytheEntry) obj;
|
|
||||||
return
|
|
||||||
ObjectUtilities.equals(other.source, source) &&
|
|
||||||
ObjectUtilities.equals(other.kind, kind) &&
|
|
||||||
ObjectUtilities.equals(other.target, target) &&
|
|
||||||
ObjectUtilities.equals(other.fact, fact) &&
|
|
||||||
Arrays.equals(other.value, value);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static KytheEntry fromJson(JsonObject jsonObject) {
|
|
||||||
KytheVName source = KytheVName.fromJson(jsonObject.get("source").getAsJsonObject());
|
|
||||||
String kind = jsonObject.get("kind") == null ? null : jsonObject.get("kind").getAsString();
|
|
||||||
KytheVName target = jsonObject.get("target") == null ? null : KytheVName.fromJson(jsonObject.get("target").getAsJsonObject());
|
|
||||||
String fact = jsonObject.get("fact").getAsString();
|
|
||||||
int[] value = jsonObject.get("value") == null ? null : JsonUtilities.decodeIntArray(jsonObject.get("value").getAsJsonArray());
|
|
||||||
return new KytheEntry(source, kind, target, fact, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<KytheEntry> fromJsonArray(JsonArray jsonArray) {
|
|
||||||
if (jsonArray == null) {
|
|
||||||
return EMPTY_LIST;
|
|
||||||
}
|
|
||||||
ArrayList<KytheEntry> list = new ArrayList<KytheEntry>(jsonArray.size());
|
|
||||||
Iterator<JsonElement> iterator = jsonArray.iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
list.add(fromJson(iterator.next().getAsJsonObject()));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A fact label. The schema defines which fact labels are meaningful.
|
|
||||||
*/
|
|
||||||
public String getFact() {
|
|
||||||
return fact;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An edge label. The schema defines which labels are meaningful.
|
|
||||||
*/
|
|
||||||
public String getKind() {
|
|
||||||
return kind;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ticket of the source node.
|
|
||||||
*/
|
|
||||||
public KytheVName getSource() {
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ticket of the target node.
|
|
||||||
*/
|
|
||||||
public KytheVName getTarget() {
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The String value of the fact.
|
|
||||||
*/
|
|
||||||
public int[] getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
HashCodeBuilder builder = new HashCodeBuilder();
|
|
||||||
builder.append(source);
|
|
||||||
builder.append(kind);
|
|
||||||
builder.append(target);
|
|
||||||
builder.append(fact);
|
|
||||||
builder.append(value);
|
|
||||||
return builder.toHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public JsonObject toJson() {
|
|
||||||
JsonObject jsonObject = new JsonObject();
|
|
||||||
jsonObject.add("source", source.toJson());
|
|
||||||
if (kind != null) {
|
|
||||||
jsonObject.addProperty("kind", kind);
|
|
||||||
}
|
|
||||||
if (target != null) {
|
|
||||||
jsonObject.add("target", target.toJson());
|
|
||||||
}
|
|
||||||
jsonObject.addProperty("fact", fact);
|
|
||||||
if (value != null) {
|
|
||||||
JsonArray jsonArrayValue = new JsonArray();
|
|
||||||
for (int elt : value) {
|
|
||||||
jsonArrayValue.add(new JsonPrimitive(elt));
|
|
||||||
}
|
|
||||||
jsonObject.add("value", jsonArrayValue);
|
|
||||||
}
|
|
||||||
return jsonObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("[");
|
|
||||||
builder.append("source=");
|
|
||||||
builder.append(source + ", ");
|
|
||||||
builder.append("kind=");
|
|
||||||
builder.append(kind + ", ");
|
|
||||||
builder.append("target=");
|
|
||||||
builder.append(target + ", ");
|
|
||||||
builder.append("fact=");
|
|
||||||
builder.append(fact + ", ");
|
|
||||||
builder.append("value=");
|
|
||||||
builder.append(StringUtils.join(value, ", "));
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,192 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
||||||
* for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
* BSD-style license that can be found in the LICENSE file.
|
|
||||||
*
|
|
||||||
* This file has been automatically generated. Please do not edit it manually.
|
|
||||||
* To regenerate the file, use the script "pkg/analysis_server/tool/spec/generate_files".
|
|
||||||
*/
|
|
||||||
package org.dartlang.analysis.server.protocol;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.dart.server.utilities.general.JsonUtilities;
|
|
||||||
import com.google.dart.server.utilities.general.ObjectUtilities;
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonPrimitive;
|
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This object matches the format and documentation of the Vector-Name object documented in the
|
|
||||||
* Kythe Storage Model.
|
|
||||||
*
|
|
||||||
* @coverage dart.server.generated.types
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public class KytheVName {
|
|
||||||
|
|
||||||
public static final KytheVName[] EMPTY_ARRAY = new KytheVName[0];
|
|
||||||
|
|
||||||
public static final List<KytheVName> EMPTY_LIST = Lists.newArrayList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An opaque signature generated by the analyzer.
|
|
||||||
*/
|
|
||||||
private final String signature;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The corpus of source code this KytheVName belongs to. Loosely, a corpus is a collection of
|
|
||||||
* related files, such as the contents of a given source repository.
|
|
||||||
*/
|
|
||||||
private final String corpus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A corpus-specific root label, typically a directory path or project identifier, denoting a
|
|
||||||
* distinct subset of the corpus. This may also be used to designate virtual collections like
|
|
||||||
* generated files.
|
|
||||||
*/
|
|
||||||
private final String root;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A path-structured label describing the “location” of the named object relative to the corpus and
|
|
||||||
* the root.
|
|
||||||
*/
|
|
||||||
private final String path;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The language this name belongs to.
|
|
||||||
*/
|
|
||||||
private final String language;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for {@link KytheVName}.
|
|
||||||
*/
|
|
||||||
public KytheVName(String signature, String corpus, String root, String path, String language) {
|
|
||||||
this.signature = signature;
|
|
||||||
this.corpus = corpus;
|
|
||||||
this.root = root;
|
|
||||||
this.path = path;
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj instanceof KytheVName) {
|
|
||||||
KytheVName other = (KytheVName) obj;
|
|
||||||
return
|
|
||||||
ObjectUtilities.equals(other.signature, signature) &&
|
|
||||||
ObjectUtilities.equals(other.corpus, corpus) &&
|
|
||||||
ObjectUtilities.equals(other.root, root) &&
|
|
||||||
ObjectUtilities.equals(other.path, path) &&
|
|
||||||
ObjectUtilities.equals(other.language, language);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static KytheVName fromJson(JsonObject jsonObject) {
|
|
||||||
String signature = jsonObject.get("signature").getAsString();
|
|
||||||
String corpus = jsonObject.get("corpus").getAsString();
|
|
||||||
String root = jsonObject.get("root").getAsString();
|
|
||||||
String path = jsonObject.get("path").getAsString();
|
|
||||||
String language = jsonObject.get("language").getAsString();
|
|
||||||
return new KytheVName(signature, corpus, root, path, language);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<KytheVName> fromJsonArray(JsonArray jsonArray) {
|
|
||||||
if (jsonArray == null) {
|
|
||||||
return EMPTY_LIST;
|
|
||||||
}
|
|
||||||
ArrayList<KytheVName> list = new ArrayList<KytheVName>(jsonArray.size());
|
|
||||||
Iterator<JsonElement> iterator = jsonArray.iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
list.add(fromJson(iterator.next().getAsJsonObject()));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The corpus of source code this KytheVName belongs to. Loosely, a corpus is a collection of
|
|
||||||
* related files, such as the contents of a given source repository.
|
|
||||||
*/
|
|
||||||
public String getCorpus() {
|
|
||||||
return corpus;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The language this name belongs to.
|
|
||||||
*/
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A path-structured label describing the “location” of the named object relative to the corpus and
|
|
||||||
* the root.
|
|
||||||
*/
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A corpus-specific root label, typically a directory path or project identifier, denoting a
|
|
||||||
* distinct subset of the corpus. This may also be used to designate virtual collections like
|
|
||||||
* generated files.
|
|
||||||
*/
|
|
||||||
public String getRoot() {
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An opaque signature generated by the analyzer.
|
|
||||||
*/
|
|
||||||
public String getSignature() {
|
|
||||||
return signature;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
HashCodeBuilder builder = new HashCodeBuilder();
|
|
||||||
builder.append(signature);
|
|
||||||
builder.append(corpus);
|
|
||||||
builder.append(root);
|
|
||||||
builder.append(path);
|
|
||||||
builder.append(language);
|
|
||||||
return builder.toHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public JsonObject toJson() {
|
|
||||||
JsonObject jsonObject = new JsonObject();
|
|
||||||
jsonObject.addProperty("signature", signature);
|
|
||||||
jsonObject.addProperty("corpus", corpus);
|
|
||||||
jsonObject.addProperty("root", root);
|
|
||||||
jsonObject.addProperty("path", path);
|
|
||||||
jsonObject.addProperty("language", language);
|
|
||||||
return jsonObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("[");
|
|
||||||
builder.append("signature=");
|
|
||||||
builder.append(signature + ", ");
|
|
||||||
builder.append("corpus=");
|
|
||||||
builder.append(corpus + ", ");
|
|
||||||
builder.append("root=");
|
|
||||||
builder.append(root + ", ");
|
|
||||||
builder.append("path=");
|
|
||||||
builder.append(path + ", ");
|
|
||||||
builder.append("language=");
|
|
||||||
builder.append(language);
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -88,12 +88,6 @@ public class RequestErrorCode {
|
||||||
*/
|
*/
|
||||||
public static final String GET_IMPORTED_ELEMENTS_INVALID_FILE = "GET_IMPORTED_ELEMENTS_INVALID_FILE";
|
public static final String GET_IMPORTED_ELEMENTS_INVALID_FILE = "GET_IMPORTED_ELEMENTS_INVALID_FILE";
|
||||||
|
|
||||||
/**
|
|
||||||
* An "analysis.getKytheEntries" request specified a FilePath that does not match a file that is
|
|
||||||
* currently subject to analysis.
|
|
||||||
*/
|
|
||||||
public static final String GET_KYTHE_ENTRIES_INVALID_FILE = "GET_KYTHE_ENTRIES_INVALID_FILE";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An "analysis.getNavigation" request specified a FilePath which does not match a file currently
|
* An "analysis.getNavigation" request specified a FilePath which does not match a file currently
|
||||||
* subject to analysis.
|
* subject to analysis.
|
||||||
|
|
|
@ -3304,54 +3304,6 @@
|
||||||
</params>
|
</params>
|
||||||
</request>
|
</request>
|
||||||
</domain>
|
</domain>
|
||||||
<domain name="kythe" experimental="true">
|
|
||||||
<p>
|
|
||||||
The kythe domain contains APIs related to generating Dart content in the
|
|
||||||
<a href="http://kythe.io/">Kythe</a> format.
|
|
||||||
</p>
|
|
||||||
<request method="getKytheEntries">
|
|
||||||
<p>
|
|
||||||
Return the list of <tt>KytheEntry</tt> objects for some file, given the
|
|
||||||
current state of the file system populated by "analysis.updateContent".
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
If a request is made for a file that does not exist, or that is not
|
|
||||||
currently subject to analysis (e.g. because it is not associated with any
|
|
||||||
analysis root specified to analysis.setAnalysisRoots), an error of type
|
|
||||||
<tt>GET_KYTHE_ENTRIES_INVALID_FILE</tt> will be generated.
|
|
||||||
</p>
|
|
||||||
<params>
|
|
||||||
<field name="file">
|
|
||||||
<ref>FilePath</ref>
|
|
||||||
<p>
|
|
||||||
The file containing the code for which the Kythe Entry objects are
|
|
||||||
being requested.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
</params>
|
|
||||||
<result>
|
|
||||||
<field name="entries">
|
|
||||||
<list>
|
|
||||||
<ref>KytheEntry</ref>
|
|
||||||
</list>
|
|
||||||
<p>
|
|
||||||
The list of <tt>KytheEntry</tt> objects for the queried file.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
<field name="files">
|
|
||||||
<list>
|
|
||||||
<ref>FilePath</ref>
|
|
||||||
</list>
|
|
||||||
<p>
|
|
||||||
The set of files paths that were required, but not in the file system,
|
|
||||||
to give a complete and accurate Kythe graph for the file. This could
|
|
||||||
be due to a referenced file that does not exist or generated files not
|
|
||||||
being generated or passed before the call to "getKytheEntries".
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
</result>
|
|
||||||
</request>
|
|
||||||
</domain>
|
|
||||||
<domain name="flutter">
|
<domain name="flutter">
|
||||||
<p>
|
<p>
|
||||||
The analysis domain contains API's related to Flutter support.
|
The analysis domain contains API's related to Flutter support.
|
||||||
|
@ -5205,13 +5157,6 @@
|
||||||
does not match a file currently subject to analysis.
|
does not match a file currently subject to analysis.
|
||||||
</p>
|
</p>
|
||||||
</value>
|
</value>
|
||||||
<value>
|
|
||||||
<code>GET_KYTHE_ENTRIES_INVALID_FILE</code>
|
|
||||||
<p>
|
|
||||||
An "analysis.getKytheEntries" request specified a FilePath that does
|
|
||||||
not match a file that is currently subject to analysis.
|
|
||||||
</p>
|
|
||||||
</value>
|
|
||||||
<value>
|
<value>
|
||||||
<code>GET_NAVIGATION_INVALID_FILE</code>
|
<code>GET_NAVIGATION_INVALID_FILE</code>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -357,13 +357,6 @@ class Response {
|
||||||
RequestErrorCode.GET_IMPORTED_ELEMENTS_INVALID_FILE,
|
RequestErrorCode.GET_IMPORTED_ELEMENTS_INVALID_FILE,
|
||||||
'Error during `analysis.getImportedElements`: invalid file.'));
|
'Error during `analysis.getImportedElements`: invalid file.'));
|
||||||
|
|
||||||
/// Initialize a newly created instance to represent the
|
|
||||||
/// GET_KYTHE_ENTRIES_INVALID_FILE error condition.
|
|
||||||
Response.getKytheEntriesInvalidFile(Request request)
|
|
||||||
: this(request.id,
|
|
||||||
error: RequestError(RequestErrorCode.GET_KYTHE_ENTRIES_INVALID_FILE,
|
|
||||||
'Error during `analysis.getKytheEntries`: invalid file.'));
|
|
||||||
|
|
||||||
/// Initialize a newly created instance to represent the
|
/// Initialize a newly created instance to represent the
|
||||||
/// GET_NAVIGATION_INVALID_FILE error condition.
|
/// GET_NAVIGATION_INVALID_FILE error condition.
|
||||||
Response.getNavigationInvalidFile(Request request)
|
Response.getNavigationInvalidFile(Request request)
|
||||||
|
|
|
@ -2492,229 +2492,6 @@ class HighlightRegionType implements Enum {
|
||||||
String toJson() => name;
|
String toJson() => name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// KytheEntry
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "source": KytheVName
|
|
||||||
/// "kind": optional String
|
|
||||||
/// "target": optional KytheVName
|
|
||||||
/// "fact": String
|
|
||||||
/// "value": optional List<int>
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
class KytheEntry implements HasToJson {
|
|
||||||
/// The ticket of the source node.
|
|
||||||
KytheVName source;
|
|
||||||
|
|
||||||
/// An edge label. The schema defines which labels are meaningful.
|
|
||||||
String? kind;
|
|
||||||
|
|
||||||
/// The ticket of the target node.
|
|
||||||
KytheVName? target;
|
|
||||||
|
|
||||||
/// A fact label. The schema defines which fact labels are meaningful.
|
|
||||||
String fact;
|
|
||||||
|
|
||||||
/// The String value of the fact.
|
|
||||||
List<int>? value;
|
|
||||||
|
|
||||||
KytheEntry(this.source, this.fact, {this.kind, this.target, this.value});
|
|
||||||
|
|
||||||
factory KytheEntry.fromJson(
|
|
||||||
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
|
|
||||||
json ??= {};
|
|
||||||
if (json is Map) {
|
|
||||||
KytheVName source;
|
|
||||||
if (json.containsKey('source')) {
|
|
||||||
source = KytheVName.fromJson(
|
|
||||||
jsonDecoder, '$jsonPath.source', json['source']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'source');
|
|
||||||
}
|
|
||||||
String? kind;
|
|
||||||
if (json.containsKey('kind')) {
|
|
||||||
kind = jsonDecoder.decodeString('$jsonPath.kind', json['kind']);
|
|
||||||
}
|
|
||||||
KytheVName? target;
|
|
||||||
if (json.containsKey('target')) {
|
|
||||||
target = KytheVName.fromJson(
|
|
||||||
jsonDecoder, '$jsonPath.target', json['target']);
|
|
||||||
}
|
|
||||||
String fact;
|
|
||||||
if (json.containsKey('fact')) {
|
|
||||||
fact = jsonDecoder.decodeString('$jsonPath.fact', json['fact']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'fact');
|
|
||||||
}
|
|
||||||
List<int>? value;
|
|
||||||
if (json.containsKey('value')) {
|
|
||||||
value = jsonDecoder.decodeList(
|
|
||||||
'$jsonPath.value', json['value'], jsonDecoder.decodeInt);
|
|
||||||
}
|
|
||||||
return KytheEntry(source, fact, kind: kind, target: target, value: value);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'KytheEntry', json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Object> toJson() {
|
|
||||||
var result = <String, Object>{};
|
|
||||||
result['source'] = source.toJson();
|
|
||||||
var kind = this.kind;
|
|
||||||
if (kind != null) {
|
|
||||||
result['kind'] = kind;
|
|
||||||
}
|
|
||||||
var target = this.target;
|
|
||||||
if (target != null) {
|
|
||||||
result['target'] = target.toJson();
|
|
||||||
}
|
|
||||||
result['fact'] = fact;
|
|
||||||
var value = this.value;
|
|
||||||
if (value != null) {
|
|
||||||
result['value'] = value;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(toJson());
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(other) {
|
|
||||||
if (other is KytheEntry) {
|
|
||||||
return source == other.source &&
|
|
||||||
kind == other.kind &&
|
|
||||||
target == other.target &&
|
|
||||||
fact == other.fact &&
|
|
||||||
listEqual(value, other.value, (int a, int b) => a == b);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
source,
|
|
||||||
kind,
|
|
||||||
target,
|
|
||||||
fact,
|
|
||||||
Object.hashAll(value ?? []),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// KytheVName
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "signature": String
|
|
||||||
/// "corpus": String
|
|
||||||
/// "root": String
|
|
||||||
/// "path": String
|
|
||||||
/// "language": String
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
class KytheVName implements HasToJson {
|
|
||||||
/// An opaque signature generated by the analyzer.
|
|
||||||
String signature;
|
|
||||||
|
|
||||||
/// The corpus of source code this KytheVName belongs to. Loosely, a corpus
|
|
||||||
/// is a collection of related files, such as the contents of a given source
|
|
||||||
/// repository.
|
|
||||||
String corpus;
|
|
||||||
|
|
||||||
/// A corpus-specific root label, typically a directory path or project
|
|
||||||
/// identifier, denoting a distinct subset of the corpus. This may also be
|
|
||||||
/// used to designate virtual collections like generated files.
|
|
||||||
String root;
|
|
||||||
|
|
||||||
/// A path-structured label describing the “location” of the named object
|
|
||||||
/// relative to the corpus and the root.
|
|
||||||
String path;
|
|
||||||
|
|
||||||
/// The language this name belongs to.
|
|
||||||
String language;
|
|
||||||
|
|
||||||
KytheVName(this.signature, this.corpus, this.root, this.path, this.language);
|
|
||||||
|
|
||||||
factory KytheVName.fromJson(
|
|
||||||
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
|
|
||||||
json ??= {};
|
|
||||||
if (json is Map) {
|
|
||||||
String signature;
|
|
||||||
if (json.containsKey('signature')) {
|
|
||||||
signature =
|
|
||||||
jsonDecoder.decodeString('$jsonPath.signature', json['signature']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'signature');
|
|
||||||
}
|
|
||||||
String corpus;
|
|
||||||
if (json.containsKey('corpus')) {
|
|
||||||
corpus = jsonDecoder.decodeString('$jsonPath.corpus', json['corpus']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'corpus');
|
|
||||||
}
|
|
||||||
String root;
|
|
||||||
if (json.containsKey('root')) {
|
|
||||||
root = jsonDecoder.decodeString('$jsonPath.root', json['root']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'root');
|
|
||||||
}
|
|
||||||
String path;
|
|
||||||
if (json.containsKey('path')) {
|
|
||||||
path = jsonDecoder.decodeString('$jsonPath.path', json['path']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'path');
|
|
||||||
}
|
|
||||||
String language;
|
|
||||||
if (json.containsKey('language')) {
|
|
||||||
language =
|
|
||||||
jsonDecoder.decodeString('$jsonPath.language', json['language']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'language');
|
|
||||||
}
|
|
||||||
return KytheVName(signature, corpus, root, path, language);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'KytheVName', json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Object> toJson() {
|
|
||||||
var result = <String, Object>{};
|
|
||||||
result['signature'] = signature;
|
|
||||||
result['corpus'] = corpus;
|
|
||||||
result['root'] = root;
|
|
||||||
result['path'] = path;
|
|
||||||
result['language'] = language;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(toJson());
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(other) {
|
|
||||||
if (other is KytheVName) {
|
|
||||||
return signature == other.signature &&
|
|
||||||
corpus == other.corpus &&
|
|
||||||
root == other.root &&
|
|
||||||
path == other.path &&
|
|
||||||
language == other.language;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
signature,
|
|
||||||
corpus,
|
|
||||||
root,
|
|
||||||
path,
|
|
||||||
language,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// LinkedEditGroup
|
/// LinkedEditGroup
|
||||||
///
|
///
|
||||||
/// {
|
/// {
|
||||||
|
|
|
@ -313,10 +313,6 @@ const String FLUTTER_REQUEST_SET_WIDGET_PROPERTY_VALUE_ID = 'id';
|
||||||
const String FLUTTER_REQUEST_SET_WIDGET_PROPERTY_VALUE_VALUE = 'value';
|
const String FLUTTER_REQUEST_SET_WIDGET_PROPERTY_VALUE_VALUE = 'value';
|
||||||
const String FLUTTER_RESPONSE_GET_WIDGET_DESCRIPTION_PROPERTIES = 'properties';
|
const String FLUTTER_RESPONSE_GET_WIDGET_DESCRIPTION_PROPERTIES = 'properties';
|
||||||
const String FLUTTER_RESPONSE_SET_WIDGET_PROPERTY_VALUE_CHANGE = 'change';
|
const String FLUTTER_RESPONSE_SET_WIDGET_PROPERTY_VALUE_CHANGE = 'change';
|
||||||
const String KYTHE_REQUEST_GET_KYTHE_ENTRIES = 'kythe.getKytheEntries';
|
|
||||||
const String KYTHE_REQUEST_GET_KYTHE_ENTRIES_FILE = 'file';
|
|
||||||
const String KYTHE_RESPONSE_GET_KYTHE_ENTRIES_ENTRIES = 'entries';
|
|
||||||
const String KYTHE_RESPONSE_GET_KYTHE_ENTRIES_FILES = 'files';
|
|
||||||
const String SEARCH_NOTIFICATION_RESULTS = 'search.results';
|
const String SEARCH_NOTIFICATION_RESULTS = 'search.results';
|
||||||
const String SEARCH_NOTIFICATION_RESULTS_ID = 'id';
|
const String SEARCH_NOTIFICATION_RESULTS_ID = 'id';
|
||||||
const String SEARCH_NOTIFICATION_RESULTS_IS_LAST = 'isLast';
|
const String SEARCH_NOTIFICATION_RESULTS_IS_LAST = 'isLast';
|
||||||
|
|
|
@ -12941,158 +12941,6 @@ class InlineMethodOptions extends RefactoringOptions {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// kythe.getKytheEntries params
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "file": FilePath
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
class KytheGetKytheEntriesParams implements RequestParams {
|
|
||||||
/// The file containing the code for which the Kythe Entry objects are being
|
|
||||||
/// requested.
|
|
||||||
String file;
|
|
||||||
|
|
||||||
KytheGetKytheEntriesParams(this.file);
|
|
||||||
|
|
||||||
factory KytheGetKytheEntriesParams.fromJson(
|
|
||||||
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
|
|
||||||
json ??= {};
|
|
||||||
if (json is Map) {
|
|
||||||
String file;
|
|
||||||
if (json.containsKey('file')) {
|
|
||||||
file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'file');
|
|
||||||
}
|
|
||||||
return KytheGetKytheEntriesParams(file);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(
|
|
||||||
jsonPath, 'kythe.getKytheEntries params', json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
factory KytheGetKytheEntriesParams.fromRequest(Request request) {
|
|
||||||
return KytheGetKytheEntriesParams.fromJson(
|
|
||||||
RequestDecoder(request), 'params', request.params);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Object> toJson() {
|
|
||||||
var result = <String, Object>{};
|
|
||||||
result['file'] = file;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Request toRequest(String id) {
|
|
||||||
return Request(id, 'kythe.getKytheEntries', toJson());
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(toJson());
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(other) {
|
|
||||||
if (other is KytheGetKytheEntriesParams) {
|
|
||||||
return file == other.file;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => file.hashCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// kythe.getKytheEntries result
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "entries": List<KytheEntry>
|
|
||||||
/// "files": List<FilePath>
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
class KytheGetKytheEntriesResult implements ResponseResult {
|
|
||||||
/// The list of KytheEntry objects for the queried file.
|
|
||||||
List<KytheEntry> entries;
|
|
||||||
|
|
||||||
/// The set of files paths that were required, but not in the file system, to
|
|
||||||
/// give a complete and accurate Kythe graph for the file. This could be due
|
|
||||||
/// to a referenced file that does not exist or generated files not being
|
|
||||||
/// generated or passed before the call to "getKytheEntries".
|
|
||||||
List<String> files;
|
|
||||||
|
|
||||||
KytheGetKytheEntriesResult(this.entries, this.files);
|
|
||||||
|
|
||||||
factory KytheGetKytheEntriesResult.fromJson(
|
|
||||||
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
|
|
||||||
json ??= {};
|
|
||||||
if (json is Map) {
|
|
||||||
List<KytheEntry> entries;
|
|
||||||
if (json.containsKey('entries')) {
|
|
||||||
entries = jsonDecoder.decodeList(
|
|
||||||
'$jsonPath.entries',
|
|
||||||
json['entries'],
|
|
||||||
(String jsonPath, Object? json) =>
|
|
||||||
KytheEntry.fromJson(jsonDecoder, jsonPath, json));
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'entries');
|
|
||||||
}
|
|
||||||
List<String> files;
|
|
||||||
if (json.containsKey('files')) {
|
|
||||||
files = jsonDecoder.decodeList(
|
|
||||||
'$jsonPath.files', json['files'], jsonDecoder.decodeString);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'files');
|
|
||||||
}
|
|
||||||
return KytheGetKytheEntriesResult(entries, files);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(
|
|
||||||
jsonPath, 'kythe.getKytheEntries result', json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
factory KytheGetKytheEntriesResult.fromResponse(Response response) {
|
|
||||||
return KytheGetKytheEntriesResult.fromJson(
|
|
||||||
ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
|
|
||||||
'result',
|
|
||||||
response.result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Object> toJson() {
|
|
||||||
var result = <String, Object>{};
|
|
||||||
result['entries'] =
|
|
||||||
entries.map((KytheEntry value) => value.toJson()).toList();
|
|
||||||
result['files'] = files;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Response toResponse(String id) {
|
|
||||||
return Response(id, result: toJson());
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(toJson());
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(other) {
|
|
||||||
if (other is KytheGetKytheEntriesResult) {
|
|
||||||
return listEqual(
|
|
||||||
entries, other.entries, (KytheEntry a, KytheEntry b) => a == b) &&
|
|
||||||
listEqual(files, other.files, (String a, String b) => a == b);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
Object.hashAll(entries),
|
|
||||||
Object.hashAll(files),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// LibraryPathSet
|
/// LibraryPathSet
|
||||||
///
|
///
|
||||||
/// {
|
/// {
|
||||||
|
@ -13866,7 +13714,6 @@ class RequestError implements HasToJson {
|
||||||
/// GET_ERRORS_INVALID_FILE
|
/// GET_ERRORS_INVALID_FILE
|
||||||
/// GET_FIXES_INVALID_FILE
|
/// GET_FIXES_INVALID_FILE
|
||||||
/// GET_IMPORTED_ELEMENTS_INVALID_FILE
|
/// GET_IMPORTED_ELEMENTS_INVALID_FILE
|
||||||
/// GET_KYTHE_ENTRIES_INVALID_FILE
|
|
||||||
/// GET_NAVIGATION_INVALID_FILE
|
/// GET_NAVIGATION_INVALID_FILE
|
||||||
/// GET_REACHABLE_SOURCES_INVALID_FILE
|
/// GET_REACHABLE_SOURCES_INVALID_FILE
|
||||||
/// GET_SIGNATURE_INVALID_FILE
|
/// GET_SIGNATURE_INVALID_FILE
|
||||||
|
@ -13955,11 +13802,6 @@ class RequestErrorCode implements Enum {
|
||||||
static const RequestErrorCode GET_IMPORTED_ELEMENTS_INVALID_FILE =
|
static const RequestErrorCode GET_IMPORTED_ELEMENTS_INVALID_FILE =
|
||||||
RequestErrorCode._('GET_IMPORTED_ELEMENTS_INVALID_FILE');
|
RequestErrorCode._('GET_IMPORTED_ELEMENTS_INVALID_FILE');
|
||||||
|
|
||||||
/// An "analysis.getKytheEntries" request specified a FilePath that does not
|
|
||||||
/// match a file that is currently subject to analysis.
|
|
||||||
static const RequestErrorCode GET_KYTHE_ENTRIES_INVALID_FILE =
|
|
||||||
RequestErrorCode._('GET_KYTHE_ENTRIES_INVALID_FILE');
|
|
||||||
|
|
||||||
/// An "analysis.getNavigation" request specified a FilePath which does not
|
/// An "analysis.getNavigation" request specified a FilePath which does not
|
||||||
/// match a file currently subject to analysis.
|
/// match a file currently subject to analysis.
|
||||||
static const RequestErrorCode GET_NAVIGATION_INVALID_FILE =
|
static const RequestErrorCode GET_NAVIGATION_INVALID_FILE =
|
||||||
|
@ -14079,7 +13921,6 @@ class RequestErrorCode implements Enum {
|
||||||
GET_ERRORS_INVALID_FILE,
|
GET_ERRORS_INVALID_FILE,
|
||||||
GET_FIXES_INVALID_FILE,
|
GET_FIXES_INVALID_FILE,
|
||||||
GET_IMPORTED_ELEMENTS_INVALID_FILE,
|
GET_IMPORTED_ELEMENTS_INVALID_FILE,
|
||||||
GET_KYTHE_ENTRIES_INVALID_FILE,
|
|
||||||
GET_NAVIGATION_INVALID_FILE,
|
GET_NAVIGATION_INVALID_FILE,
|
||||||
GET_REACHABLE_SOURCES_INVALID_FILE,
|
GET_REACHABLE_SOURCES_INVALID_FILE,
|
||||||
GET_SIGNATURE_INVALID_FILE,
|
GET_SIGNATURE_INVALID_FILE,
|
||||||
|
@ -14135,8 +13976,6 @@ class RequestErrorCode implements Enum {
|
||||||
return GET_FIXES_INVALID_FILE;
|
return GET_FIXES_INVALID_FILE;
|
||||||
case 'GET_IMPORTED_ELEMENTS_INVALID_FILE':
|
case 'GET_IMPORTED_ELEMENTS_INVALID_FILE':
|
||||||
return GET_IMPORTED_ELEMENTS_INVALID_FILE;
|
return GET_IMPORTED_ELEMENTS_INVALID_FILE;
|
||||||
case 'GET_KYTHE_ENTRIES_INVALID_FILE':
|
|
||||||
return GET_KYTHE_ENTRIES_INVALID_FILE;
|
|
||||||
case 'GET_NAVIGATION_INVALID_FILE':
|
case 'GET_NAVIGATION_INVALID_FILE':
|
||||||
return GET_NAVIGATION_INVALID_FILE;
|
return GET_NAVIGATION_INVALID_FILE;
|
||||||
case 'GET_REACHABLE_SOURCES_INVALID_FILE':
|
case 'GET_REACHABLE_SOURCES_INVALID_FILE':
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,86 +0,0 @@
|
||||||
# Providing Kythe Data
|
|
||||||
|
|
||||||
**Note:** Kythe support is experimental and might be removed or changed without
|
|
||||||
notice.
|
|
||||||
|
|
||||||
[Kythe][kythe] is, in their own words, "A pluggable, (mostly) language-agnostic
|
|
||||||
ecosystem for building tools that work with code." The analysis server can be
|
|
||||||
used to produce the data that should be sent to Kythe. In other words, the
|
|
||||||
analysis server is (almost) a Kythe indexer. (The data needs to be converted
|
|
||||||
from a Json representation to a protobuf format before being sent to Kythe.)
|
|
||||||
|
|
||||||
## Implementation details
|
|
||||||
|
|
||||||
When appropriate, the analysis server will send your plugin a
|
|
||||||
`kythe.getKytheEntries` request. The request includes the `file` for which data
|
|
||||||
should be generated. The data consists of a list of `KytheEntry`s.
|
|
||||||
|
|
||||||
When a `kythe.getKytheEntries` request is received, the method
|
|
||||||
`handleKytheGetKytheEntries` will be invoked. This method is responsible for
|
|
||||||
returning a response that contains the entries to be sent to Kythe.
|
|
||||||
|
|
||||||
The easiest way to implement this method is by adding the classes `EntryMixin`
|
|
||||||
and `DartEntryMixin` (from `package:analyzer_plugin/plugin/kythe_mixin.dart`) to
|
|
||||||
the list of mixins for your subclass of `ServerPlugin`. This will leave you with
|
|
||||||
one abstract method that you need to implement: `getEntryContributors`. That
|
|
||||||
method is responsible for returning a list of `EntryContributor`s. It is the
|
|
||||||
entry contributors that produce the actual entries. (Most plugins will only need
|
|
||||||
a single entry contributor.)
|
|
||||||
|
|
||||||
To write an entry contributor, create a class that implements
|
|
||||||
`EntryContributor`. The interface defines a single method named
|
|
||||||
`computeEntries`. The method has two arguments: an `EntryRequest` that describes
|
|
||||||
the file to be indexed and an `EntryCollector` through which entries are to be
|
|
||||||
added.
|
|
||||||
|
|
||||||
If you mix in the class `DartEntryMixin`, then the request will be an instance
|
|
||||||
of `DartEntryRequest`, which also has analysis results.
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
Start by creating a class that implements `EntryContributor`, then implement the
|
|
||||||
method `computeEntries`. This method is typically implemented by creating a
|
|
||||||
visitor (such as an AstVisitor) that can visit the results of the analysis (such
|
|
||||||
as a CompilationUnit) and extract the navigation information from the analysis
|
|
||||||
result.
|
|
||||||
|
|
||||||
For example, your contributor might look something like the following:
|
|
||||||
|
|
||||||
```dart
|
|
||||||
class MyEntryContributor implements EntryContributor {
|
|
||||||
@override
|
|
||||||
void computeEntries(EntryRequest request, EntryCollector collector) {
|
|
||||||
if (request is DartEntryRequest) {
|
|
||||||
EntryVisitor visitor = new EntryVisitor(collector);
|
|
||||||
request.result.unit.accept(visitor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class EntryVisitor extends RecursiveAstVisitor {
|
|
||||||
final EntryCollector collector;
|
|
||||||
|
|
||||||
EntryVisitor(this.collector);
|
|
||||||
|
|
||||||
@override
|
|
||||||
void visitSimpleIdentifier(SimpleIdentifier node) {
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Given a contributor like the one above, you can implement your plugin similar to
|
|
||||||
the following:
|
|
||||||
|
|
||||||
```dart
|
|
||||||
class MyPlugin extends ServerPlugin with EntryMixin, DartEntryMixin {
|
|
||||||
// ...
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<EntryContributor> getEntryContributors(String path) {
|
|
||||||
return <EntryContributor>[new MyEntryContributor()];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
[kythe]: http://kythe.io/
|
|
|
@ -1,56 +0,0 @@
|
||||||
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
||||||
// for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
|
||||||
import 'package:analyzer_plugin/plugin/plugin.dart';
|
|
||||||
import 'package:analyzer_plugin/protocol/protocol.dart';
|
|
||||||
import 'package:analyzer_plugin/protocol/protocol_generated.dart';
|
|
||||||
import 'package:analyzer_plugin/src/utilities/kythe/entries.dart';
|
|
||||||
import 'package:analyzer_plugin/utilities/kythe/entries.dart';
|
|
||||||
|
|
||||||
/// A mixin that can be used when creating a subclass of [ServerPlugin] and
|
|
||||||
/// mixing in [KytheMixin]. This implements the creation of the kythe.getEntries
|
|
||||||
/// request based on the assumption that the driver being created is an
|
|
||||||
/// [AnalysisDriver].
|
|
||||||
///
|
|
||||||
/// Clients may not implement this mixin, but are allowed to use it as a mix-in
|
|
||||||
/// when creating a subclass of [ServerPlugin] that also uses [KytheMixin] as a
|
|
||||||
/// mix-in.
|
|
||||||
mixin DartEntryMixin implements EntryMixin {
|
|
||||||
@override
|
|
||||||
Future<EntryRequest> getEntryRequest(
|
|
||||||
KytheGetKytheEntriesParams parameters) async {
|
|
||||||
var path = parameters.file;
|
|
||||||
var result = await getResolvedUnitResult(path);
|
|
||||||
return DartEntryRequestImpl(resourceProvider, result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A mixin that can be used when creating a subclass of [ServerPlugin] to
|
|
||||||
/// provide most of the implementation for handling kythe.getEntries requests.
|
|
||||||
///
|
|
||||||
/// Clients may not implement this mixin, but are allowed to use it as a mix-in
|
|
||||||
/// when creating a subclass of [ServerPlugin].
|
|
||||||
mixin EntryMixin implements ServerPlugin {
|
|
||||||
/// Return a list containing the entry contributors that should be used to
|
|
||||||
/// create entries for the file with the given [path]
|
|
||||||
List<EntryContributor> getEntryContributors(String path);
|
|
||||||
|
|
||||||
/// Return the entries request that should be passes to the contributors
|
|
||||||
/// returned from [getEntryContributors].
|
|
||||||
///
|
|
||||||
/// Throw a [RequestFailure] if the request could not be created.
|
|
||||||
Future<EntryRequest> getEntryRequest(KytheGetKytheEntriesParams parameters);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<KytheGetKytheEntriesResult> handleKytheGetKytheEntries(
|
|
||||||
KytheGetKytheEntriesParams parameters) async {
|
|
||||||
var path = parameters.file;
|
|
||||||
var request = await getEntryRequest(parameters);
|
|
||||||
var generator = EntryGenerator(getEntryContributors(path));
|
|
||||||
var result = generator.generateGetEntriesResponse(request);
|
|
||||||
result.sendNotifications(channel);
|
|
||||||
return result.result;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -397,14 +397,6 @@ abstract class ServerPlugin {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle a 'kythe.getKytheEntries' request.
|
|
||||||
///
|
|
||||||
/// Throw a [RequestFailure] if the request could not be handled.
|
|
||||||
Future<KytheGetKytheEntriesResult?> handleKytheGetKytheEntries(
|
|
||||||
KytheGetKytheEntriesParams parameters) async {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Handle a 'plugin.shutdown' request. Subclasses can override this method to
|
/// Handle a 'plugin.shutdown' request. Subclasses can override this method to
|
||||||
/// perform any required clean-up, but cannot prevent the plugin from shutting
|
/// perform any required clean-up, but cannot prevent the plugin from shutting
|
||||||
/// down.
|
/// down.
|
||||||
|
@ -575,10 +567,6 @@ abstract class ServerPlugin {
|
||||||
var params = EditGetRefactoringParams.fromRequest(request);
|
var params = EditGetRefactoringParams.fromRequest(request);
|
||||||
result = await handleEditGetRefactoring(params);
|
result = await handleEditGetRefactoring(params);
|
||||||
break;
|
break;
|
||||||
case KYTHE_REQUEST_GET_KYTHE_ENTRIES:
|
|
||||||
var params = KytheGetKytheEntriesParams.fromRequest(request);
|
|
||||||
result = await handleKytheGetKytheEntries(params);
|
|
||||||
break;
|
|
||||||
case PLUGIN_REQUEST_SHUTDOWN:
|
case PLUGIN_REQUEST_SHUTDOWN:
|
||||||
var params = PluginShutdownParams();
|
var params = PluginShutdownParams();
|
||||||
result = await handlePluginShutdown(params);
|
result = await handlePluginShutdown(params);
|
||||||
|
|
|
@ -2492,229 +2492,6 @@ class HighlightRegionType implements Enum {
|
||||||
String toJson() => name;
|
String toJson() => name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// KytheEntry
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "source": KytheVName
|
|
||||||
/// "kind": optional String
|
|
||||||
/// "target": optional KytheVName
|
|
||||||
/// "fact": String
|
|
||||||
/// "value": optional List<int>
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
class KytheEntry implements HasToJson {
|
|
||||||
/// The ticket of the source node.
|
|
||||||
KytheVName source;
|
|
||||||
|
|
||||||
/// An edge label. The schema defines which labels are meaningful.
|
|
||||||
String? kind;
|
|
||||||
|
|
||||||
/// The ticket of the target node.
|
|
||||||
KytheVName? target;
|
|
||||||
|
|
||||||
/// A fact label. The schema defines which fact labels are meaningful.
|
|
||||||
String fact;
|
|
||||||
|
|
||||||
/// The String value of the fact.
|
|
||||||
List<int>? value;
|
|
||||||
|
|
||||||
KytheEntry(this.source, this.fact, {this.kind, this.target, this.value});
|
|
||||||
|
|
||||||
factory KytheEntry.fromJson(
|
|
||||||
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
|
|
||||||
json ??= {};
|
|
||||||
if (json is Map) {
|
|
||||||
KytheVName source;
|
|
||||||
if (json.containsKey('source')) {
|
|
||||||
source = KytheVName.fromJson(
|
|
||||||
jsonDecoder, '$jsonPath.source', json['source']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'source');
|
|
||||||
}
|
|
||||||
String? kind;
|
|
||||||
if (json.containsKey('kind')) {
|
|
||||||
kind = jsonDecoder.decodeString('$jsonPath.kind', json['kind']);
|
|
||||||
}
|
|
||||||
KytheVName? target;
|
|
||||||
if (json.containsKey('target')) {
|
|
||||||
target = KytheVName.fromJson(
|
|
||||||
jsonDecoder, '$jsonPath.target', json['target']);
|
|
||||||
}
|
|
||||||
String fact;
|
|
||||||
if (json.containsKey('fact')) {
|
|
||||||
fact = jsonDecoder.decodeString('$jsonPath.fact', json['fact']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'fact');
|
|
||||||
}
|
|
||||||
List<int>? value;
|
|
||||||
if (json.containsKey('value')) {
|
|
||||||
value = jsonDecoder.decodeList(
|
|
||||||
'$jsonPath.value', json['value'], jsonDecoder.decodeInt);
|
|
||||||
}
|
|
||||||
return KytheEntry(source, fact, kind: kind, target: target, value: value);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'KytheEntry', json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Object> toJson() {
|
|
||||||
var result = <String, Object>{};
|
|
||||||
result['source'] = source.toJson();
|
|
||||||
var kind = this.kind;
|
|
||||||
if (kind != null) {
|
|
||||||
result['kind'] = kind;
|
|
||||||
}
|
|
||||||
var target = this.target;
|
|
||||||
if (target != null) {
|
|
||||||
result['target'] = target.toJson();
|
|
||||||
}
|
|
||||||
result['fact'] = fact;
|
|
||||||
var value = this.value;
|
|
||||||
if (value != null) {
|
|
||||||
result['value'] = value;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(toJson());
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(other) {
|
|
||||||
if (other is KytheEntry) {
|
|
||||||
return source == other.source &&
|
|
||||||
kind == other.kind &&
|
|
||||||
target == other.target &&
|
|
||||||
fact == other.fact &&
|
|
||||||
listEqual(value, other.value, (int a, int b) => a == b);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
source,
|
|
||||||
kind,
|
|
||||||
target,
|
|
||||||
fact,
|
|
||||||
Object.hashAll(value ?? []),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// KytheVName
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "signature": String
|
|
||||||
/// "corpus": String
|
|
||||||
/// "root": String
|
|
||||||
/// "path": String
|
|
||||||
/// "language": String
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
class KytheVName implements HasToJson {
|
|
||||||
/// An opaque signature generated by the analyzer.
|
|
||||||
String signature;
|
|
||||||
|
|
||||||
/// The corpus of source code this KytheVName belongs to. Loosely, a corpus
|
|
||||||
/// is a collection of related files, such as the contents of a given source
|
|
||||||
/// repository.
|
|
||||||
String corpus;
|
|
||||||
|
|
||||||
/// A corpus-specific root label, typically a directory path or project
|
|
||||||
/// identifier, denoting a distinct subset of the corpus. This may also be
|
|
||||||
/// used to designate virtual collections like generated files.
|
|
||||||
String root;
|
|
||||||
|
|
||||||
/// A path-structured label describing the “location” of the named object
|
|
||||||
/// relative to the corpus and the root.
|
|
||||||
String path;
|
|
||||||
|
|
||||||
/// The language this name belongs to.
|
|
||||||
String language;
|
|
||||||
|
|
||||||
KytheVName(this.signature, this.corpus, this.root, this.path, this.language);
|
|
||||||
|
|
||||||
factory KytheVName.fromJson(
|
|
||||||
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
|
|
||||||
json ??= {};
|
|
||||||
if (json is Map) {
|
|
||||||
String signature;
|
|
||||||
if (json.containsKey('signature')) {
|
|
||||||
signature =
|
|
||||||
jsonDecoder.decodeString('$jsonPath.signature', json['signature']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'signature');
|
|
||||||
}
|
|
||||||
String corpus;
|
|
||||||
if (json.containsKey('corpus')) {
|
|
||||||
corpus = jsonDecoder.decodeString('$jsonPath.corpus', json['corpus']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'corpus');
|
|
||||||
}
|
|
||||||
String root;
|
|
||||||
if (json.containsKey('root')) {
|
|
||||||
root = jsonDecoder.decodeString('$jsonPath.root', json['root']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'root');
|
|
||||||
}
|
|
||||||
String path;
|
|
||||||
if (json.containsKey('path')) {
|
|
||||||
path = jsonDecoder.decodeString('$jsonPath.path', json['path']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'path');
|
|
||||||
}
|
|
||||||
String language;
|
|
||||||
if (json.containsKey('language')) {
|
|
||||||
language =
|
|
||||||
jsonDecoder.decodeString('$jsonPath.language', json['language']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'language');
|
|
||||||
}
|
|
||||||
return KytheVName(signature, corpus, root, path, language);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'KytheVName', json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Object> toJson() {
|
|
||||||
var result = <String, Object>{};
|
|
||||||
result['signature'] = signature;
|
|
||||||
result['corpus'] = corpus;
|
|
||||||
result['root'] = root;
|
|
||||||
result['path'] = path;
|
|
||||||
result['language'] = language;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(toJson());
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(other) {
|
|
||||||
if (other is KytheVName) {
|
|
||||||
return signature == other.signature &&
|
|
||||||
corpus == other.corpus &&
|
|
||||||
root == other.root &&
|
|
||||||
path == other.path &&
|
|
||||||
language == other.language;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
signature,
|
|
||||||
corpus,
|
|
||||||
root,
|
|
||||||
path,
|
|
||||||
language,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// LinkedEditGroup
|
/// LinkedEditGroup
|
||||||
///
|
///
|
||||||
/// {
|
/// {
|
||||||
|
|
|
@ -82,10 +82,6 @@ const String EDIT_RESPONSE_GET_REFACTORING_FINAL_PROBLEMS = 'finalProblems';
|
||||||
const String EDIT_RESPONSE_GET_REFACTORING_INITIAL_PROBLEMS = 'initialProblems';
|
const String EDIT_RESPONSE_GET_REFACTORING_INITIAL_PROBLEMS = 'initialProblems';
|
||||||
const String EDIT_RESPONSE_GET_REFACTORING_OPTIONS_PROBLEMS = 'optionsProblems';
|
const String EDIT_RESPONSE_GET_REFACTORING_OPTIONS_PROBLEMS = 'optionsProblems';
|
||||||
const String EDIT_RESPONSE_GET_REFACTORING_POTENTIAL_EDITS = 'potentialEdits';
|
const String EDIT_RESPONSE_GET_REFACTORING_POTENTIAL_EDITS = 'potentialEdits';
|
||||||
const String KYTHE_REQUEST_GET_KYTHE_ENTRIES = 'kythe.getKytheEntries';
|
|
||||||
const String KYTHE_REQUEST_GET_KYTHE_ENTRIES_FILE = 'file';
|
|
||||||
const String KYTHE_RESPONSE_GET_KYTHE_ENTRIES_ENTRIES = 'entries';
|
|
||||||
const String KYTHE_RESPONSE_GET_KYTHE_ENTRIES_FILES = 'files';
|
|
||||||
const String PLUGIN_NOTIFICATION_ERROR = 'plugin.error';
|
const String PLUGIN_NOTIFICATION_ERROR = 'plugin.error';
|
||||||
const String PLUGIN_NOTIFICATION_ERROR_IS_FATAL = 'isFatal';
|
const String PLUGIN_NOTIFICATION_ERROR_IS_FATAL = 'isFatal';
|
||||||
const String PLUGIN_NOTIFICATION_ERROR_MESSAGE = 'message';
|
const String PLUGIN_NOTIFICATION_ERROR_MESSAGE = 'message';
|
||||||
|
|
|
@ -3179,158 +3179,6 @@ class InlineMethodOptions extends RefactoringOptions {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// kythe.getKytheEntries params
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "file": FilePath
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
class KytheGetKytheEntriesParams implements RequestParams {
|
|
||||||
/// The file containing the code for which the Kythe Entry objects are being
|
|
||||||
/// requested.
|
|
||||||
String file;
|
|
||||||
|
|
||||||
KytheGetKytheEntriesParams(this.file);
|
|
||||||
|
|
||||||
factory KytheGetKytheEntriesParams.fromJson(
|
|
||||||
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
|
|
||||||
json ??= {};
|
|
||||||
if (json is Map) {
|
|
||||||
String file;
|
|
||||||
if (json.containsKey('file')) {
|
|
||||||
file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'file');
|
|
||||||
}
|
|
||||||
return KytheGetKytheEntriesParams(file);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(
|
|
||||||
jsonPath, 'kythe.getKytheEntries params', json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
factory KytheGetKytheEntriesParams.fromRequest(Request request) {
|
|
||||||
return KytheGetKytheEntriesParams.fromJson(
|
|
||||||
RequestDecoder(request), 'params', request.params);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Object> toJson() {
|
|
||||||
var result = <String, Object>{};
|
|
||||||
result['file'] = file;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Request toRequest(String id) {
|
|
||||||
return Request(id, 'kythe.getKytheEntries', toJson());
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(toJson());
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(other) {
|
|
||||||
if (other is KytheGetKytheEntriesParams) {
|
|
||||||
return file == other.file;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => file.hashCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// kythe.getKytheEntries result
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "entries": List<KytheEntry>
|
|
||||||
/// "files": List<FilePath>
|
|
||||||
/// }
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
class KytheGetKytheEntriesResult implements ResponseResult {
|
|
||||||
/// The list of KytheEntry objects for the queried file.
|
|
||||||
List<KytheEntry> entries;
|
|
||||||
|
|
||||||
/// The set of files paths that were required, but not in the file system, to
|
|
||||||
/// give a complete and accurate Kythe graph for the file. This could be due
|
|
||||||
/// to a referenced file that does not exist or generated files not being
|
|
||||||
/// generated or passed before the call to "getKytheEntries".
|
|
||||||
List<String> files;
|
|
||||||
|
|
||||||
KytheGetKytheEntriesResult(this.entries, this.files);
|
|
||||||
|
|
||||||
factory KytheGetKytheEntriesResult.fromJson(
|
|
||||||
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
|
|
||||||
json ??= {};
|
|
||||||
if (json is Map) {
|
|
||||||
List<KytheEntry> entries;
|
|
||||||
if (json.containsKey('entries')) {
|
|
||||||
entries = jsonDecoder.decodeList(
|
|
||||||
'$jsonPath.entries',
|
|
||||||
json['entries'],
|
|
||||||
(String jsonPath, Object? json) =>
|
|
||||||
KytheEntry.fromJson(jsonDecoder, jsonPath, json));
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'entries');
|
|
||||||
}
|
|
||||||
List<String> files;
|
|
||||||
if (json.containsKey('files')) {
|
|
||||||
files = jsonDecoder.decodeList(
|
|
||||||
'$jsonPath.files', json['files'], jsonDecoder.decodeString);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(jsonPath, 'files');
|
|
||||||
}
|
|
||||||
return KytheGetKytheEntriesResult(entries, files);
|
|
||||||
} else {
|
|
||||||
throw jsonDecoder.mismatch(
|
|
||||||
jsonPath, 'kythe.getKytheEntries result', json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
factory KytheGetKytheEntriesResult.fromResponse(Response response) {
|
|
||||||
return KytheGetKytheEntriesResult.fromJson(
|
|
||||||
ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
|
|
||||||
'result',
|
|
||||||
response.result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Object> toJson() {
|
|
||||||
var result = <String, Object>{};
|
|
||||||
result['entries'] =
|
|
||||||
entries.map((KytheEntry value) => value.toJson()).toList();
|
|
||||||
result['files'] = files;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Response toResponse(String id, int requestTime) {
|
|
||||||
return Response(id, requestTime, result: toJson());
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(toJson());
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(other) {
|
|
||||||
if (other is KytheGetKytheEntriesResult) {
|
|
||||||
return listEqual(
|
|
||||||
entries, other.entries, (KytheEntry a, KytheEntry b) => a == b) &&
|
|
||||||
listEqual(files, other.files, (String a, String b) => a == b);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
Object.hashAll(entries),
|
|
||||||
Object.hashAll(files),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// moveFile feedback
|
/// moveFile feedback
|
||||||
///
|
///
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
/// Clients may not extend, implement or mix-in this class.
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
||||||
// for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
import 'package:analyzer/dart/analysis/results.dart';
|
|
||||||
import 'package:analyzer/file_system/file_system.dart';
|
|
||||||
import 'package:analyzer_plugin/protocol/protocol_common.dart';
|
|
||||||
import 'package:analyzer_plugin/utilities/kythe/entries.dart';
|
|
||||||
|
|
||||||
/// A concrete implementation of [EntryRequest].
|
|
||||||
class DartEntryRequestImpl implements DartEntryRequest {
|
|
||||||
@override
|
|
||||||
final ResourceProvider resourceProvider;
|
|
||||||
|
|
||||||
@override
|
|
||||||
final ResolvedUnitResult result;
|
|
||||||
|
|
||||||
/// Initialize a newly create request with the given data.
|
|
||||||
DartEntryRequestImpl(this.resourceProvider, this.result);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get path => result.path;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A concrete implementation of [EntryCollector].
|
|
||||||
class EntryCollectorImpl implements EntryCollector {
|
|
||||||
/// A list of entries.
|
|
||||||
final List<KytheEntry> entries = <KytheEntry>[];
|
|
||||||
|
|
||||||
/// A list of paths to files.
|
|
||||||
final List<String> files = <String>[];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void addEntry(KytheEntry entry) {
|
|
||||||
entries.add(entry);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
||||||
// for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
import 'package:analyzer/dart/analysis/results.dart';
|
|
||||||
import 'package:analyzer/file_system/file_system.dart';
|
|
||||||
import 'package:analyzer_plugin/protocol/protocol.dart';
|
|
||||||
import 'package:analyzer_plugin/protocol/protocol_common.dart' show KytheEntry;
|
|
||||||
import 'package:analyzer_plugin/protocol/protocol_generated.dart';
|
|
||||||
import 'package:analyzer_plugin/src/utilities/kythe/entries.dart';
|
|
||||||
import 'package:analyzer_plugin/utilities/generator.dart';
|
|
||||||
|
|
||||||
/// The information about a requested set of entries when computing entries in a
|
|
||||||
/// `.dart` file.
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
abstract class DartEntryRequest implements EntryRequest {
|
|
||||||
/// The analysis result for the file in which the entries are being requested.
|
|
||||||
ResolvedUnitResult get result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An object that [EntryContributor]s use to record entries.
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
abstract class EntryCollector {
|
|
||||||
/// Record a new [entry].
|
|
||||||
void addEntry(KytheEntry entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An object used to produce entries.
|
|
||||||
///
|
|
||||||
/// Clients may implement this class when implementing plugins.
|
|
||||||
abstract class EntryContributor {
|
|
||||||
/// Contribute entries for the file specified by the given [request] into the
|
|
||||||
/// given [collector].
|
|
||||||
void computeEntries(EntryRequest request, EntryCollector collector);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A generator that will generate a 'kythe.getEntries' response.
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
class EntryGenerator {
|
|
||||||
/// The contributors to be used to generate the entries.
|
|
||||||
final List<EntryContributor> contributors;
|
|
||||||
|
|
||||||
/// Initialize a newly created entry generator to use the given
|
|
||||||
/// [contributors].
|
|
||||||
EntryGenerator(this.contributors);
|
|
||||||
|
|
||||||
/// Create a 'kythe.getEntries' response for the file specified by the given
|
|
||||||
/// [request]. If any of the contributors throws an exception, also create a
|
|
||||||
/// non-fatal 'plugin.error' notification.
|
|
||||||
GeneratorResult<KytheGetKytheEntriesResult> generateGetEntriesResponse(
|
|
||||||
EntryRequest request) {
|
|
||||||
var notifications = <Notification>[];
|
|
||||||
var collector = EntryCollectorImpl();
|
|
||||||
for (var contributor in contributors) {
|
|
||||||
try {
|
|
||||||
contributor.computeEntries(request, collector);
|
|
||||||
} catch (exception, stackTrace) {
|
|
||||||
notifications.add(PluginErrorParams(
|
|
||||||
false, exception.toString(), stackTrace.toString())
|
|
||||||
.toNotification());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var result = KytheGetKytheEntriesResult(collector.entries, collector.files);
|
|
||||||
return GeneratorResult(result, notifications);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The information about a requested set of entries.
|
|
||||||
///
|
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
|
||||||
abstract class EntryRequest {
|
|
||||||
/// Return the path of the file in which entries are being requested.
|
|
||||||
String get path;
|
|
||||||
|
|
||||||
/// Return the resource provider associated with this request.
|
|
||||||
ResourceProvider get resourceProvider;
|
|
||||||
}
|
|
|
@ -654,36 +654,6 @@ abstract class IntegrationTestMixin {
|
||||||
return EditGetRefactoringResult.fromJson(decoder, 'result', result);
|
return EditGetRefactoringResult.fromJson(decoder, 'result', result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the list of KytheEntry objects for some file, given the current
|
|
||||||
/// state of the file system populated by "analysis.updateContent".
|
|
||||||
///
|
|
||||||
/// Parameters
|
|
||||||
///
|
|
||||||
/// file: FilePath
|
|
||||||
///
|
|
||||||
/// The file containing the code for which the Kythe Entry objects are
|
|
||||||
/// being requested.
|
|
||||||
///
|
|
||||||
/// Returns
|
|
||||||
///
|
|
||||||
/// entries: List<KytheEntry>
|
|
||||||
///
|
|
||||||
/// The list of KytheEntry objects for the queried file.
|
|
||||||
///
|
|
||||||
/// files: List<FilePath>
|
|
||||||
///
|
|
||||||
/// The set of files paths that were required, but not in the file system,
|
|
||||||
/// to give a complete and accurate Kythe graph for the file. This could be
|
|
||||||
/// due to a referenced file that does not exist or generated files not
|
|
||||||
/// being generated or passed before the call to "getKytheEntries".
|
|
||||||
Future<KytheGetKytheEntriesResult> sendKytheGetKytheEntries(
|
|
||||||
String file) async {
|
|
||||||
var params = KytheGetKytheEntriesParams(file).toJson();
|
|
||||||
var result = await server.send('kythe.getKytheEntries', params);
|
|
||||||
var decoder = ResponseDecoder(null);
|
|
||||||
return KytheGetKytheEntriesResult.fromJson(decoder, 'result', result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Initialize the fields in InttestMixin, and ensure that notifications will
|
/// Initialize the fields in InttestMixin, and ensure that notifications will
|
||||||
/// be handled.
|
/// be handled.
|
||||||
void initializeInttestMixin() {
|
void initializeInttestMixin() {
|
||||||
|
|
|
@ -533,41 +533,6 @@ final Matcher isHighlightRegionType = MatchesEnum('HighlightRegionType', [
|
||||||
'VALID_STRING_ESCAPE'
|
'VALID_STRING_ESCAPE'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/// KytheEntry
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "source": KytheVName
|
|
||||||
/// "kind": optional String
|
|
||||||
/// "target": optional KytheVName
|
|
||||||
/// "fact": String
|
|
||||||
/// "value": optional List<int>
|
|
||||||
/// }
|
|
||||||
final Matcher isKytheEntry = LazyMatcher(() => MatchesJsonObject('KytheEntry', {
|
|
||||||
'source': isKytheVName,
|
|
||||||
'fact': isString
|
|
||||||
}, optionalFields: {
|
|
||||||
'kind': isString,
|
|
||||||
'target': isKytheVName,
|
|
||||||
'value': isListOf(isInt)
|
|
||||||
}));
|
|
||||||
|
|
||||||
/// KytheVName
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "signature": String
|
|
||||||
/// "corpus": String
|
|
||||||
/// "root": String
|
|
||||||
/// "path": String
|
|
||||||
/// "language": String
|
|
||||||
/// }
|
|
||||||
final Matcher isKytheVName = LazyMatcher(() => MatchesJsonObject('KytheVName', {
|
|
||||||
'signature': isString,
|
|
||||||
'corpus': isString,
|
|
||||||
'root': isString,
|
|
||||||
'path': isString,
|
|
||||||
'language': isString
|
|
||||||
}));
|
|
||||||
|
|
||||||
/// LinkedEditGroup
|
/// LinkedEditGroup
|
||||||
///
|
///
|
||||||
/// {
|
/// {
|
||||||
|
@ -1322,24 +1287,6 @@ final Matcher isInlineMethodFeedback = LazyMatcher(() => MatchesJsonObject(
|
||||||
final Matcher isInlineMethodOptions = LazyMatcher(() => MatchesJsonObject(
|
final Matcher isInlineMethodOptions = LazyMatcher(() => MatchesJsonObject(
|
||||||
'inlineMethod options', {'deleteSource': isBool, 'inlineAll': isBool}));
|
'inlineMethod options', {'deleteSource': isBool, 'inlineAll': isBool}));
|
||||||
|
|
||||||
/// kythe.getKytheEntries params
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "file": FilePath
|
|
||||||
/// }
|
|
||||||
final Matcher isKytheGetKytheEntriesParams = LazyMatcher(() =>
|
|
||||||
MatchesJsonObject('kythe.getKytheEntries params', {'file': isFilePath}));
|
|
||||||
|
|
||||||
/// kythe.getKytheEntries result
|
|
||||||
///
|
|
||||||
/// {
|
|
||||||
/// "entries": List<KytheEntry>
|
|
||||||
/// "files": List<FilePath>
|
|
||||||
/// }
|
|
||||||
final Matcher isKytheGetKytheEntriesResult = LazyMatcher(() =>
|
|
||||||
MatchesJsonObject('kythe.getKytheEntries result',
|
|
||||||
{'entries': isListOf(isKytheEntry), 'files': isListOf(isFilePath)}));
|
|
||||||
|
|
||||||
/// moveFile feedback
|
/// moveFile feedback
|
||||||
final Matcher isMoveFileFeedback = isNull;
|
final Matcher isMoveFileFeedback = isNull;
|
||||||
|
|
||||||
|
|
|
@ -1,92 +0,0 @@
|
||||||
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
||||||
// for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
import 'package:analyzer/file_system/file_system.dart';
|
|
||||||
import 'package:analyzer_plugin/plugin/kythe_mixin.dart';
|
|
||||||
import 'package:analyzer_plugin/plugin/plugin.dart';
|
|
||||||
import 'package:analyzer_plugin/protocol/protocol_common.dart';
|
|
||||||
import 'package:analyzer_plugin/protocol/protocol_generated.dart';
|
|
||||||
import 'package:analyzer_plugin/src/utilities/kythe/entries.dart';
|
|
||||||
import 'package:analyzer_plugin/utilities/kythe/entries.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
|
||||||
|
|
||||||
import 'mocks.dart';
|
|
||||||
import 'plugin_test.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
defineReflectiveTests(KytheMixinTest);
|
|
||||||
}
|
|
||||||
|
|
||||||
@reflectiveTest
|
|
||||||
class KytheMixinTest extends AbstractPluginTest {
|
|
||||||
late String packagePath1;
|
|
||||||
late String filePath1;
|
|
||||||
late ContextRoot contextRoot1;
|
|
||||||
|
|
||||||
@override
|
|
||||||
ServerPlugin createPlugin() {
|
|
||||||
return _TestServerPlugin(resourceProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setUp() async {
|
|
||||||
await super.setUp();
|
|
||||||
packagePath1 = convertPath('/package1');
|
|
||||||
filePath1 = join(packagePath1, 'lib', 'test.dart');
|
|
||||||
newFile(filePath1, '');
|
|
||||||
contextRoot1 = ContextRoot(packagePath1, <String>[]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> test_handleEditGetAssists() async {
|
|
||||||
await plugin.handleAnalysisSetContextRoots(
|
|
||||||
AnalysisSetContextRootsParams([contextRoot1]));
|
|
||||||
|
|
||||||
var result = await plugin
|
|
||||||
.handleKytheGetKytheEntries(KytheGetKytheEntriesParams(filePath1));
|
|
||||||
result!;
|
|
||||||
expect(result.entries, hasLength(3));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _TestEntryContributor implements EntryContributor {
|
|
||||||
List<KytheEntry> entries;
|
|
||||||
|
|
||||||
_TestEntryContributor(this.entries);
|
|
||||||
|
|
||||||
@override
|
|
||||||
void computeEntries(EntryRequest request, EntryCollector collector) {
|
|
||||||
for (var entry in entries) {
|
|
||||||
collector.addEntry(entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _TestServerPlugin extends MockServerPlugin with EntryMixin {
|
|
||||||
_TestServerPlugin(ResourceProvider resourceProvider)
|
|
||||||
: super(resourceProvider);
|
|
||||||
|
|
||||||
PrioritizedSourceChange createChange() {
|
|
||||||
return PrioritizedSourceChange(0, SourceChange(''));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<EntryContributor> getEntryContributors(String path) {
|
|
||||||
var vName = KytheVName('', '', '', '', '');
|
|
||||||
return <EntryContributor>[
|
|
||||||
_TestEntryContributor(<KytheEntry>[
|
|
||||||
KytheEntry(vName, '', target: vName),
|
|
||||||
KytheEntry(vName, '', target: vName)
|
|
||||||
]),
|
|
||||||
_TestEntryContributor(<KytheEntry>[KytheEntry(vName, '', target: vName)])
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<EntryRequest> getEntryRequest(
|
|
||||||
KytheGetKytheEntriesParams parameters) async {
|
|
||||||
var result = MockResolvedUnitResult();
|
|
||||||
return DartEntryRequestImpl(resourceProvider, result);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,7 +9,6 @@ import 'completion_mixin_test.dart' as completion_mixin_test;
|
||||||
import 'fix_mixin_test.dart' as fix_mixin_test;
|
import 'fix_mixin_test.dart' as fix_mixin_test;
|
||||||
import 'folding_mixin_test.dart' as folding_mixin_test;
|
import 'folding_mixin_test.dart' as folding_mixin_test;
|
||||||
import 'highlights_mixin_test.dart' as highlights_mixin_test;
|
import 'highlights_mixin_test.dart' as highlights_mixin_test;
|
||||||
import 'kythe_mixin_test.dart' as kythe_mixin_test;
|
|
||||||
import 'navigation_mixin_test.dart' as navigation_mixin_test;
|
import 'navigation_mixin_test.dart' as navigation_mixin_test;
|
||||||
import 'occurrences_mixin_test.dart' as occurrences_mixin_test;
|
import 'occurrences_mixin_test.dart' as occurrences_mixin_test;
|
||||||
import 'outline_mixin_test.dart' as outline_mixin_test;
|
import 'outline_mixin_test.dart' as outline_mixin_test;
|
||||||
|
@ -22,7 +21,6 @@ void main() {
|
||||||
fix_mixin_test.main();
|
fix_mixin_test.main();
|
||||||
folding_mixin_test.main();
|
folding_mixin_test.main();
|
||||||
highlights_mixin_test.main();
|
highlights_mixin_test.main();
|
||||||
kythe_mixin_test.main();
|
|
||||||
navigation_mixin_test.main();
|
navigation_mixin_test.main();
|
||||||
occurrences_mixin_test.main();
|
occurrences_mixin_test.main();
|
||||||
outline_mixin_test.main();
|
outline_mixin_test.main();
|
||||||
|
|
|
@ -913,93 +913,6 @@
|
||||||
</value>
|
</value>
|
||||||
</enum>
|
</enum>
|
||||||
</type>
|
</type>
|
||||||
<type name="KytheEntry">
|
|
||||||
<p>
|
|
||||||
This object matches the format and documentation of the Entry object
|
|
||||||
documented in the
|
|
||||||
<a href="https://kythe.io/docs/kythe-storage.html#_entry">Kythe Storage
|
|
||||||
Model</a>.
|
|
||||||
</p>
|
|
||||||
<object>
|
|
||||||
<field name="source">
|
|
||||||
<ref>KytheVName</ref>
|
|
||||||
<p>
|
|
||||||
The ticket of the source node.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
<field name="kind" optional="true">
|
|
||||||
<ref>String</ref>
|
|
||||||
<p>
|
|
||||||
An edge label. The schema defines which labels are meaningful.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
<field name="target" optional="true">
|
|
||||||
<ref>KytheVName</ref>
|
|
||||||
<p>
|
|
||||||
The ticket of the target node.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
<field name="fact">
|
|
||||||
<ref>String</ref>
|
|
||||||
<p>
|
|
||||||
A fact label. The schema defines which fact labels are meaningful.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
<field name="value" optional="true">
|
|
||||||
<list>
|
|
||||||
<ref>int</ref>
|
|
||||||
</list>
|
|
||||||
<p>
|
|
||||||
The <tt>String</tt> value of the fact.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
</object>
|
|
||||||
</type>
|
|
||||||
<type name="KytheVName">
|
|
||||||
<p>
|
|
||||||
This object matches the format and documentation of the Vector-Name object
|
|
||||||
documented in the
|
|
||||||
<a href="https://kythe.io/docs/kythe-storage.html#_a_id_termvname_a_vector_name_strong_vname_strong">Kythe
|
|
||||||
Storage Model</a>.
|
|
||||||
</p>
|
|
||||||
<object>
|
|
||||||
<field name="signature">
|
|
||||||
<ref>String</ref>
|
|
||||||
<p>
|
|
||||||
An opaque signature generated by the analyzer.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
<field name="corpus">
|
|
||||||
<ref>String</ref>
|
|
||||||
<p>
|
|
||||||
The corpus of source code this <tt>KytheVName</tt> belongs to.
|
|
||||||
Loosely, a corpus is a collection of related files, such as the
|
|
||||||
contents of a given source repository.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
<field name="root">
|
|
||||||
<ref>String</ref>
|
|
||||||
<p>
|
|
||||||
A corpus-specific root label, typically a directory path or project
|
|
||||||
identifier, denoting a distinct subset of the corpus. This may also be
|
|
||||||
used to designate virtual collections like generated files.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
<field name="path">
|
|
||||||
<ref>String</ref>
|
|
||||||
<p>
|
|
||||||
A path-structured label describing the “location” of the named object
|
|
||||||
relative to the corpus and the root.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
<field name="language">
|
|
||||||
<ref>String</ref>
|
|
||||||
<p>
|
|
||||||
The language this name belongs to.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
</object>
|
|
||||||
</type>
|
|
||||||
<type name="LinkedEditGroup">
|
<type name="LinkedEditGroup">
|
||||||
<p>
|
<p>
|
||||||
A collection of positions that should be linked (edited simultaneously)
|
A collection of positions that should be linked (edited simultaneously)
|
||||||
|
|
|
@ -829,48 +829,6 @@
|
||||||
</result>
|
</result>
|
||||||
</request>
|
</request>
|
||||||
</domain>
|
</domain>
|
||||||
<domain name="kythe" experimental="true">
|
|
||||||
<p>
|
|
||||||
The kythe domain contains APIs related to generating Dart content in the
|
|
||||||
<a href="http://kythe.io/">Kythe</a> format.
|
|
||||||
</p>
|
|
||||||
<request method="getKytheEntries">
|
|
||||||
<p>
|
|
||||||
Return the list of <tt>KytheEntry</tt> objects for some file, given the
|
|
||||||
current state of the file system populated by "analysis.updateContent".
|
|
||||||
</p>
|
|
||||||
<params>
|
|
||||||
<field name="file">
|
|
||||||
<ref>FilePath</ref>
|
|
||||||
<p>
|
|
||||||
The file containing the code for which the Kythe Entry objects are
|
|
||||||
being requested.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
</params>
|
|
||||||
<result>
|
|
||||||
<field name="entries">
|
|
||||||
<list>
|
|
||||||
<ref>KytheEntry</ref>
|
|
||||||
</list>
|
|
||||||
<p>
|
|
||||||
The list of <tt>KytheEntry</tt> objects for the queried file.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
<field name="files">
|
|
||||||
<list>
|
|
||||||
<ref>FilePath</ref>
|
|
||||||
</list>
|
|
||||||
<p>
|
|
||||||
The set of files paths that were required, but not in the file system,
|
|
||||||
to give a complete and accurate Kythe graph for the file. This could
|
|
||||||
be due to a referenced file that does not exist or generated files not
|
|
||||||
being generated or passed before the call to "getKytheEntries".
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
</result>
|
|
||||||
</request>
|
|
||||||
</domain>
|
|
||||||
<types>
|
<types>
|
||||||
<h2 class="domain"><a name="types">Types</a></h2>
|
<h2 class="domain"><a name="types">Types</a></h2>
|
||||||
<p>
|
<p>
|
||||||
|
|
Loading…
Reference in a new issue