Commit Graph

153 Commits

Author SHA1 Message Date
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
Brian Wilkerson 464cc509ab Remove one move ignore comment from generated LSP support
Change-Id: I905056f98780f127466caa0ba9e8a5f6d13a7282
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192285
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-22 14:09:23 +00:00
Brian Wilkerson c5d01ec4f7 Remove a couple of ignore-in-file comments and make one more unnecessary in generated code
Change-Id: I8313fe2b4c3908dd5751f7eeca417adfcb2e5790
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192040
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-19 14:44:27 +00:00
Danny Tuppeny 44275c6001 [Analyzer] Add support for LSP experimental SnippetTextEdit
Change-Id: Id37a1954c71fb10c4968c5af6a873ad0ef864a5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191403
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-16 18:40:50 +00:00
Konstantin Shcheglov c8d6f85d0f Enforce lint unnecessary_parenthesis in analysis_server.
Change-Id: Ib68c124988743b45807015e7274f429fff67fe44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189384
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-06 05:20:16 +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 c4edcc4cfa [analyzer] Support separate insert/replace ranges for completions
Fixes https://github.com/Dart-Code/Dart-Code/issues/2998.

Change-Id: I8e989932c16dc97f704c79c06374c8d1d1881f7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186581
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-23 17:43:11 +00:00
Danny Tuppeny e5ed69d04d [Analyzer] Add support for LSP semanticTokens/range
Change-Id: Iebd0a5bfca29b51fe6bb309f71c1ee476d4ed9f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177702
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-01-06 17:50:11 +00:00
Danny Tuppeny cb2ede57b7 [Analyzer] Add LSP support for textDocument/semanticTokens/full
Fixes https://github.com/Dart-Code/Dart-Code/issues/2202 + many more.

Change-Id: Ia2e8ec2415836a77618821144699971e97b4fc5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175722
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-12-14 20:37:29 +00:00
Danny Tuppeny 069a2f83d9 [Analyzer] Add support to LSP server for updating imports on file renames
Fixes https://github.com/Dart-Code/Dart-Code/issues/2761.

Change-Id: I9e4779760a02bc91850c45aa0d0bf261ef922222
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175485
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-12-14 17:06:03 +00:00
Danny Tuppeny 5d2905e8cb [Analyzer] Add a setting to enable sending TODOs as LSP diagnostics
Fixes https://github.com/Dart-Code/Dart-Code/issues/3010.

Change-Id: Id504f46a0c0ff6dc6eb4005e3779714081df8fd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176085
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-12-14 17:05:24 +00:00
Danny Tuppeny f6c6ea5373 [Analyzer] Update to final published version of v3.16.0 of LSP spec
Change-Id: I290b462352fc72b58b2f8f5f8b85464257017b7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176080
Auto-Submit: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-12-14 16:03:59 +00:00
Danny Tuppeny c9f6e51315 [Analyzer] Update to include final LSP v3.16 changes
Change-Id: Icb35324308485e3a40abfcee8550ba10538a935e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-12-10 18:10:47 +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 bb971209d1 [Analyzer] Update to latest version of LSP spec
Change-Id: I16418caeacad044269fd3d79e28b9b800ce798f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174804
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-12-02 20:11:08 +00:00
Danny Tuppeny 2076989667 [Analyzer] Split LSP completion resolution info into base/sub-classes
Change-Id: I57f61b8d0467c32562d865de3b87d75995cfb35f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174129
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-11-27 18:39:05 +00:00
Danny Tuppeny 4fc797d6b1 [Analyzer] Add LSP dart.analysisExcludedFolders to readme
Change-Id: Iaa4cf8f9f2697c6fd3583018566f9201820ead8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173966
Auto-Submit: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-11-25 16:12:27 +00:00
Danny Tuppeny 44e680ac53 [Analyzer] Add LSP support for Format Selection/Range
Fixes https://github.com/Dart-Code/Dart-Code/issues/812.

Change-Id: I099654483f3799344d68640b4d00df88e6bbca01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171722
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-12 16:20:36 +00:00
Danny Tuppeny 8687aa6145 [Analyzer] Add an LSP setting for including parameters in completions
Fixes https://github.com/Dart-Code/Dart-Code/issues/2823.

Change-Id: I477aba5f3563c01a85bb867a1e01f294eed3636e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171585
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-11 19:44:12 +00:00
Sam Rawlins ae466ef7d5 analysis_server: Bump to pedantic 1.9
Change-Id: Iec6c21abe09ecfbd74c4e1b18c0f519c0416467b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163304
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-10-07 13:41:35 +00:00
Danny Tuppeny aa5cb76916 [Analyzer] Make LSP literal types optional in constructors and validate their values
Change-Id: Id6dddd4ed4819a75da4226ee57d73a65c15c9048
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164965
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-30 09:39:22 +00:00
Danny Tuppeny 665a40c675 [Analyzer] Add support for LSP's $/progress statuses for Analyzing status
Change-Id: Ia11d24a4323f2fcc21cb5d36528b89104d5fcb6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164963
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-29 20:03:14 +00:00
Danny Tuppeny 144a4545a0 [Analyzer] Update LSP toJson() functions to call toJson() on child fields
Change-Id: I596af3142ea3f1a279d3d98390cfe7e4d9d90cbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164962
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-29 17:42:47 +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
Mike Fairhurst 1134a0f17c [analysis_server] Remove unused dart:async imports
Change-Id: I764ee78cb9e31bdb3abaa36ca4754e1fed180311
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161447
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-02 17:29:52 +00:00
Danny Tuppeny 61e0098c92 Add custom LSP method to force reanalyze
Change-Id: I7d27654ecb68cf674d6521cd6325256a5fabf86c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157486
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-08-06 14:51:19 +00:00
Danny Tuppeny 6762f2294c Tweak parser to handle LSP 3.16 spec
Change-Id: I53ef27f4b9dc9c4f6a8ff54e116dd3d2a9faf65c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156506
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-30 15:49:28 +00:00
Danny Tuppeny e7f861023c Add dart.lineLength setting to the LSP docs
Change-Id: Ic517979497a0755683a8b5f2335ee75d103b5220
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154327
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-07-14 18:13:30 +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
Danny Tuppeny d86fa966a9 Tweaks to be able to parse v3.15 spec
Change-Id: Ifdb8696246b6893b743754dab5344d5939550a10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153776
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-09 17:18:07 +00:00
Eric Dallo 6d3928554c Add lsp-dart to lsp_spec README
https://emacs-lsp.github.io/lsp-dart

