Danny Tuppeny
1f0fe212b2
[analyzer] Migrate LSP spec tests to null-safe
...
Change-Id: I988692263486d277017a057768fcae2edeca3889
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195279
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2021-04-15 14:24:37 +00:00
Konstantin Shcheglov
e97f1bdbf0
Switch analysis_server to language 2.12, so null safety, but opt-out files.
...
This should allow doing partial migration, specifically protocol files,
which are imported by other libraries, but are a small library cycle
that does not import much outside of it.
Change-Id: I904c05d6d5b444ee9a9dbd1f7ada12aabdcc5165
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2021-03-30 23:39:37 +00:00
Danny Tuppeny
ff61ff7d33
[analyzer] Call toJson() on items in Lists when generating LSP json
...
Change-Id: I9f5876dc577499ae609079eaecae6a3eb47535d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188288
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2021-03-02 15:24:38 +00:00
Danny Tuppeny
4525525a9d
[Analyzer] Handle parsing v3.16 LSP Spec
...
Change-Id: I6afd5c32673ba580cdf6691bdfa521766f65c3b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158392
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2020-12-09 20:29:30 +00:00
Danny Tuppeny
5aa25f039c
[Analyzer] Handle literal types in LSP spec correctly
...
This ensures canParse() methods correctly handle literal types from the LSP spec instead of allowing any literal of the same type to pass.
Change-Id: I4876f4adc8de1d9138e0f62868aa6a8a010b9102
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162753
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Danny Tuppeny <danny@tuppeny.com >
2020-09-16 15:22:58 +00:00
Danny Tuppeny
c4a2efd6e7
Switch all generated LSP classes to use named constructor arguments
...
Change-Id: I111b58fa5d04314247d5f92650491cdeef6bd4a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153841
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Danny Tuppeny <danny@tuppeny.com >
2020-07-09 17:18:07 +00:00
Danny Tuppeny
6db0396c83
Regenerate code from v3.15 LSP spec
...
Commit v3.15 of LSP spec + regen generated code
Change-Id: Ic0823063791900f347e1ff1f2242a6e4e6ed8ca6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153778
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2020-07-09 17:18:07 +00:00
Brian Wilkerson
8969b1839c
Enable omit_local_variable_types in analysis_server
...
Change-Id: I7e5c13d40fd276854601681fc84be321e6031b10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141583
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2020-03-30 03:58:44 +00:00
Brian Wilkerson
0d3571b52f
Add return types to more methods in analysis_server
...
Change-Id: Ib61c92d65e6170a1b5cd3e3d24affb3a3fa16bb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133760
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2020-01-29 20:18:20 +00:00
Brian Wilkerson
5584c96fde
Enable prefer_single_quotes in analysis_server
...
All of the changes except in the analysis options file are from dartfix.
Change-Id: Icd9bf02ad07f71d1fc365979c7dfe18a792dc595
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132624
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2020-01-21 17:52:52 +00:00
Brian Wilkerson
4043a6fce3
Remove unnecessary uses of new in analysis_server
...
Other than analysis_options.yaml, all of the changes were from running
dartfix.
Change-Id: I92411642f12a00fc6bd0bfd24dd60fe67f0fed16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128845
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2019-12-18 19:01:51 +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
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
01cc5a6305
Ensure unknown fields in LSP payloads are ignored
...
Change-Id: I3f4a2763b2a8714a80108a895c1887b5a36d2a3d
Reviewed-on: https://dart-review.googlesource.com/c/94500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Danny Tuppeny <dantup@google.com >
2019-02-27 15:00:17 +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
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
Brian Wilkerson
47e988b781
Clean up the remaining copyright notices in analysis_server
...
Change-Id: Iee3110f92ab0f24312ddd1eff407d2229f895321
Reviewed-on: https://dart-review.googlesource.com/c/89101
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2019-01-11 15:38:56 +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
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
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
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
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
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
cddc2d42e1
Handle generic types in LSP spec parsing
...
The regex wasn't picking up generate type args (in interface definitions or usages in field definitions). This adds <> characters to the regex and handles them in mapping of types (as well as adds some additional tests to cover this).
Change-Id: I8187b3d2abb2b35c0d7638839e3116700cfbf9e0
Reviewed-on: https://dart-review.googlesource.com/c/81004
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Danny Tuppeny <dantup@google.com >
2018-10-22 14:40:54 +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
3a69805f6b
Switch enums that don't have type aliases to stronger-typed values
...
Change-Id: Ia05c234c27c0c71bbb25ed29c3f7a0c02e938acb
Reviewed-on: https://dart-review.googlesource.com/c/80203
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Danny Tuppeny <dantup@google.com >
2018-10-16 18:03:59 +00:00
Danny Tuppeny
ea72ba3b1d
Move sorting from reading to codegen
...
Change-Id: I060e18851319cf7874a157b99fd019cd07169581
Reviewed-on: https://dart-review.googlesource.com/c/80102
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Danny Tuppeny <dantup@google.com >
2018-10-16 14:40:56 +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