Open stereotype441 opened 3 years ago
I'm not sure who to assign this to--perhaps @bwilkerson?
@devoncarew do you think anyone will have a chance to work on this before the branch cut?
Do we not already have coverage here? This isn't about testing for the presence of the messages in general - that's covered by https://github.com/dart-lang/sdk/issues/45068 and the test.py work (https://github.com/dart-lang/sdk/issues/44905).
This is just to make sure that we're populating the information in the protocol messages to IDEs? @bwilkerson / @DanTup - is this already covered by existing tests?
There's a test in LSP here:
It's not currently testing the specific text/location (it may be worth extending to do that), though it is ensuring there is a relatedInformation
(which is where the context message shows up if I understand correctly).
I don't think we have an "integration" test for the legacy protocol (where "integration" here means end-to-end). We do have tests to ensure that we correctly convert analysis errors from the analyzer
into the protocol object representing analysis errors (https://github.com/dart-lang/sdk/blob/master/pkg/analyzer_plugin/test/utilities/analyzer_converter_test.dart#L98).
@bwilkerson I'm not sure what you mean by "end-to-end", but we do have several tests in pkg/analysis_server/test/integration/
that call themselves integration tests; those are the kinds of tests I was thinking of.
I think it would be an adequate test to make a test similar to pkg/analysis_server/test/integration/analysis/error_test.dart
, but where the error being tested has context information, so that we can make sure that the context information is included in the information the analysis server sends back to its client.
... tests in pkg/analysis_server/test/integration/ that call themselves integration tests ...
Yep, those are what I was talking about as well.
I missed the "integration" part. I've opened https://dart-review.googlesource.com/c/sdk/+/193800/ that adds an LSP integration test that checks the contexts come through (unlike the test I noted above, these spawn the server in another process and then communicate with it exactly as a client would - although the in-process tests for the LSP server exercise essentially the same stack including the full protocol classes, just without the process boundary and using an in-memory filesystem).
(Parent issue #44897)
As of a42244f73b27256eca44def4daa552e91c2dbc55, the analyzer now generates context messages in some circumstances explaining why type promotion failed. We should ensure that we have adequate integration tests to verify that these context messages are being delivered to analysis server clients. We should test both the LSP protocol (used by VSCode) and the legacy protocol (used by IntelliJ).
Related: #44901, #44902.