Commit Graph

87 Commits

Author SHA1 Message Date
Danny Tuppeny 1aa89591e3 Add LSP support for Extract Widget
Change-Id: I0d7068ab48eff2a27a00fad5e821e819c816a253
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106351
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-19 06:56:22 +00:00
Danny Tuppeny 1ba9ed7a35 Improve LSP JSON error when an expected object is not an object
Change-Id: I79632ceca51a5288f9b742f78483a6c2117f58d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105588
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-11 19:07:29 +00:00
Danny Tuppeny 9d5b4491b2 Remove redundant null checks from LSP validation
Change-Id: Ie978b598ecec85455628263d0e3cf2f6f8f71253
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105587
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 19:07:29 +00:00
Danny Tuppeny ca3320e3bd Tweak LSP JSON validation error messages
Change-Id: I732d0020a68256632ee8ba823a0a31eb4a5360d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105586
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 19:07:29 +00:00
Danny Tuppeny 972ea07459 Simplify LSP json error reporter with push/pop fields
Change-Id: I5186eb2de3cf956ada04237ac7ff90fc2d01b79b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105585
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 19:07:29 +00:00
Danny Tuppeny 530a2f5681 Make a null LSP error reporter to avoid so many null checks
Change-Id: I08f9259ba5aca52c61dd6820a3cc54bf40a30c92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105584
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 19:07:29 +00:00
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 a684f2051b Reduce JSON for LSP completions by moving edits to resolve
See https://github.com/dart-lang/sdk/issues/37163.

Change-Id: I336245590560f7b30315a1dbda59ea56e5e9e043
Bug: https://github.com/dart-lang/sdk/issues/37163
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104862
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-05 06:47:51 +00:00
Danny Tuppeny 64a9253763 Add LSP method to fetch super method/class for a position
Change-Id: If8f28a708312113916cc9cecd75e768f7fec393b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104823
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-04 16:05:15 +00:00
Danny Tuppeny 9a3478ac20 Add support + tests for closing labels
Change-Id: I415a352010044d3b4aeb156d9d11dbbd94e86461
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104782
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-04 13:35:57 +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 e4362612b0 Add support for dynamic registration for LSP
Change-Id: I55c7b2f7d683acab0f6aa4bdbcba3b155d2de32c


Change-Id: I6a0b13856053bd86e77637b9664c7fe41194c5f3


Change-Id: I7472cf93efc29585ccbcbd1e6c7b9f703872b3c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103532
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-05-27 17:36:20 +00:00
Danny Tuppeny 022adc5bc3 Implement using suggestion sets for LSP completions
Change-Id: I66d725c09492040be5e621d80270b12a21bb8192
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102704
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-20 10:09:41 +00:00
Danny Tuppeny 0f24e4b277 Wire up LSP completion resolution provider + sendWorkspaceEdit command
Change-Id: I424b4d9bbc64f6fea7a4d9b06e2180b3fbd21f86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102703
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-20 10:09:41 +00:00
Danny Tuppeny 7be23977f1 Minor LSP tweaks in preperation for included suggestionSets
Change-Id: I9dff56139754b8a182e906d64dd0bcc009c4b6fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-20 10:09:41 +00:00
Danny Tuppeny 6805bb52ea Add implementation/tests for textDocument/Implementation
Fixes https://github.com/dart-lang/sdk/issues/36896

Change-Id: Ie450c6c5257ac13aa3c7b48343aa8b015b1dc4d8

Tweak tests to require all, plus fix empty classes

Change-Id: Iefff7e24c6b965f0a1bc5abf8adbac26ad38e3a0

Add implementation/tests for textDocument/Implementation

Change-Id: I640379d83aeb9baa73d04d98d39147e2b748d6c3
Bug: https://github.com/dart-lang/sdk/issues/36896
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102366
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-15 09:08:28 +00:00
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 a779db0813 Update LSP spec to latest
Change-Id: I6f7ff3c6707f992aa618ad172e81857153b75795
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102360
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-13 15:11:15 +00:00
Danny Tuppeny 53438199a4 Tweak version numbers in LSP readme
Change-Id: I9dfa1165d41115ef6f30fd0718c75c058e8c968a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95380
Auto-Submit: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-03-05 18:16:31 +00:00
Danny Tuppeny 0e9d97498c Add some notes on using Dart LSP with Vim
Change-Id: I5b77243e8d725ca9802db56b59692b6e8a847d9c
Reviewed-on: https://dart-review.googlesource.com/c/94207
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-27 12:08:32 +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 0e54ce3b2d Fix a canParse method that would overflow the stack
This method is (accidentally) not currently being called, but it will be soon. The codegen wasn't using the resolved base-type for the enum when writing the type check.

Change-Id: I025ed5109c70d8916f800295350a3f4eaf8f16f2
Reviewed-on: https://dart-review.googlesource.com/c/94294
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-27 08:12:02 +00:00
Danny Tuppeny 8fb52650e5 Ensure LSP canParse type-checks optional values
Previously we were only outputting the validation code if the value was required. This changes it to also validate in the case it's not required, but only if it's not-null.

