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
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
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
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
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
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
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
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
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
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
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
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
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
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
8ae255d876
Improve regex for extracting request constants from LSP spec
...
Some requests have additional newlines, so this change allows any number instead of exactly one.
Change-Id: Ie32b525b9b834223f91cd6339f6932fb02007c78
Reviewed-on: https://dart-review.googlesource.com/c/87060
Auto-Submit: Danny Tuppeny <dantup@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2018-12-12 15:00:22 +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
af40a7e2d7
Improve regex to extract LSP request/notification methods
...
Change-Id: Ib4c0f1819155f1563ba3eeaafdcb3f5661064bf7
Reviewed-on: https://dart-review.googlesource.com/c/85947
Auto-Submit: Danny Tuppeny <dantup@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2018-12-04 16:14:30 +00:00
Danny Tuppeny
2dbf91ff13
Add support for parsing Maps from the LSP spec
...
Change-Id: Ieafcacb3ba2f6be8d3232025d22fa5ec94de5352
Reviewed-on: https://dart-review.googlesource.com/c/85768
Commit-Queue: Danny Tuppeny <dantup@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2018-12-04 14:27:19 +00:00
Danny Tuppeny
0a7cf2a513
Allow nulls for union values where the field can be null or undefined
...
Change-Id: If0fea932c1534e8a6a151e67b16ad78cb14ec98d
Reviewed-on: https://dart-review.googlesource.com/c/85743
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Danny Tuppeny <dantup@google.com >
2018-12-03 16:34:16 +00:00
Danny Tuppeny
a354fd99a8
Add LSP support for flat symbol lists for older clients
...
Change-Id: Id74b34ea295a6733b374a820c6d596a11070f666
Reviewed-on: https://dart-review.googlesource.com/c/85561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Danny Tuppeny <dantup@google.com >
2018-11-29 16:37:38 +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
854c654c2d
Fix LSP enum classes to use correct base types for value field
...
Change-Id: If7a009e37a6ff6b266de15b4c4949921e67fa3d9
Reviewed-on: https://dart-review.googlesource.com/c/85387
Commit-Queue: Danny Tuppeny <dantup@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2018-11-27 10:25:35 +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
7f40d90544
Respect content formats when creating markup content
...
Change-Id: I7e76607d467887a8bcd58e89d70f91b3335f5f90
Reviewed-on: https://dart-review.googlesource.com/c/85165
Commit-Queue: Danny Tuppeny <dantup@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2018-11-26 10:35:17 +00:00
Danny Tuppeny
3cedae6f09
Change diagnostic.code to a simple String
...
Change-Id: Ieb23cda7c6f2c1dffb2e07e47dfe29ddc78f41de
Reviewed-on: https://dart-review.googlesource.com/c/85174
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Danny Tuppeny <dantup@google.com >
2018-11-22 17:54:12 +00:00