Skip to content

Commit 6cfac55

Browse files
authored
Regenerate for 1.34.0 spec (#68)
* Regenerate for 1.34.0 spec * Prepare for 0.2.5 release
1 parent 0bad648 commit 6cfac55

File tree

6 files changed

+259
-25
lines changed

6 files changed

+259
-25
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.2.5
2+
3+
- Update to the `1.34.0` version of the analysis server spec.
4+
15
# 0.2.4
26

37
- Update to the `1.33.4` version of the analysis server spec.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ changing.
1515

1616
Clients (typically tools, such as an editor) are expected to run the analysis server in a separate
1717
process and communicate with it over a JSON protocol. The protocol is specified
18-
[here](https://htmlpreview.github.io/?https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/doc/api.html).
18+
[here](https://htmlpreview.github.io/?https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/doc/api.html).
1919

2020
Here's a simple example of starting and communicating with the server:
2121

lib/analysis_server_lib.dart

Lines changed: 70 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const String experimental = 'experimental';
2323

2424
final Logger _logger = new Logger('analysis_server');
2525

26-
const String generatedProtocolVersion = '1.33.4';
26+
const String generatedProtocolVersion = '1.34.0';
2727

2828
typedef MethodSend = void Function(String methodName);
2929

@@ -367,6 +367,45 @@ class ServerDomain extends Domain {
367367
/// may be incomplete or inaccurate. This request always completes without
368368
/// error regardless of whether the request is successfully cancelled.
369369
Future cancelRequest(String id) => _call('server.cancelRequest', {'id': id});
370+
371+
/// Record the capabilities supported by the client. The default values,
372+
/// documented below, will be assumed until this request is received.
373+
Future setClientCapabilities(List<String> requests) =>
374+
_call('server.setClientCapabilities', {'requests': requests});
375+
376+
/// **Note:** This is a request from the server to the client.
377+
///
378+
/// Request that a URL be opened.
379+
///
380+
/// The client is expected to open the URL, either within the client's UI or
381+
/// in the default browser.
382+
///
383+
/// The request will only be sent from the server to the client if the client
384+
/// has indicated that it supports this request by using the
385+
/// `setClientCapabilities` request.
386+
Future openUrlRequest(String url) =>
387+
_call('server.openUrlRequest', {'url': url});
388+
389+
/// **Note:** This is a request from the server to the client.
390+
///
391+
/// Request that a message be displayed to the user.
392+
///
393+
/// The client is expected to display the message to the user with one or more
394+
/// buttons with the specified labels, and to return a response consisting of
395+
/// the label of the button that was clicked.
396+
///
397+
/// The request will only be sent from the server to the client if the client
398+
/// has indicated that it supports this request by using the
399+
/// `setClientCapabilities` request.
400+
///
401+
/// This request is modeled after the ( same request from the LSP
402+
/// specification)[https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#window_showMessageRequest].
403+
Future<ShowMessageRequestResult> showMessageRequest(
404+
String? type, String? message, List<MessageAction>? actions) {
405+
final Map m = {'type': type, 'message': message, 'actions': actions};
406+
return _call('server.showMessageRequest', m)
407+
.then(ShowMessageRequestResult.parse);
408+
}
370409
}
371410

372411
class ServerConnected {
@@ -433,6 +472,18 @@ class VersionResult {
433472
VersionResult(this.version);
434473
}
435474

475+
class ShowMessageRequestResult {
476+
static ShowMessageRequestResult parse(Map m) =>
477+
new ShowMessageRequestResult(action: m['action']);
478+
479+
/// The label of the action that was selected by the user. May be omitted or
480+
/// `null` if the user dismissed the message without clicking an action
481+
/// button.
482+
final String? action;
483+
484+
ShowMessageRequestResult({this.action});
485+
}
486+
436487
// analysis domain
437488

438489
/// The analysis domain contains API's related to the analysis of files.
@@ -1248,7 +1299,7 @@ class CompletionResults {
12481299

12491300
/// The client is expected to check this list against the `ElementKind` sent
12501301
/// in `IncludedSuggestionSet` to decide whether or not these symbols should
1251-
/// should be presented to the user.
1302+
/// be presented to the user.
12521303
final List<String>? includedElementKinds;
12531304

12541305
/// The client is expected to check this list against the values of the field
@@ -2526,7 +2577,6 @@ class AnalysisOptions implements Jsonable {
25262577
enableDeferredLoading: m['enableDeferredLoading'],
25272578
enableEnums: m['enableEnums'],
25282579
enableNullAwareOperators: m['enableNullAwareOperators'],
2529-
enableSuperMixins: m['enableSuperMixins'],
25302580
generateDart2jsHints: m['generateDart2jsHints'],
25312581
generateHints: m['generateHints'],
25322582
generateLints: m['generateLints']);
@@ -2558,10 +2608,6 @@ class AnalysisOptions implements Jsonable {
25582608
@deprecated
25592609
final bool? enableNullAwareOperators;
25602610

2561-
/// True if the client wants to enable support for the proposed "less
2562-
/// restricted mixins" proposal (DEP 34).
2563-
final bool? enableSuperMixins;
2564-
25652611
/// True if hints that are specific to dart2js should be generated. This
25662612
/// option is ignored if generateHints is false.
25672613
final bool? generateDart2jsHints;
@@ -2579,7 +2625,6 @@ class AnalysisOptions implements Jsonable {
25792625
this.enableDeferredLoading,
25802626
this.enableEnums,
25812627
this.enableNullAwareOperators,
2582-
this.enableSuperMixins,
25832628
this.generateDart2jsHints,
25842629
this.generateHints,
25852630
this.generateLints});
@@ -2589,7 +2634,6 @@ class AnalysisOptions implements Jsonable {
25892634
'enableDeferredLoading': enableDeferredLoading,
25902635
'enableEnums': enableEnums,
25912636
'enableNullAwareOperators': enableNullAwareOperators,
2592-
'enableSuperMixins': enableSuperMixins,
25932637
'generateDart2jsHints': generateDart2jsHints,
25942638
'generateHints': generateHints,
25952639
'generateLints': generateLints
@@ -3910,6 +3954,22 @@ class Location implements Jsonable {
39103954
'[Location file: ${file}, offset: ${offset}, length: ${length}, startLine: ${startLine}, startColumn: ${startColumn}]';
39113955
}
39123956

3957+
/// An action associated with a message that the server is requesting the client
3958+
/// to display to the user.
3959+
class MessageAction implements Jsonable {
3960+
static MessageAction parse(Map m) {
3961+
return new MessageAction(m['label']);
3962+
}
3963+
3964+
/// The label of the button to be displayed, and the value to be returned to
3965+
/// the server if the button is clicked.
3966+
final String label;
3967+
3968+
MessageAction(this.label);
3969+
3970+
Map toMap() => _stripNullValues({'label': label});
3971+
}
3972+
39133973
/// A description of a region from which the user can navigate to the
39143974
/// declaration of an element.
39153975
class NavigationRegion {
@@ -4521,7 +4581,7 @@ class TypeHierarchyItem {
45214581
final List<int> interfaces;
45224582

45234583
/// The indexes of the items representing the mixins referenced by this class.
4524-
/// The list will be empty if there are no classes mixed in to this class.
4584+
/// The list will be empty if there are no classes mixed into this class.
45254585
final List<int> mixins;
45264586

45274587
/// The indexes of the items representing the subtypes of this class. The list

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: analysis_server_lib
22
description: A library to access Dart's analysis server API.
33

4-
version: 0.2.4
4+
version: 0.2.5
55
homepage: https://github.com/devoncarew/analysis_server_lib
66

77
environment:
8-
sdk: '>=2.15.0 <3.0.0'
8+
sdk: '>=2.15.0 <4.0.0'
99

1010
dependencies:
1111
logging: ^1.0.0

tool/common_types_spec.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,7 @@ <h1>Common Types</h1>
834834
<code>METHOD_STATIC</code>
835835
<p>Deprecated - no longer sent.</p>
836836
</value>
837+
<value><code>MIXIN</code></value>
837838
<value>
838839
<code>PARAMETER</code>
839840
<p>Deprecated - no longer sent.</p>

0 commit comments

Comments
 (0)