SKCursorInfo

open class SKCursorInfo : Codable

Represents a SourceKit cursor info request.

  • The UID for the declaration or reference kind (function, class, etc.).

    Declaration

    Swift

    public let kind: SKSourceKind
  • The displayed name for the token.

    Declaration

    Swift

    public let name: String
  • usr

    The Unified Symbol Resolutions (USR) string for the token.

    Declaration

    Swift

    public let usr: String?
  • The path to the file.

    Declaration

    Swift

    public let filePath: String?
  • The byte offset of the token inside the source contents.

    Declaration

    Swift

    public let offset: Int?
  • The byte length of the token.

    Declaration

    Swift

    public let length: Int?
  • The text describing the type of the result.

    Declaration

    Swift

    public let typeName: String
  • The XML representing how the token was declared.

    Declaration

    Swift

    public let annotatedDeclaration: String
  • The XML representing the token.

    Declaration

    Swift

    public let fullyAnnotatedDeclaration: String
  • The XML representing the token and its documentation.

    Declaration

    Swift

    public let docFullAsXML: String?
  • The Unified Symbol Resolutions (USR) string for the type.

    Declaration

    Swift

    public let typeUSR: String
  • The name of the group the token belongs to.

    Declaration

    Swift

    public let groupName: String?
  • An array of Unified Symbol Resolutions (USR) that the token overrides.

    Declaration

    Swift

    public let overrides: [SKOverride]?
  • The module name that the token is a member of.

    Declaration

    Swift

    public let moduleName: String?
  • An array of related declarations.

    Declaration

    Swift

    public let relatedDeclarations: [SKAnnotatedDeclaration]?
  • Whether the token is a member of a system module.

    Declaration

    Swift

    public var isSystem: Bool { get }
  • Declaration

    Swift

    public init?(file: File,
                 offset: Int?,
                 usr: String?,
                 compilerArguments: [String],
                 cancelOnSubsequentRequest: Bool) throws
  • Creates a new synchronous SourceKit cursor info request.

    Important

    The cursor info request requires a valid source file path.

    Warning

    The request is sent synchronously, so ensure this initializer is not called on the main thread.

    Throws

    A SKError, if an error occurs.

    Declaration

    Swift

    public convenience init?(file: File,
                             offset: Int,
                             compilerArguments: [String],
                             cancelOnSubsequentRequest: Bool = true) throws

    Parameters

    file

    The source file.

    offset

    The byte offset of the code point inside the source contents.

    compilerArguments

    The compiler arguments used to build the module (e.g ["-sdk", "/path/to/sdk"]). These must include the path to the file.

    cancelOnSubsequentRequest

    Whether this request should be canceled if a new cursor-info request is made that uses the same AST. This behavior is a workaround for not having first-class cancelation. For backwards compatibility, the default is true.

    Return Value

    The resulting SKCursorInfo, or nil if an invalid offset or usr was provided.

  • Creates a new synchronous SourceKit cursor info request.

    Important

    The cursor info request requires a valid source file path.

    Warning

    The request is sent synchronously, so ensure this initializer is not called on the main thread.

    Throws

    A SKError, if an error occurs.

    Declaration

    Swift

    public convenience init?(file: File,
                             usr: String,
                             compilerArguments: [String],
                             cancelOnSubsequentRequest: Bool = true) throws

    Parameters

    file

    The source file.

    usr

    The Unified Symbol Resolutions (USR) string for the entity.

    compilerArguments

    The compiler arguments used to build the module (e.g ["-sdk", "/path/to/sdk"]). These must include the path to the file.

    cancelOnSubsequentRequest

    Whether this request should be canceled if a new cursor-info request is made that uses the same AST. This behavior is a workaround for not having first-class cancelation. For backwards compatibility, the default is true.