Commit Graph

8 Commits

Author SHA1 Message Date
Danny Tuppeny cdcc387084 Add LSP custom notifications for analyzing status
Change-Id: I0d26d274c9ccc472da81e45d0c9170104bbd9414
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102370
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-05-15 06:35:48 +00:00
Danny Tuppeny b7521f5e1b Fix lints not appearing when using LSP Server
Change-Id: Ib3b4396a611be32b91b08d68c962302899a1ad88
Bug: https://github.com/dart-lang/sdk/issues/36931
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-05-13 15:03:30 +00:00
Danny Tuppeny f484e1b05e Call canParse() for all LSP requests before passing to handlers
Any requests with params that don't pass canParse() will result in an InvalidParams error being returned without the handler being invoked.

Change-Id: Ic3e84b9259a467179baa2309fb58ee207f1225fa
Reviewed-on: https://dart-review.googlesource.com/c/94298
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-02-27 08:12:02 +00:00
Danny Tuppeny 73e544ed0b Improve errors when LSP integration tests fail to spawn server
When the server fails to start up (writing to stderr) the tests currently would just hang waiting for responses to messages. This will just throw the message as an exception, failing the test with a more useful message, for example:

```
00:07 +0 -1: ServerTest | test_exit_afterShutdown [E]
  Analysis Server wrote to stderr:

  file:///Users/dantup/Dev/Google/dart-sdk/sdk/third_party/pkg/linter/lib/src/analyzer.dart:106:27: Error: The method 'registerDefault' isn't defined for the class 'Registry'.
   - 'Registry' is from 'package:analyzer/src/lint/registry.dart' ('file:///Users/dantup/Dev/Google/dart-sdk/sdk/pkg/analyzer/lib/src/lint/registry.dart').
  Try correcting the name to the name of an existing method, or defining a method named 'registerDefault'.
      Registry.ruleRegistry.registerDefault(lint);
                            ^^^^^^^^^^^^^^^
```

Change-Id: If64b68b17a0d379f8879891f0346704d4ad360e8

Remove unused imports

Change-Id: I745499f7b038c81320c127410967d939c7756e51
Reviewed-on: https://dart-review.googlesource.com/c/94222
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-02-25 17:13:52 +00:00
Danny Tuppeny 380cec1708 Wait for LSP server to be ready before sending exit command in integration test
Otherwise we'll need to increase the timeout to account for server startup (which will mask if the exit really is taking a longer time than it should).

Change-Id: I5c770efa62dc2a66946fd7a6c07665d3f1b80ee4
Reviewed-on: https://dart-review.googlesource.com/c/94260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-02-25 17:12:57 +00:00
Danny Tuppeny 6af24a2490 Move LSP diagnostic server test -> integration
This tests we can spawn the diagnostic server on-demand. The test was previously marked failing because it needed to be a real inrtegration test.

Change-Id: I52638682d7fb1807584601f7ff933f30b1bd6d70
Reviewed-on: https://dart-review.googlesource.com/c/93949
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-02-25 12:03:58 +00:00
Danny Tuppeny 34614ef995 Exit LSP server with exitCode=1 if there was no shutdown notification
This adds a new server state "shutting down" which rejects requests. The LSP spec says clients should send the shutdown notification, then the exit notification. If an exit notification is received without a shutdown, then the exit code is set to 1.

Change-Id: I50aa186d699a646ee1422f5b3ddaae4bc089b632
Reviewed-on: https://dart-review.googlesource.com/c/93952
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-02-25 11:58:24 +00:00
Danny Tuppeny ba07724b19 Add support for LSP Integration tests w/ basic shutdown test
Change-Id: Ifbd957d1d6b287b083128cda4d7b99b8d50dd56c
Reviewed-on: https://dart-review.googlesource.com/c/90065
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-21 16:06:28 +00:00