Skip to content

Commit 6d65e39

Browse files
authored
Merge pull request #1702 from ahoppen/ahoppen/backticks
Wrap references to public types in comments in double backticks
2 parents c1d0739 + b357e65 commit 6d65e39

File tree

66 files changed

+2849
-2849
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2849
-2849
lines changed

CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ public let COMMON_NODES: [Node] = [
152152
Child(
153153
name: "Attributes",
154154
kind: .collection(kind: .attributeList, collectionElementName: "Attribute"),
155-
documentation: "If there were standalone attributes without a declaration to attach them to, the `MissingDeclSyntax` will contain these.",
155+
documentation: "If there were standalone attributes without a declaration to attach them to, the ``MissingDeclSyntax`` will contain these.",
156156
isOptional: true
157157
),
158158
Child(
159159
name: "Modifiers",
160160
kind: .collection(kind: .modifierList, collectionElementName: "Modifier"),
161-
documentation: "If there were standalone modifiers without a declaration to attach them to, the `MissingDeclSyntax` will contain these.",
161+
documentation: "If there were standalone modifiers without a declaration to attach them to, the ``MissingDeclSyntax`` will contain these.",
162162
isOptional: true
163163
),
164164
Child(

CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ public let EXPR_NODES: [Node] = [
707707
kind: .exprList,
708708
base: .syntaxCollection,
709709
nameForDiagnostics: nil,
710-
documentation: "A list of expressions connected by operators. This list is contained by a `SequenceExprSyntax`.",
710+
documentation: "A list of expressions connected by operators. This list is contained by a ``SequenceExprSyntax``.",
711711
elementChoices: [.expr]
712712
),
713713

CodeGeneration/Sources/Utils/CodeGenerationFormat.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public class CodeGenerationFormat: BasicFormat {
9292
// MARK: - Private
9393

9494
private func shouldBeSeparatedByTwoNewlines(node: CodeBlockItemSyntax) -> Bool {
95-
// First item in the `CodeBlockItemListSyntax` don't need a newline or identation if the parent is a `SourceFileSyntax`.
95+
// First item in the ``CodeBlockItemListSyntax`` don't need a newline or identation if the parent is a ``SourceFileSyntax``.
9696
// We want to group imports so newline between them should be omitted
9797
return node.parent?.as(CodeBlockItemListSyntax.self)?.first == node || node.item.is(ImportDeclSyntax.self)
9898
}

CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ public enum SyntaxOrTokenNodeKind: Hashable {
2121
case token(tokenKind: String)
2222
}
2323

24-
/// Extension to the `Child` type to provide functionality specific to
24+
/// Extension to the ``Child`` type to provide functionality specific to
2525
/// SwiftSyntaxBuilder.
2626
public extension Child {
27-
/// The type of this child, represented by a `SyntaxBuildableType`, which can
27+
/// The type of this child, represented by a ``SyntaxBuildableType``, which can
2828
/// be used to create the corresponding `Buildable` and `ExpressibleAs` types.
2929
var type: SyntaxBuildableType {
3030
let buildableKind: SyntaxOrTokenNodeKind
@@ -96,7 +96,7 @@ public extension Child {
9696

9797
/// If this node is a token that can't contain arbitrary text, generate a Swift
9898
/// `precondition` statement that verifies the variable with name var_name and of type
99-
/// `TokenSyntax` contains one of the supported text options. Otherwise return `nil`.
99+
/// ``TokenSyntax`` contains one of the supported text options. Otherwise return `nil`.
100100
func generateAssertStmtTextChoices(varName: String) -> FunctionCallExprSyntax? {
101101
guard case .token(choices: let choices, requiresLeadingSpace: _, requiresTrailingSpace: _) = kind else {
102102
return nil

CodeGeneration/Sources/Utils/SyntaxBuildableNode.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212

1313
import SyntaxSupport
1414

15-
/// Extension to the `Node` type to provide functionality specific to
15+
/// Extension to the ``Node`` type to provide functionality specific to
1616
/// SwiftSyntaxBuilder.
1717
public extension Node {
18-
/// The node's syntax kind as `SyntaxBuildableType`.
18+
/// The node's syntax kind as ``SyntaxBuildableType``.
1919
var type: SyntaxBuildableType {
2020
SyntaxBuildableType(kind: .node(kind: kind))
2121
}
2222

23-
/// The node's syntax kind as `SyntaxBuildableType`.
23+
/// The node's syntax kind as ``SyntaxBuildableType``.
2424
var baseType: SyntaxBuildableType {
2525
if base == .syntaxCollection {
2626
return SyntaxBuildableType(kind: .node(kind: .syntax))

CodeGeneration/Sources/Utils/SyntaxBuildableType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public struct SyntaxBuildableType: Hashable {
8686
/// These names look as follows:
8787
/// - For nodes: The node name, e.g. `IdentifierExpr` (these are implemented as structs)
8888
/// - For base kinds: `<BaseKind>Buildable`, e.g. `ExprBuildable` (these are implemented as protocols)
89-
/// - For token: `TokenSyntax` (tokens don't have a dedicated type in SwiftSyntaxBuilder)
89+
/// - For token: ``TokenSyntax`` (tokens don't have a dedicated type in SwiftSyntaxBuilder)
9090
/// If the type is optional, the type is wrapped in an `OptionalType`.
9191
public var buildable: TypeSyntax {
9292
optionalWrapped(type: SimpleTypeIdentifierSyntax(name: .identifier(syntaxBaseName)))

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/KeywordFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ let keywordFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
5454
/// This is really unfortunate. Really, we should have a `switch` in
5555
/// `Keyword.defaultText` to return the keyword's kind but the constant lookup
5656
/// table is significantly faster. Ideally, we could also get the compiler to
57-
/// constant-evaluate `Keyword.spi.defaultText` to a `SyntaxText` but I don't
57+
/// constant-evaluate `Keyword.spi.defaultText` to a ``SyntaxText`` but I don't
5858
/// see how that's possible right now.
5959
private static let keywordTextLookupTable: [SyntaxText] = \(lookupTable)
6060
"""

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxAnyVisitorFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Utils
1818
let syntaxAnyVisitorFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
1919
try! ClassDeclSyntax(
2020
"""
21-
/// A `SyntaxVisitor` that can visit the nodes as generic `Syntax` values.
21+
/// A `SyntaxVisitor` that can visit the nodes as generic ``Syntax`` values.
2222
///
2323
/// This subclass of `SyntaxVisitor` is slower than the type-specific visitation
2424
/// of `SyntaxVisitor`. Use `SyntaxAnyVisitor` if the `visitAny(_)` function

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
2121
"""
2222
// MARK: - \(node.kind.syntaxType)
2323
24-
/// Protocol to which all `\(node.kind.syntaxType)` nodes conform. Extension point to add
25-
/// common methods to all `\(node.kind.syntaxType)` nodes.
24+
/// Protocol to which all ``\(node.kind.syntaxType)`` nodes conform. Extension point to add
25+
/// common methods to all ``\(node.kind.syntaxType)`` nodes.
2626
/// DO NOT CONFORM TO THIS PROTOCOL YOURSELF!
2727
public protocol \(node.kind.protocolType): \(raw: node.base.protocolType) {}
2828
"""
@@ -62,7 +62,7 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
6262

6363
DeclSyntax(
6464
"""
65-
/// Create a `\(node.kind.syntaxType)` node from a specialized syntax node.
65+
/// Create a ``\(node.kind.syntaxType)`` node from a specialized syntax node.
6666
public init(_ syntax: some \(node.kind.protocolType)) {
6767
// We know this cast is going to succeed. Go through init(_: SyntaxData)
6868
// to do a sanity check and verify the kind matches in debug builds and get
@@ -74,7 +74,7 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
7474

7575
DeclSyntax(
7676
"""
77-
/// Create a `\(node.kind.syntaxType)` node from a specialized optional syntax node.
77+
/// Create a ``\(node.kind.syntaxType)`` node from a specialized optional syntax node.
7878
public init?(_ syntax: (some \(node.kind.protocolType))?) {
7979
guard let syntax = syntax else { return nil }
8080
self.init(syntax)
@@ -95,7 +95,7 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
9595

9696
DeclSyntax(
9797
"""
98-
/// Create a `\(node.kind.syntaxType)` node from a specialized optional syntax node.
98+
/// Create a ``\(node.kind.syntaxType)`` node from a specialized optional syntax node.
9999
public init?(fromProtocol syntax: \(node.kind.protocolType)?) {
100100
guard let syntax = syntax else { return nil }
101101
self.init(fromProtocol: syntax)
@@ -131,8 +131,8 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
131131

132132
try InitializerDeclSyntax(
133133
"""
134-
/// Creates a `\(node.kind.syntaxType)` node from the given `SyntaxData`. This assumes
135-
/// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
134+
/// Creates a ``\(node.kind.syntaxType)`` node from the given ``SyntaxData``. This assumes
135+
/// that the ``SyntaxData`` is of the correct kind. If it is not, the behaviour
136136
/// is undefined.
137137
internal init(_ data: SyntaxData)
138138
"""

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxCollectionsFile.swift

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
4242
!node.documentation.isEmpty
4343
? node.documentation
4444
: """
45-
/// `\(node.kind.syntaxType)` represents a collection of one or more
46-
/// `\(node.collectionElementType.syntaxBaseName)` nodes. \(node.kind.syntaxType) behaves
45+
/// ``\(node.kind.syntaxType)`` represents a collection of one or more
46+
/// ``\(node.collectionElementType.syntaxBaseName)`` nodes. ``\(node.kind.syntaxType)`` behaves
4747
/// as a regular Swift collection, and has accessors that return new
4848
/// versions of the collection with different children.
4949
"""
@@ -187,12 +187,12 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
187187

188188
DeclSyntax(
189189
"""
190-
/// Creates a new `\(node.kind.syntaxType)` by replacing the underlying layout with
190+
/// Creates a new ``\(node.kind.syntaxType)`` by replacing the underlying layout with
191191
/// a different set of raw syntax nodes.
192192
///
193193
/// - Parameter layout: The new list of raw syntax nodes underlying this
194194
/// collection.
195-
/// - Returns: A new `\(node.kind.syntaxType)` with the new layout underlying it.
195+
/// - Returns: A new ``\(node.kind.syntaxType)`` with the new layout underlying it.
196196
internal func replacingLayout(_ layout: [RawSyntax?]) -> \(node.kind.syntaxType) {
197197
let arena = SyntaxArena()
198198
let newRaw = layoutView.replacingLayout(with: layout, arena: arena)
@@ -204,11 +204,11 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
204204

205205
DeclSyntax(
206206
"""
207-
/// Creates a new `\(node.kind.syntaxType)` by appending the provided syntax element
207+
/// Creates a new ``\(node.kind.syntaxType)`` by appending the provided syntax element
208208
/// to the children.
209209
///
210210
/// - Parameter syntax: The element to append.
211-
/// - Returns: A new `\(node.kind.syntaxType)` with that element appended to the end.
211+
/// - Returns: A new ``\(node.kind.syntaxType)`` with that element appended to the end.
212212
public func appending(_ syntax: Element) -> \(node.kind.syntaxType) {
213213
var newLayout = layoutView.formLayoutArray()
214214
newLayout.append(syntax.raw)
@@ -219,11 +219,11 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
219219

220220
DeclSyntax(
221221
"""
222-
/// Creates a new `\(node.kind.syntaxType)` by prepending the provided syntax element
222+
/// Creates a new ``\(node.kind.syntaxType)`` by prepending the provided syntax element
223223
/// to the children.
224224
///
225225
/// - Parameter syntax: The element to prepend.
226-
/// - Returns: A new `\(node.kind.syntaxType)` with that element prepended to the
226+
/// - Returns: A new ``\(node.kind.syntaxType)`` with that element prepended to the
227227
/// beginning.
228228
public func prepending(_ syntax: Element) -> \(node.kind.syntaxType) {
229229
return inserting(syntax, at: 0)
@@ -233,14 +233,14 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
233233

234234
DeclSyntax(
235235
"""
236-
/// Creates a new `\(node.kind.syntaxType)` by inserting the provided syntax element
236+
/// Creates a new ``\(node.kind.syntaxType)`` by inserting the provided syntax element
237237
/// at the provided index in the children.
238238
///
239239
/// - Parameters:
240240
/// - syntax: The element to insert.
241241
/// - index: The index at which to insert the element in the collection.
242242
///
243-
/// - Returns: A new `\(node.kind.syntaxType)` with that element appended to the end.
243+
/// - Returns: A new ``\(node.kind.syntaxType)`` with that element appended to the end.
244244
public func inserting(_ syntax: Element, at index: Int) -> \(node.kind.syntaxType) {
245245
var newLayout = layoutView.formLayoutArray()
246246
/// Make sure the index is a valid insertion index (0 to 1 past the end)
@@ -254,14 +254,14 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
254254

255255
DeclSyntax(
256256
"""
257-
/// Creates a new `\(node.kind.syntaxType)` by replacing the syntax element
257+
/// Creates a new ``\(node.kind.syntaxType)`` by replacing the syntax element
258258
/// at the provided index.
259259
///
260260
/// - Parameters:
261261
/// - index: The index at which to replace the element in the collection.
262262
/// - syntax: The element to replace with.
263263
///
264-
/// - Returns: A new `\(node.kind.syntaxType)` with the new element at the provided index.
264+
/// - Returns: A new ``\(node.kind.syntaxType)`` with the new element at the provided index.
265265
public func replacing(childAt index: Int, with syntax: Element) -> \(node.kind.syntaxType) {
266266
var newLayout = layoutView.formLayoutArray()
267267
/// Make sure the index is a valid index for replacing
@@ -275,11 +275,11 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
275275

276276
DeclSyntax(
277277
"""
278-
/// Creates a new `\(node.kind.syntaxType)` by removing the syntax element at the
278+
/// Creates a new ``\(node.kind.syntaxType)`` by removing the syntax element at the
279279
/// provided index.
280280
///
281281
/// - Parameter index: The index of the element to remove from the collection.
282-
/// - Returns: A new `\(node.kind.syntaxType)` with the element at the provided index
282+
/// - Returns: A new ``\(node.kind.syntaxType)`` with the element at the provided index
283283
/// removed.
284284
public func removing(childAt index: Int) -> \(node.kind.syntaxType) {
285285
var newLayout = layoutView.formLayoutArray()
@@ -291,9 +291,9 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
291291

292292
DeclSyntax(
293293
"""
294-
/// Creates a new `\(node.kind.syntaxType)` by removing the first element.
294+
/// Creates a new ``\(node.kind.syntaxType)`` by removing the first element.
295295
///
296-
/// - Returns: A new `\(node.kind.syntaxType)` with the first element removed.
296+
/// - Returns: A new ``\(node.kind.syntaxType)`` with the first element removed.
297297
public func removingFirst() -> \(node.kind.syntaxType) {
298298
var newLayout = layoutView.formLayoutArray()
299299
newLayout.removeFirst()
@@ -304,9 +304,9 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
304304

305305
DeclSyntax(
306306
"""
307-
/// Creates a new `\(node.kind.syntaxType)` by removing the last element.
307+
/// Creates a new ``\(node.kind.syntaxType)`` by removing the last element.
308308
///
309-
/// - Returns: A new `\(node.kind.syntaxType)` with the last element removed.
309+
/// - Returns: A new ``\(node.kind.syntaxType)`` with the last element removed.
310310
public func removingLast() -> \(node.kind.syntaxType) {
311311
var newLayout = layoutView.formLayoutArray()
312312
newLayout.removeLast()
@@ -318,7 +318,7 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
318318

319319
try! ExtensionDeclSyntax(
320320
"""
321-
/// Conformance for `\(node.kind.syntaxType)` to the `BidirectionalCollection` protocol.
321+
/// Conformance for ``\(node.kind.syntaxType)`` to the `BidirectionalCollection` protocol.
322322
extension \(node.kind.syntaxType): BidirectionalCollection
323323
"""
324324
) {

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodesFile.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func syntaxNode(emitKind: SyntaxNodeKind) -> SourceFileSyntax {
6666

6767
DeclSyntax(
6868
"""
69-
/// Creates a `\(node.kind.syntaxType)` node from the given `SyntaxData`. This assumes
69+
/// Creates a ``\(node.kind.syntaxType)`` node from the given ``SyntaxData``. This assumes
7070
/// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
7171
/// is undefined.
7272
internal init(_ data: SyntaxData) {
@@ -192,7 +192,7 @@ func syntaxNode(emitKind: SyntaxNodeKind) -> SourceFileSyntax {
192192

193193
DeclSyntax(
194194
"""
195-
/// Adds the provided `\(raw: childElt)` to the node's `\(raw: child.varName)`
195+
/// Adds the provided `element` to the node's `\(raw: child.varName)`
196196
/// collection.
197197
/// - param element: The new `\(raw: childElt)` to add to the node's
198198
/// `\(raw: child.varName)` collection.

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxRewriterFile.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ let syntaxRewriterFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
3636
if (node.base == .syntax || node.base == .syntaxCollection) && node.kind != .missing {
3737
DeclSyntax(
3838
"""
39-
/// Visit a `\(node.kind.syntaxType)`.
39+
/// Visit a ``\(node.kind.syntaxType)``.
4040
/// - Parameter node: the node that is being visited
4141
/// - Returns: the rewritten node
4242
open func visit(_ node: \(node.kind.syntaxType)) -> \(node.kind.syntaxType) {
@@ -47,7 +47,7 @@ let syntaxRewriterFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
4747
} else {
4848
DeclSyntax(
4949
"""
50-
/// Visit a `\(node.kind.syntaxType)`.
50+
/// Visit a ``\(node.kind.syntaxType)``.
5151
/// - Parameter node: the node that is being visited
5252
/// - Returns: the rewritten node
5353
open func visit(_ node: \(node.kind.syntaxType)) -> \(raw: node.baseType.syntaxBaseName) {
@@ -60,7 +60,7 @@ let syntaxRewriterFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
6060

6161
DeclSyntax(
6262
"""
63-
/// Visit a `TokenSyntax`.
63+
/// Visit a ``TokenSyntax``.
6464
/// - Parameter node: the node that is being visited
6565
/// - Returns: the rewritten node
6666
open func visit(_ token: TokenSyntax) -> TokenSyntax {

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxTransformFile.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let syntaxTransformFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
2626
for node in SYNTAX_NODES where !node.kind.isBase {
2727
DeclSyntax(
2828
"""
29-
/// Visiting `\(node.kind.syntaxType)` specifically.
29+
/// Visiting ``\(node.kind.syntaxType)`` specifically.
3030
/// - Parameter node: the node we are visiting.
3131
/// - Returns: the sum of whatever the child visitors return.
3232
func visit(_ node: \(node.kind.syntaxType)) -> ResultType
@@ -47,7 +47,7 @@ let syntaxTransformFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
4747
for node in SYNTAX_NODES where !node.kind.isBase {
4848
DeclSyntax(
4949
"""
50-
/// Visiting `\(node.kind.syntaxType)` specifically.
50+
/// Visiting ``\(node.kind.syntaxType)`` specifically.
5151
/// - Parameter node: the node we are visiting.
5252
/// - Returns: nil by default.
5353
public func visit(_ node: \(node.kind.syntaxType)) -> ResultType {

0 commit comments

Comments
 (0)