Skip to content

Commit

Permalink
Conform InlayHintLabel to ExpressibleByStringX protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
fwcd committed May 21, 2022
1 parent d66d80d commit 8945c2c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Sources/LanguageServerProtocol/SupportTypes/InlayHint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public struct InlayHint: ResponseType, Codable, Hashable {
public let kind: InlayHintKind?

/// The hint's text, e.g. a printed type
public let label: String
public let label: InlayHintLabel

/// Optional text edits that are performed when accepting this inlay hint.
public let textEdits: [TextEdit]?
Expand All @@ -36,7 +36,7 @@ public struct InlayHint: ResponseType, Codable, Hashable {
public init(
position: Position,
kind: InlayHintKind? = nil,
label: String,
label: InlayHintLabel,
textEdits: [TextEdit]? = nil,
tooltip: MarkupContent? = nil,
paddingLeft: Bool? = nil,
Expand Down Expand Up @@ -93,6 +93,18 @@ public enum InlayHintLabel: Codable, Hashable {
}
}

extension InlayHintLabel: ExpressibleByStringLiteral {
public init(stringLiteral value: String) {
self = .string(value)
}
}

extension InlayHintLabel: ExpressibleByStringInterpolation {
public init(stringInterpolation interpolation: DefaultStringInterpolation) {
self = .string(.init(stringInterpolation: interpolation))
}
}

/// A part of an interactive or composite inlay hint label.
public struct InlayHintLabelPart: Codable, Hashable {
/// The value of this label part.
Expand Down

0 comments on commit 8945c2c

Please sign in to comment.