Skip to content

Commit dbf6008

Browse files
srawlinsCommit Queue
authored andcommitted
DAS: Support monospaced text (eg code snippets) in generated doc comments
We take any `<tt>`-wrapped text, and keep it in some "monospaced" / "teletype" format. For dartdoc we put it in backticks. For Javadoc we put it in `<code></code>`, which looks standard for inline text. This corrects some erroneous doc comment reference-looking text (`offsets[i]`) which is not meant to be a doc comment. Change-Id: I1d77a02368e3cde158ce95d3b0095ba09e071370 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401340 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent 59499d3 commit dbf6008

24 files changed

+2369
-4159
lines changed

pkg/analysis_server/lib/protocol/protocol_generated.dart

Lines changed: 57 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,11 +2534,11 @@ class AnalysisNavigationParams implements HasToJson {
25342534
List<NavigationRegion> regions;
25352535

25362536
/// The navigation targets referenced in the file. They are referenced by
2537-
/// NavigationRegions by their index in this array.
2537+
/// `NavigationRegion`s by their index in this array.
25382538
List<NavigationTarget> targets;
25392539

25402540
/// The files containing navigation targets referenced in the file. They are
2541-
/// referenced by NavigationTargets by their index in this array.
2541+
/// referenced by `NavigationTarget`s by their index in this array.
25422542
List<String> files;
25432543

25442544
AnalysisNavigationParams(this.file, this.regions, this.targets, this.files);
@@ -5202,14 +5202,14 @@ class CompletionGetSuggestionDetails2Params implements RequestParams {
52025202
/// The offset in the file where the completion will be inserted.
52035203
int offset;
52045204

5205-
/// The completion from the selected CompletionSuggestion. It could be a name
5206-
/// of a class, or a name of a constructor in form
5205+
/// The `completion` from the selected `CompletionSuggestion`. It could be a
5206+
/// name of a class, or a name of a constructor in form
52075207
/// "typeName.constructorName()", or an enumeration constant in form
52085208
/// "enumName.constantName", etc.
52095209
String completion;
52105210

52115211
/// The URI of the library to import, so that the element referenced in the
5212-
/// completion becomes accessible.
5212+
/// `completion` becomes accessible.
52135213
String libraryUri;
52145214

52155215
CompletionGetSuggestionDetails2Params(
@@ -5340,8 +5340,8 @@ class CompletionGetSuggestionDetails2Params implements RequestParams {
53405340
/// Clients may not extend, implement or mix-in this class.
53415341
class CompletionGetSuggestionDetails2Result implements ResponseResult {
53425342
/// The full text to insert, which possibly includes now an import prefix.
5343-
/// The client should insert this text, not the completion from the selected
5344-
/// CompletionSuggestion.
5343+
/// The client should insert this text, not the `completion` from the
5344+
/// selected `CompletionSuggestion`.
53455345
String completion;
53465346

53475347
/// A change for the client to apply to make the accepted completion
@@ -5452,16 +5452,16 @@ class CompletionGetSuggestions2Params implements RequestParams {
54525452
int offset;
54535453

54545454
/// The maximum number of suggestions to return. If the number of suggestions
5455-
/// after filtering is greater than the maxResults, then isIncomplete is set
5456-
/// to true.
5455+
/// after filtering is greater than the `maxResults`, then `isIncomplete` is
5456+
/// set to `true`.
54575457
int maxResults;
54585458

54595459
/// The mode of code completion being invoked. If no value is provided,
5460-
/// MATCH_FIRST_CHAR will be assumed.
5460+
/// `MATCH_FIRST_CHAR` will be assumed.
54615461
CompletionCaseMatchingMode? completionCaseMatchingMode;
54625462

5463-
/// The mode of code completion being invoked. If no value is provided, BASIC
5464-
/// will be assumed. BASIC is also the only currently supported.
5463+
/// The mode of code completion being invoked. If no value is provided,
5464+
/// `BASIC` will be assumed. `BASIC` is also the only currently supported.
54655465
CompletionMode? completionMode;
54665466

54675467
/// The number of times that the user has invoked code completion at the same
@@ -5674,18 +5674,18 @@ class CompletionGetSuggestions2Result implements ResponseResult {
56745674

56755675
/// The completion suggestions being reported. This list is filtered by the
56765676
/// already existing prefix, and sorted first by relevance, and (if the same)
5677-
/// by the suggestion text. The list will have at most maxResults items. If
5677+
/// by the suggestion text. The list will have at most `maxResults` items. If
56785678
/// the user types a new keystroke, the client is expected to either do local
56795679
/// filtering (when the returned list was complete), or ask the server again
5680-
/// (if isIncomplete was true).
5680+
/// (if `isIncomplete` was `true`).
56815681
///
56825682
/// This list contains suggestions from both imported, and not yet imported
5683-
/// libraries. Items from not yet imported libraries will have isNotImported
5684-
/// set to true.
5683+
/// libraries. Items from not yet imported libraries will have
5684+
/// `isNotImported` set to `true`.
56855685
List<CompletionSuggestion> suggestions;
56865686

56875687
/// True if the number of suggestions after filtering was greater than the
5688-
/// requested maxResults.
5688+
/// requested `maxResults`.
56895689
bool isIncomplete;
56905690

56915691
CompletionGetSuggestions2Result(
@@ -6425,19 +6425,19 @@ class EditBulkFixesParams implements RequestParams {
64256425
/// A list of the files and directories for which edits should be suggested.
64266426
///
64276427
/// If a request is made with a path that is invalid, e.g. is not absolute
6428-
/// and normalized, an error of type INVALID_FILE_PATH_FORMAT will be
6428+
/// and normalized, an error of type `INVALID_FILE_PATH_FORMAT` will be
64296429
/// generated. If a request is made for a file which does not exist, or which
64306430
/// is not currently subject to analysis (e.g. because it is not associated
64316431
/// with any analysis root specified to analysis.setAnalysisRoots), an error
6432-
/// of type FILE_NOT_ANALYZED will be generated.
6432+
/// of type `FILE_NOT_ANALYZED` will be generated.
64336433
List<String> included;
64346434

64356435
/// A flag indicating whether the bulk fixes are being run in test mode. The
64366436
/// only difference is that in test mode the fix processor will look for a
64376437
/// configuration file that can modify the content of the data file used to
64386438
/// compute the fixes when data-driven fixes are being considered.
64396439
///
6440-
/// If this field is omitted the flag defaults to false.
6440+
/// If this field is omitted the flag defaults to `false`.
64416441
bool? inTestMode;
64426442

64436443
/// A flag indicating whether to validate that the dependencies used by the
@@ -6446,7 +6446,7 @@ class EditBulkFixesParams implements RequestParams {
64466446
/// check to see if they are listed in the corresponding pubspec file, and
64476447
/// compute the fixes, if any.
64486448
///
6449-
/// If this field is omitted the flag defaults to false.
6449+
/// If this field is omitted the flag defaults to `false`.
64506450
bool? updatePubspec;
64516451

64526452
/// A list of diagnostic codes to be fixed.
@@ -6949,8 +6949,8 @@ class EditFormatParams implements RequestParams {
69496949
int selectionLength;
69506950

69516951
/// The line length to be used by the formatter. This value is ignored if a
6952-
/// formatter.page_width has been configured in the relevant
6953-
/// analysis_options.yaml file.
6952+
/// `formatter.page_width` has been configured in the relevant
6953+
/// `analysis_options.yaml` file.
69546954
int? lineLength;
69556955

69566956
EditFormatParams(
@@ -11081,11 +11081,12 @@ class ExecutionSetSubscriptionsResult implements ResponseResult {
1108111081
///
1108211082
/// Clients may not extend, implement or mix-in this class.
1108311083
class ExistingImport implements HasToJson {
11084-
/// The URI of the imported library. It is an index in the strings field, in
11085-
/// the enclosing ExistingImports and its ImportedElementSet object.
11084+
/// The URI of the imported library. It is an index in the `strings` field,
11085+
/// in the enclosing `ExistingImports` and its `ImportedElementSet` object.
1108611086
int uri;
1108711087

11088-
/// The list of indexes of elements, in the enclosing ExistingImports object.
11088+
/// The list of indexes of elements, in the enclosing `ExistingImports`
11089+
/// object.
1108911090
List<int> elements;
1109011091

1109111092
ExistingImport(this.uri, this.elements);
@@ -11270,8 +11271,8 @@ class ExtractLocalVariableFeedback extends RefactoringFeedback {
1127011271

1127111272
/// The lengths of the expressions that would be replaced by a reference to
1127211273
/// the variable. The lengths correspond to the offsets. In other words, for
11273-
/// a given expression, if the offset of that expression is offsets[i], then
11274-
/// the length of that expression is lengths[i].
11274+
/// a given expression, if the offset of that expression is `offsets[i]`,
11275+
/// then the length of that expression is `lengths[i]`.
1127511276
List<int> lengths;
1127611277

1127711278
ExtractLocalVariableFeedback(
@@ -11537,8 +11538,8 @@ class ExtractMethodFeedback extends RefactoringFeedback {
1153711538
/// The lengths of the expressions or statements that would be replaced by an
1153811539
/// invocation of the method. The lengths correspond to the offsets. In other
1153911540
/// words, for a given expression (or block of statements), if the offset of
11540-
/// that expression is offsets[i], then the length of that expression is
11541-
/// lengths[i].
11541+
/// that expression is `offsets[i]`, then the length of that expression is
11542+
/// `lengths[i]`.
1154211543
List<int> lengths;
1154311544

1154411545
ExtractMethodFeedback(
@@ -12147,9 +12148,9 @@ class FlutterGetWidgetDescriptionParams implements RequestParams {
1214712148
/// Clients may not extend, implement or mix-in this class.
1214812149
class FlutterGetWidgetDescriptionResult implements ResponseResult {
1214912150
/// The list of properties of the widget. Some of the properties might be
12150-
/// read only, when their editor is not set. This might be because they have
12151-
/// type that we don't know how to edit, or for compound properties that work
12152-
/// as containers for sub-properties.
12151+
/// read only, when their `editor` is not set. This might be because they
12152+
/// have type that we don't know how to edit, or for compound properties that
12153+
/// work as containers for sub-properties.
1215312154
List<FlutterWidgetProperty> properties;
1215412155

1215512156
FlutterGetWidgetDescriptionResult(this.properties);
@@ -13085,21 +13086,21 @@ class FlutterSetSubscriptionsResult implements ResponseResult {
1308513086
/// Clients may not extend, implement or mix-in this class.
1308613087
class FlutterSetWidgetPropertyValueParams implements RequestParams {
1308713088
/// The identifier of the property, previously returned as a part of a
13088-
/// FlutterWidgetProperty.
13089+
/// `FlutterWidgetProperty`.
1308913090
///
13090-
/// An error of type FLUTTER_SET_WIDGET_PROPERTY_VALUE_INVALID_ID is
13091+
/// An error of type `FLUTTER_SET_WIDGET_PROPERTY_VALUE_INVALID_ID` is
1309113092
/// generated if the identifier is not valid.
1309213093
int id;
1309313094

1309413095
/// The new value to set for the property.
1309513096
///
1309613097
/// If absent, indicates that the property should be removed. If the property
1309713098
/// corresponds to an optional parameter, the corresponding named argument is
13098-
/// removed. If the property isRequired is true,
13099-
/// FLUTTER_SET_WIDGET_PROPERTY_VALUE_IS_REQUIRED error is generated.
13099+
/// removed. If the property `isRequired` is true,
13100+
/// `FLUTTER_SET_WIDGET_PROPERTY_VALUE_IS_REQUIRED` error is generated.
1310013101
///
13101-
/// If the expression is not a syntactically valid Dart code, then
13102-
/// FLUTTER_SET_WIDGET_PROPERTY_VALUE_INVALID_EXPRESSION is reported.
13102+
/// If the `expression` is not a syntactically valid Dart code, then
13103+
/// `FLUTTER_SET_WIDGET_PROPERTY_VALUE_INVALID_EXPRESSION` is reported.
1310313104
FlutterWidgetPropertyValue? value;
1310413105

1310513106
FlutterSetWidgetPropertyValueParams(this.id, {this.value});
@@ -13320,8 +13321,8 @@ class FlutterWidgetProperty implements HasToJson {
1332013321
String name;
1332113322

1332213323
/// The list of children properties, if any. For example any property of type
13323-
/// EdgeInsets will have four children properties of type double - left / top
13324-
/// / right / bottom.
13324+
/// `EdgeInsets` will have four children properties of type `double` - left /
13325+
/// top / right / bottom.
1332513326
List<FlutterWidgetProperty>? children;
1332613327

1332713328
/// The editor that should be used by the client. This field is omitted if
@@ -13628,25 +13629,25 @@ class FlutterWidgetPropertyEditor implements HasToJson {
1362813629
///
1362913630
/// Clients may not extend, implement or mix-in this class.
1363013631
enum FlutterWidgetPropertyEditorKind {
13631-
/// The editor for a property of type bool.
13632+
/// The editor for a property of type `bool`.
1363213633
BOOL,
1363313634

13634-
/// The editor for a property of the type double.
13635+
/// The editor for a property of the type `double`.
1363513636
DOUBLE,
1363613637

13637-
/// The editor for choosing an item of an enumeration, see the enumItems
13638-
/// field of FlutterWidgetPropertyEditor.
13638+
/// The editor for choosing an item of an enumeration, see the `enumItems`
13639+
/// field of `FlutterWidgetPropertyEditor`.
1363913640
ENUM,
1364013641

1364113642
/// The editor for either choosing a pre-defined item from a list of provided
13642-
/// static field references (like ENUM), or specifying a free-form
13643+
/// static field references (like `ENUM`), or specifying a free-form
1364313644
/// expression.
1364413645
ENUM_LIKE,
1364513646

13646-
/// The editor for a property of type int.
13647+
/// The editor for a property of type `int`.
1364713648
INT,
1364813649

13649-
/// The editor for a property of the type String.
13650+
/// The editor for a property of the type `String`.
1365013651
STRING;
1365113652

1365213653
factory FlutterWidgetPropertyEditorKind.fromJson(
@@ -13847,7 +13848,7 @@ class FlutterWidgetPropertyValue implements HasToJson {
1384713848
///
1384813849
/// Clients may not extend, implement or mix-in this class.
1384913850
class FlutterWidgetPropertyValueEnumItem implements HasToJson {
13850-
/// The URI of the library containing the className. When the enum item is
13851+
/// The URI of the library containing the `className`. When the enum item is
1385113852
/// passed back, this will allow the server to import the corresponding
1385213853
/// library if necessary.
1385313854
String libraryUri;
@@ -14427,10 +14428,11 @@ class ImportedElementSet implements HasToJson {
1442714428
/// The list of unique strings in this object.
1442814429
List<String> strings;
1442914430

14430-
/// The library URI part of the element. It is an index in the strings field.
14431+
/// The library URI part of the element. It is an index in the `strings`
14432+
/// field.
1443114433
List<int> uris;
1443214434

14433-
/// The name part of a the element. It is an index in the strings field.
14435+
/// The name part of a the element. It is an index in the `strings` field.
1443414436
List<int> names;
1443514437

1443614438
ImportedElementSet(this.strings, this.uris, this.names);
@@ -19106,16 +19108,16 @@ class ServerSetClientCapabilitiesParams implements RequestParams {
1910619108
/// The following is a list of the names of the requests that can be
1910719109
/// specified:
1910819110
///
19109-
/// - openUrlRequest
19110-
/// - showMessageRequest
19111+
/// - `openUrlRequest`
19112+
/// - `showMessageRequest`
1911119113
List<String> requests;
1911219114

1911319115
/// True if the client supports the server sending URIs in place of file
1911419116
/// paths.
1911519117
///
1911619118
/// In this mode, the server will use URIs in all protocol fields with the
19117-
/// type FilePath. Returned URIs may be `file://` URIs or custom schemes. The
19118-
/// client can fetch the file contents for URIs with custom schemes (and
19119+
/// type `FilePath`. Returned URIs may be `file://` URIs or custom schemes.
19120+
/// The client can fetch the file contents for URIs with custom schemes (and
1911919121
/// receive modification events) through the LSP protocol (see the "lsp"
1912019122
/// domain).
1912119123
///

0 commit comments

Comments
 (0)