Without this change, the test that parses `'overwrite': 1` fails (a boolean is expected), but with it, it passes.

Change-Id: Ic4afe1f6a8f78add2385831907b226022b7ecaec
Reviewed-on: https://dart-review.googlesource.com/c/94293
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-27 08:12:02 +00:00
Danny Tuppeny d1876531f2 Fix LSP canParse to allow nulls where the spec allows
Change-Id: I8a34fbf03e45c85a70d44a54b1715b87f84f9c3b
Reviewed-on: https://dart-review.googlesource.com/c/94290
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-27 08:12:02 +00:00
Danny Tuppeny a52ac7d27b Correct LSP canParse functions for classes containing restricted enums
This fixes a mistake where enum classes were resolved to their base types (string, num) before being output in canParse methods of their containing class. This meant for "restricted" enum types (those that should not allow any value), canParse would incorrectly return true for out-of-bound values as long as they were the correct type.

Change-Id: I44e37a60b49287cf7202d5a578ee9c08cf898078
Reviewed-on: https://dart-review.googlesource.com/c/94280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-02-26 07:38:12 +00:00
Danny Tuppeny bf0568c548 Document restrictions on LSP refactors/code fixes
We only provide fixes/refactors/assists to clients that support returning literal CodeActions (not just Commands). CodeActions allow us to return a WorkspaceEdit directly without having to encode the action into a command/argument set that is tround-tripped to the client. Supporting CodeActions on the client is relatively straight forward (since it just removes a round-trip and applies the edit directly).

Change-Id: I7f5a8c22e66ac23bcde6d5782bc2eaa6aeb283da
Reviewed-on: https://dart-review.googlesource.com/c/94221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-02-25 17:45:34 +00:00
Danny Tuppeny 1e60ddbc5b Make more LSP enum classes support "any value"
Previously we assumed enum classes could only be the values specified in the spec, but this was not correct - newer clients may know about values that we did not know about at the time we shipped(/last regenerated).

This makes the default for an enum class to support any class (avoiding deserialisation failures when new clients send newer values), and opts-out for those where the spec is explicit that the value set is fixed.

Also opened https://github.com/Microsoft/language-server-protocol/issues/686 for clarification that these "fixed set" values are explicitly intended to never be extended, or whether this is accidental.

Change-Id: I6243fc91c14ec0fa5622d3f6f29bf77cadf7da64
Reviewed-on: https://dart-review.googlesource.com/c/94220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-02-25 17:05:47 +00:00
Danny Tuppeny b88d11a9bd Implement LSP workspace/symbol
Change-Id: I4303a146dce9a5a4b40345f7ea8ef8355163337b
Reviewed-on: https://dart-review.googlesource.com/c/92602
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-11 19:32:52 +00:00
Danny Tuppeny 16bcfbb104 Add deprecated_member_use_from_same_package to generated LSP ignores
Change-Id: I553dee00f08b8d84c4ba71ffb9dffbe1b262192c
Reviewed-on: https://dart-review.googlesource.com/c/90244
Auto-Submit: Danny Tuppeny <dantup@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-19 18:14:58 +00:00
Danny Tuppeny 17a439633d Add a custom LSP method dart/diagnosticServer to start server/return port
Change-Id: I9d9be244251099c947b2998f0a45ec29ef29ad83
Reviewed-on: https://dart-review.googlesource.com/c/90012
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-17 16:37:49 +00:00
Danny Tuppeny 7e05c2cd62 Add ability to generate custom classes for custom LSP methods
Change-Id: Ie613a828fd6d92133e3d5cb53673c37734fb6eec
Reviewed-on: https://dart-review.googlesource.com/c/90011
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-17 16:37:49 +00:00
Danny Tuppeny c5bfccc6fb Make downloading the LSP spec a flag and commit the version parsed locally
Change-Id: Ib46be800dcfe3369bcc9a222d1097ae4a0efdff6

Ensure licence/attribution is included in our copy of the spec

Change-Id: I48efdb6dad5c2ba04eb18cd397fc44f678a9a7f5
Reviewed-on: https://dart-review.googlesource.com/c/89533
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-16 17:20:54 +00:00
Danny Tuppeny dbeec3bbf3 Fix formatting in generated LSP file header
Change-Id: I1447a4250ab0e8c8fcd26a85ff5949c587a6a77f
Reviewed-on: https://dart-review.googlesource.com/c/89517
Commit-Queue: Danny Tuppeny <dantup@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-16 17:04:43 +00:00
Danny Tuppeny bfe15d87d8 Fix LSP exceptions serializing ResponseErrors with Uris
The ResponseError.data field was typed `dynamic` (as in the LSP spec) but this allows us to accidentally put non-serializable classes in it which will result in server errors when we try to send them back.

This change forces them to Strings and it's up to the code constructing the error to convert any additional data to a string first.

In order to catch this in tests, the mocks now force serialisation of all types flowing from the server to the client (this already happened for client to server).

