SKCodeCompletion
open class SKCodeCompletion : Codable
Represents a SourceKit code completion request that provides code completion suggestions.
-
Undocumented
Declaration
Swift
public typealias Item = SKCodeCompletionItem
-
The value to use for
SKCodeCompletionSession.Options.requestStart
in the next request when usingSKCodeCompletionSession.Options.requestLimit
.Note
Only present forSKCodeCompletionSession
requests.Declaration
Swift
public let nextRequestStart: Int?
-
The code completion items for the request.
Declaration
Swift
public var items: [Item]
-
Creates a new synchronous SourceKit code completion request.
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 init(file: File, offset: Offset, compilerArguments: [String]) throws
Parameters
file
The source file.
offset
The byte offset of the code completion point inside the source contents.
compilerArguments
The compiler arguments used to build the module (e.g
["-sdk", "/path/to/sdk"]
). -
Creates a new synchronous SourceKit code completion request.
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: Offset, sdkPath: String, target: String? = nil) throws
Parameters
file
The source file.
offset
The byte offset of the code completion point inside the source contents.
sdkPath
The path to the SDK to compile against.
target
The target (triple) architecture to generate completions for (e.g.
"arm64-apple-ios12.1"
). -
Creates a new synchronous SourceKit code completion request.
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(filePath: String, offset: Offset, compilerArguments: [String]) throws
Parameters
filePath
The absolute file path to the source file.
offset
The byte offset of the code completion point inside the source contents.
compilerArguments
The compiler arguments used to build the module (e.g
["-sdk", "/path/to/sdk"]
). -
Creates a new synchronous SourceKit code completion request.
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(contents: String, offset: Offset, compilerArguments: [String]) throws
Parameters
contents
The source code contents.
offset
The byte offset of the code completion point inside the source contents.
compilerArguments
The compiler arguments used to build the module (e.g
["-sdk", "/path/to/sdk"]
). -
Creates a new synchronous SourceKit code completion request.
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(filePath: String, offset: Offset, sdkPath: String, target: String? = nil) throws
Parameters
filePath
The absolute file path to the source file.
offset
The byte offset of the code completion point inside the source contents.
sdkPath
The path to the SDK to compile against.
target
The target (triple) architecture to generate completions for (e.g.
"arm64-apple-ios12.1"
). -
Creates a new synchronous SourceKit code completion request.
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(contents: String, offset: Offset, sdkPath: String, target: String? = nil) throws
Parameters
contents
The source code contents.
offset
The byte offset of the code completion point inside the source contents.
sdkPath
The path to the SDK to compile against.
target
The target (triple) architecture to generate completions for (e.g.
"arm64-apple-ios12.1"
).
-
Declaration
Swift
public static func == (lhs: SKCodeCompletion, rhs: SKCodeCompletion) -> Bool