Commit Graph

23 Commits

Author SHA1 Message Date
Danny Tuppeny 9fb2842fce Improve the error messages reported in LSP when params are not valid
Change-Id: I305955a22d687e8338138db48dff4e32589bbc6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 19:07:29 +00:00
Danny Tuppeny fca2c82be0 Add support for cancelling requests in LSP server
Change-Id: I2a651b1e4f8509c7f10d245b2369aab842d08041
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103845
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-29 14:52:40 +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
Brian Wilkerson b84bfcce80 Remove some dead code from the analysis_server lsp support
Change-Id: I14478048d665204ce48ff8268fc3e47929867eb4
Reviewed-on: https://dart-review.googlesource.com/c/88166
Reviewed-by: Danny Tuppeny <dantup@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-01-02 14:30:44 +00:00
Danny Tuppeny 7d0823a97c Advertise the commands/code actions we support to the client
Change-Id: I08064742f6591a702955408f023b2534bd7a2887
Reviewed-on: https://dart-review.googlesource.com/c/86883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-12-11 15:13:57 +00:00
Danny Tuppeny e4df0c2fd8 Add implementation+tests for LSP "Sort Members" code action
Change-Id: I671e5bba62e396d797926134123b141ad34d80a5
Reviewed-on: https://dart-review.googlesource.com/c/86422
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-12-10 08:45:00 +00:00
Danny Tuppeny 98fcc8e8dd Set up a new CommandHandler that can delegate to individual commands handlers
Change-Id: I7c288dc14b911306688e66eeca4768cb2ee3629e
Reviewed-on: https://dart-review.googlesource.com/c/86383
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-12-06 17:25:56 +00:00
Danny Tuppeny d8d8e222aa Support returning code actions for SortMembers/OrganizeUsings
Change-Id: I2f80ec0bd7174a8c0943352b942478a360f16b36
Reviewed-on: https://dart-review.googlesource.com/c/86359
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-12-06 16:22:41 +00:00
Danny Tuppeny ff04743cdb Return errors instead of throwing
Change-Id: I5f24751ac71277cc906feeda4ab9a47b7186c82c
Reviewed-on: https://dart-review.googlesource.com/c/85393
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-28 15:46:24 +00:00
Danny Tuppeny be6593e5c6 Reduce params type from Either2<List<dynamic>, dynamic> to just dynamic
Nothing in the LSP spec supports arrays as params (let alone a union of a single item or array).

Since the new type is dynamic, this should be non-breaking even if LSP changes (though we'll want to put it back if we need to write a handler for something that accepts a union like this).

Change-Id: Id1af1d438fede94906ae76eaa8b9a959b0b62ccf
Reviewed-on: https://dart-review.googlesource.com/c/85396
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-28 08:20:07 +00:00
Danny Tuppeny 1c1539a9f7 Add tests that all requests work for unopen files
And fix formatter to work with unopen files rather than rejecting with an error.

Change-Id: I27dbf830330beba371c4bc4bdb6ece0bf63cab33
Reviewed-on: https://dart-review.googlesource.com/c/85397
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-11-28 07:20:32 +00:00
Danny Tuppeny 285f7ddb1b Switch to using constants for LSP method names
Change-Id: I4fd1b4e192ec1d0e53a4b3d81e5fdb8c1bb40208
Reviewed-on: https://dart-review.googlesource.com/c/85380
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-26 17:01:29 +00:00
Danny Tuppeny 8fa1e010c4 Validate paths and offsets for all requests
Change-Id: I72ede118b825debc6a16ec227b5116aa2fc73a8e
Reviewed-on: https://dart-review.googlesource.com/c/85162
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-26 11:39:30 +00:00
Danny Tuppeny 6f2fad87d9 Improve handling of errors
Don't send raw errors in showMessage, send a generic message and put the rest in a log (this is to stop dart exceptions being shown unexpectedly in error popups in the editor).

Change-Id: Ie919d0efe098dfde5de1e25cb8718d37b22f9673
Reviewed-on: https://dart-review.googlesource.com/c/84906
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-21 08:26:30 +00:00
Danny Tuppeny fa800e270c Run "sort members" on LSP files
Change-Id: I166ad41b3f9dd84f664daf82e1eb38524be3ffdd
Reviewed-on: https://dart-review.googlesource.com/c/84200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-11-13 18:08:46 +00:00
Danny Tuppeny 3583065b27 Implement basic document formatting & update capabilities
Change-Id: Iabc29423fe71f99e8dcbc1bde7e3d3a9055f18da
Reviewed-on: https://dart-review.googlesource.com/c/83761
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-11-08 19:49:08 +00:00
Danny Tuppeny d5e853e0ce Improve parsing of LSP spec
Change-Id: Ica48b57c890105df346c5a133fe0389bd92dbb6e
Reviewed-on: https://dart-review.googlesource.com/c/83388
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-08 15:31:26 +00:00
Danny Tuppeny 04777b58cc Add analysis (publishDiagnostics) and handling of opening/editing/closing files
Change-Id: I6dadf125b1a71c4f321f4ab9a01ff2bbfcbd1d4a
Reviewed-on: https://dart-review.googlesource.com/c/82500
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-08 08:52:48 +00:00
Danny Tuppeny 8852d36315 Add --lsp flag to analysis server and add basic Initialize handler
Change-Id: Iaf6c2a7cd56dea27233c4be1df2da900653e1822
Reviewed-on: https://dart-review.googlesource.com/c/81275
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-31 20:00:51 +00:00
Danny Tuppeny a394e4f492 Fix handling of JSON with interfaces nested within Unions
Change-Id: I926c2374860824db3ceae6d74286474feb730676
Reviewed-on: https://dart-review.googlesource.com/c/81100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-10-23 07:08:44 +00:00
Danny Tuppeny 36551624e1 Implement fromJson() constructors for LSP types
Also add a canParse() method that can check whether some provided JSON can be decoded into that type (used for detecting with type from a union to decode as).
Support equality checks on unions and a valueEquals() helper
Remove brittle tests that do exact comparisons on generated code
Fix deserialisation of lists to be cast and toList()'d
Add a more complete JSON test that includes lists, enums

Change-Id: Id56fdad9b1454e540e55907e0ff2608263a87c40
Reviewed-on: https://dart-review.googlesource.com/c/80580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-10-18 13:52:59 +00:00
Danny Tuppeny 2084c5b2a9 Add toJson() methods
Change-Id: If5ffe3743c93100e012a2463fee3db37ab7d513d
Reviewed-on: https://dart-review.googlesource.com/c/79721
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-16 06:58:56 +00:00
Danny Tuppeny 2989116219 Add some special cases for types we can't/don't need to parse
Includes a fabricated base type for file operations to avoid a List of a Union.

Change-Id: I0ddc7c6428cc8f1535c3a8d7d0b042b1725969f3
Reviewed-on: https://dart-review.googlesource.com/c/79323
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-11 17:51:10 +00:00