Commit Graph

21 Commits

Author SHA1 Message Date
Danny Tuppeny 56e5655353 [analyzer] Migrate more LSP tests to null-safety
Change-Id: Iaeb2152d47df05434ab470901900da56cae7e792
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196125
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-20 21:15:28 +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 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 a36f85b5e6 [Analyzer] Generate minimal edits when formatting files using LSP
Fixes https://github.com/Dart-Code/Dart-Code/issues/1626

Change-Id: Id36a86df736ed7d31320abfd2acf1118be3f600b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171590
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-12 16:20:36 +00:00
Danny Tuppeny ba459f96cf Allow dart.lineLength to control formatting for LSP
Noted at https://github.com/Dart-Code/Dart-Code/issues/2286#issuecomment-655762024.

Change-Id: If45bede84a0a4414a16d1809a1aa0f81d18cebfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154008
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-07-13 17:09:59 +00:00
Danny Tuppeny 7de8631a4e Retain original LSP registrations so unregistrations use the same IDs
Change-Id: Ibfce0105e85da65a7cccbc59b918f4845e11d55b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149594
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-06-02 19:39:33 +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 039581df15 Ensure plugin file types are registered for all LSP capabilities
Change-Id: Ic691aa83ae37700502a6d6de26a1b8a92b071287
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149289
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-05-28 17:10:48 +00:00
Brian Wilkerson 58a9c22f80 Add return types to more methods in analysis_server
Change-Id: I65bed353bcff4f991faf8c3bdde979789a8d962b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134000
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-30 21:43:34 +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 f7e288e3ad Return empty responses instead of errors for non-Dart files in LSP server
Previously we could return "invalid path" responses for any non-Dart files. This allows clients to send requests for other files and just successful (though empty) responses.

Change-Id: I192e83ac2ebd2124c03c22e3e048a066cfd33f17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101990
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-05-13 09:04:36 +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 179b96e796 Remove unnecessary awaits in LSP tests
Change-Id: I7a3fb27a43593561b4793514909699d2a09e2f88
Reviewed-on: https://dart-review.googlesource.com/c/85744
Auto-Submit: Danny Tuppeny <dantup@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-12-03 16:32:07 +00:00
Danny Tuppeny fd53d061f0 Implement formatting provider for format-on-type
Change-Id: I2260d7c829b80a638917b98d4b48bec329c3c603
Reviewed-on: https://dart-review.googlesource.com/c/85484
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-11-28 16:34:00 +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 a61e10c7fa Change format tests to manually build an invalid string
This is because on Windows, Uri.file() checks for reserved file characters and we need to force an invalid path to test the server handles it.

Change-Id: Ife7b5e2aa48171e6334ac8a0a993e2ea7ef210a3
Reviewed-on: https://dart-review.googlesource.com/c/85383
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-11-26 15:37:37 +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 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