mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:17:55 +00:00
[analysis_server] Update + test for LSP readme being up-to-date with implemented methods
Change-Id: I4c25da38da937d76c4a1b1c9ba1e6318f16c1046 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333400 Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
parent
988c301109
commit
a18a24c16c
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:analysis_server/src/lsp/handlers/handler_states.dart';
|
||||||
|
import 'package:analysis_server/src/lsp/lsp_analysis_server.dart';
|
||||||
import 'package:path/path.dart' as path;
|
import 'package:path/path.dart' as path;
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
|
@ -37,6 +39,43 @@ void main() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('has implemented methods ticked', () {
|
||||||
|
final readmeContent = readmeFile.readAsStringSync();
|
||||||
|
|
||||||
|
final handlerGenerators = [
|
||||||
|
...InitializedLspStateMessageHandler.lspHandlerGenerators,
|
||||||
|
...InitializedStateMessageHandler.sharedHandlerGenerators,
|
||||||
|
];
|
||||||
|
|
||||||
|
final missingMethods = StringBuffer();
|
||||||
|
for (final generator in handlerGenerators) {
|
||||||
|
final handler = generator(_MockServer());
|
||||||
|
final method = handler.handlesMessage.toString();
|
||||||
|
|
||||||
|
if (method.startsWith('dart')) {
|
||||||
|
// Dart methods are included under their own heading.
|
||||||
|
final expectedHeading = '### $method Method';
|
||||||
|
if (!readmeContent.contains(expectedHeading)) {
|
||||||
|
missingMethods.writeln('$method does not have a section');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Standard methods should be listed in the table and ticked.
|
||||||
|
final escapedMethod = RegExp.escape(method);
|
||||||
|
final expectedMarkdown = RegExp(' $escapedMethod .*\\| ✅ \\|');
|
||||||
|
if (!readmeContent.contains(expectedMarkdown)) {
|
||||||
|
missingMethods.writeln('$method is not listed/ticked in the table');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (missingMethods.isNotEmpty) {
|
||||||
|
fail(
|
||||||
|
'The following are not listed correctly in the README.md file:\n\n'
|
||||||
|
'$missingMethods',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,3 +85,14 @@ String _getAnalysisServerPkgPath() {
|
||||||
final index = components.indexOf('analysis_server');
|
final index = components.indexOf('analysis_server');
|
||||||
return path.joinAll(components.sublist(0, index + 1));
|
return path.joinAll(components.sublist(0, index + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _MockServer implements LspAnalysisServer {
|
||||||
|
@override
|
||||||
|
final initializationOptions = LspInitializationOptions(null);
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get onlyAnalyzeProjectsWithOpenFiles => false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
|
||||||
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ Below is a list of LSP methods and their implementation status.
|
||||||
| textDocument/documentColor | ✅ | | |
|
| textDocument/documentColor | ✅ | | |
|
||||||
| textDocument/colorPresentation | ✅ | | |
|
| textDocument/colorPresentation | ✅ | | |
|
||||||
| textDocument/documentHighlight | ✅ | | |
|
| textDocument/documentHighlight | ✅ | | |
|
||||||
| textDocument/documentLink | | | |
|
| textDocument/documentLink | ✅ | | |
|
||||||
| documentLink/resolve | | | |
|
| documentLink/resolve | | | |
|
||||||
| textDocument/documentSymbol | ✅ | | |
|
| textDocument/documentSymbol | ✅ | | |
|
||||||
| textDocument/foldingRange | ✅ | ✅ | |
|
| textDocument/foldingRange | ✅ | ✅ | |
|
||||||
|
@ -110,9 +110,9 @@ Below is a list of LSP methods and their implementation status.
|
||||||
| callHierarchy/outgoingCalls | ✅ | | |
|
| callHierarchy/outgoingCalls | ✅ | | |
|
||||||
| textDocument/prepareRename | ✅ | | |
|
| textDocument/prepareRename | ✅ | | |
|
||||||
| textDocument/rename | ✅ | | |
|
| textDocument/rename | ✅ | | |
|
||||||
| textDocument/prepareTypeHierarchy | | | |
|
| textDocument/prepareTypeHierarchy | ✅ | | |
|
||||||
| typeHierarchy/subtypes | | | |
|
| typeHierarchy/subtypes | ✅ | | |
|
||||||
| typeHierarchy/supertypes | | | |
|
| typeHierarchy/supertypes | ✅ | | |
|
||||||
| textDocument/publishDiagnostics | ✅ | ✅ | |
|
| textDocument/publishDiagnostics | ✅ | ✅ | |
|
||||||
| textDocument/references | ✅ | | |
|
| textDocument/references | ✅ | | |
|
||||||
| textDocument/selectionRange | ✅ | | |
|
| textDocument/selectionRange | ✅ | | |
|
||||||
|
|
Loading…
Reference in a new issue