Change-Id: I5d7f322e1a4296b1479468e36d81daebdbb4ab52
Reviewed-on: https://dart-review.googlesource.com/c/89511
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-16 16:57:43 +00:00
Danny Tuppeny 5ce5d697da Implement LSP code folding
Change-Id: I2b076b1792c229cbbce610d7a195fa03eb29e6bd
Reviewed-on: https://dart-review.googlesource.com/c/89503
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-16 16:03:23 +00:00
Danny Tuppeny ff5e5b6896 Regenerate LSP classes from spec + update README
The README was missing some methods (recent additions?) and also not quite in the same order - this fixes that. Also re-generates the classes based on current spec (mostly comments updates, but also non-nullability for `targetSelectionRange`.

Change-Id: I0dd4e24daf51b659783058362339550ec46fa1c8
Reviewed-on: https://dart-review.googlesource.com/c/89641
Commit-Queue: Danny Tuppeny <dantup@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-15 16:51:19 +00:00
Danny Tuppeny 61e81217f0 Update LSP status doc (rename is complete + tested in VS Code)
Change-Id: Ifce985123efcfec658218c3a4fbe4b6a2102b0bc
Reviewed-on: https://dart-review.googlesource.com/c/89544
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-15 15:10:42 +00:00
Danny Tuppeny 8cddcd20cd Handle deserialising sub-classes in the super-classes fromJson
Change-Id: Ib9048cf674ad77711401e77e20e6dd8bc7e28e00
Reviewed-on: https://dart-review.googlesource.com/c/89363
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-14 18:35:27 +00:00
Danny Tuppeny 28fe86d70f Add implementation/tests for LSP rename
Change-Id: I28e45cb7c979edb3d64b17e86ad0e03b7cd746cd
Reviewed-on: https://dart-review.googlesource.com/c/89361
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-14 18:12:47 +00:00
Danny Tuppeny 4f160558b3 Extract inline interfaces from results definitions in LSP spec
Change-Id: I8661c7af628f0e3125db0613149bbcbc9f27bbe6
Reviewed-on: https://dart-review.googlesource.com/c/89301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-14 15:04:13 +00:00
Danny Tuppeny 4a80990758 Implement LSP textDocument/documentHighlight
Change-Id: Iaa63791192e274a7ef8f2f4095e2984b27d95e05
Reviewed-on: https://dart-review.googlesource.com/c/88962
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-10 15:02:11 +00:00
Danny Tuppeny 44449e29d2 Add a custom toJson snippet for LSP ResponseMessage for null handling
This adds some custom code for serialising ResponseMessage to ensure that only one of result or error are ever specified, as required by JSON RPC.

Change-Id: I2736b83755553a906264b1e5251d1a535dc289fb
Reviewed-on: https://dart-review.googlesource.com/c/88953
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-10 14:46:30 +00:00
Danny Tuppeny 7e0d65706f Include null in allowed types for any and prefer null to omitting values if allowed
Without this, some requests that don't return values (like shutdown) would omit the `result` field from the response and this wasn't strictly correct (and caused an issue in testing with the VIM plugin).

Change-Id: Id961135d326b997aea69e29d9d2a4a2c310fa60c
Reviewed-on: https://dart-review.googlesource.com/c/88839
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-10 14:46:30 +00:00
Danny Tuppeny 54fffe4cca Add support for LSP workspace/didChangeWorkspaceFolders
Change-Id: I55401d0abf65979fcd446b2ba1e8d9b6c09a42fc
Reviewed-on: https://dart-review.googlesource.com/c/88831
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-09 16:04:12 +00:00
Danny Tuppeny f54ac41ce1 Ensure LSP server advertises it has QuickFixes
Also ensure we only return a bool for code action capabilities if the client doesn't support code action literals.

Change-Id: I277fc406ecdee6b0ee1c284f283cd3cb64fb5bdb
Reviewed-on: https://dart-review.googlesource.com/c/88721
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-08 17:22:21 +00:00
Danny Tuppeny 1ec1a8b46e Update LSP status doc
Change-Id: I8143fb3adae5917cda8ed03088c1187f487c15a7
Reviewed-on: https://dart-review.googlesource.com/c/88720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-08 15:26:05 +00:00
Danny Tuppeny c7e7cbddca Remove workaround for LSP spec issue
+ regen the file, which updated comments that were improved in the spec since the last time.

Change-Id: Ib46cabcbc6e22d778847891f309f9be5e354720c
Reviewed-on: https://dart-review.googlesource.com/c/87580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-12-18 14:30:03 +00:00
Danny Tuppeny ecccc0d94e Fix some LSP TODOs, remove some redundant code, add comments
Change-Id: Ibd51b17919245f4215fa49a64fd008ba268ca174
Reviewed-on: https://dart-review.googlesource.com/c/87442
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-12-18 07:33:35 +00:00
Danny Tuppeny 666eee40c7 Updates to pase tuples in LSP spec
Change-Id: Ia1ce7579e954a8000b3460445859a2d221cf1a8c
Reviewed-on: https://dart-review.googlesource.com/c/87441
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-12-17 17:58:17 +00:00
Danny Tuppeny b44f21e691 Add assists to LSP Code Actions
Change-Id: Ic3762513fa55deee394b74da78ee79a23c8c0493
Reviewed-on: https://dart-review.googlesource.com/c/87070
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-12-12 17:59:03 +00:00