Skip to content

Improve doc comment of nodeTypeNameForDiagnostics #760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Sources/SwiftParser/Diagnostics/ParserDiagnosticMessages.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import SwiftSyntax
let diagnosticDomain: String = "SwiftParser"

extension SyntaxProtocol {
/// Return a name of this syntax node that can be used to describe it in
/// diagnostics.
/// Nodes that mostly exist for the syntax tree's structure and don't have a
/// correspondence in the source code that's meeingful to the user by default
/// use the name of the parent node that encloses it. Pass `false` to `inherit`
/// to prevent this name inheritance.
/// Return the name of this syntax node to be used to describe it in
/// diagnostics. If the node itself has no diagnostic name (eg. it exists for
/// the syntax tree's structure), use the name of the enclosing parent node by
/// default.
/// Pass inherit: false to prevent this behavior, in which case `nil` will be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Pass inherit: false to prevent this behavior, in which case `nil` will be
/// Pass `inherit: false` to prevent this behavior, in which case `nil` will be

/// returned instead.
func nodeTypeNameForDiagnostics(inherit: Bool = true) -> String? {
if let name = Syntax(self).as(SyntaxEnum.self).nameForDiagnostics {
return name
Expand Down