Closes https://github.com/dart-lang/sdk/pull/42514
https://github.com/dart-lang/sdk/pull/42514

GitOrigin-RevId: cfa8edf358669c3ec2324a726a848fbc548bb6a3
Change-Id: Icaa90cdbb462b51fae6c186fe7626ca6168b9599
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152820
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-07-01 13:15:22 +00:00
Danny Tuppeny b2f755ac07 Add a note about passing client-id/client-version to LSP doc
Change-Id: Ic82e5915e512c78c99b963bbaa74aaed42374726
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151506
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-06-17 15:06:54 +00:00
Danny Tuppeny 3b243a0c30 Recurse through lists/maps when generating hash codes in LSP types
Change-Id: I06117fe33c7bfb8553e9930afbf7e3bdc86c6032
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151230
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-06-15 18:09:02 +00:00
Danny Tuppeny f92a7d2669 Add Plugin column to LSP status table
Change-Id: I02d16133b898bdfd1ed781ad4aed7748700f6fb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150027
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-06-04 15:39:37 +00:00
Danny Tuppeny 44c7650a10 Enable/disable and register/unregister LSP formatter based on client settings
Change-Id: Ida81ce80795f79feaaa0e4590c19bc1bc24929a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149591
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-06-02 14:33:51 +00:00
Danny Tuppeny dd7589e5ce Add LSP support for client-side configuration
Change-Id: I27aa706fd29da00d21fc4177cd455d8259cf9339
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149590
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-06-02 14:33:51 +00:00
Danny Tuppeny 7accf5ecfc Improve LSP spec regex to catch didChangeConfiguration method
Change-Id: I8a377bd79b86b59fce0f16c424c372127ff63433
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149584
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-06-02 14:33:51 +00:00
Simon Binder aa529bc684 Support plugin notifications in LSP server
This adds support for analysis domains that plugins contribute to by
sending notifications. I've only implemented folding so far, but most
of this CL is to cache results from plugins and to adapt sending server
capabilities.

Instead of using a NullNotificationManager, the LSP server now uses a
regular NotificationManager, except that results won't be forwarded to
clients. LSP handlers will fetch partial results from plugins and merge
them with data from the server that will be computed when needed.

I've extracted the server capabilities calculation from the init
handlers into ServerCapabilityComputer. It will also contain the
interestingFiles glob from active plugins and re-register capabilities
whenever plugins change.

Change-Id: I9869240cbfa284592e952498933e638b89a2a763
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142981
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-24 20:36:07 +00:00
Danny Tuppeny fad05e89dc Require exact type matches for equality in LSP classes
Change-Id: Ia3f502a315e2c6fbc62eb6fbe3785dad86c782cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142992
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-14 15:47:01 +00:00
Danny Tuppeny 2fbe4d9194 Resolve type aliases when generating LSP equals methods
Change-Id: Iccecfa8dc8d77cb0d4358db1f7fa54607ffaa428
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142991
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-14 15:47:01 +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 7e724e70b0 Sort non-generated files in analyis_server and add a test to ensure they stay that way
Change-Id: I6c7a38cefa69f46737bd50eefe2fbb88c127017b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141520
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-03-28 17:12:03 +00:00
Brian Wilkerson 5d7f3093fd Update the lsp generator to generate return types for all methods
Change-Id: Id1a90d770aa772327011ee8ccc7a13f0ca6f8de4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133961
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-30 21:43:43 +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 32ce9c7872 Enable prefer_collection_literals in three packages
Other than the following changes, all of the changes were made by dartfix:
- the analysis options files
- one line to enable the fix through dartfix (missed in an earlier CL)
- three places where a bug in the fix produced invalid code (issue and fix TBD)

Change-Id: If8660700792561805f4d1c96ccecd81abcebfeb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131209
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-11 20:39:02 +00:00
Sam Rawlins 327b1eb24f analysis_server: Make private fields final where possible
Change-Id: Ibdeb7e66f07bf81205d70ac5d1c4cb4aa5a97671
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-01-08 22:08:02 +00:00
Danny Tuppeny c8c367bb10 Add valueRange field to LSP Flutter Outline attributes
Include range of values in LSP FlutterOutline notifications

Change-Id: I07cbe970d553f793dbdb4cb282807eec12720017
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-01-08 20:10:06 +00:00
Brian Wilkerson 8c6c27541e Disable a lint in the LSP generated code and re-run the generator
Turns out we aren't testing to ensure that the LSP generator has been
run as part of our test suite. Ideally we'd do so and we'd update the
generator to produce code that doesn't violate lints, but that's more
work than I can do today. Hence this stop-gap CL.

Change-Id: Ia9e5a35817fc4d08e2a4b87b9c2ef64725c822b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130004
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-02 04:55:46 +00:00