SylvesterInterface
open class SylvesterInterface
Undocumented
-
Undocumented
Declaration
Swift
public static let shared: SylvesterInterface
-
A SourceKitten module info request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func moduleInfo(xcodeBuildArguments: [String], name: String? = nil, in path: String) throws -> Module
Parameters
xcodeBuildArguments
The arguments necessary pass in to
xcodebuild
to build this module.name
The module name. Will be parsed from
xcodebuild
output if nil.path
The path to run
xcodebuild
from. Uses current path by default.Return Value
The resulting
Module
. -
A SourceKitten module docs request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func moduleDocs<S, T>(module: Module) throws -> [T] where S : SKBaseSubstructure, T : SKGenericSwiftDocs<S>
Parameters
module
The
Module
to get the module docs for.Return Value
An array of the specified
SwiftDocs
type.
-
A SourceKit editor open request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func editorOpen<Substructure: SKBaseSubstructure>(file: File) throws -> SKGenericEditorOpen<Substructure>
Parameters
file
The source file to open.
Return Value
The resulting
SKEditorOpen
. -
A SourceKit editor text extraction request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func editorExtractTextFromComment(sourceText: String) throws -> SKSourceTextResponse
Parameters
sourceText
The raw comment to extract the text from.
Return Value
The text extracted from a source comment.
-
A SourceKitten syntax map request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func syntaxMap(file: File) throws -> SyntaxMap
Parameters
file
The source file to get a syntax map for.
Return Value
The resulting
SyntaxMap
.
-
A SourceKitten swift documentation request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func swiftDocs<Substructure: SKBaseSubstructure>(file: File, compilerArguments: [String]) throws -> SKGenericSwiftDocs<Substructure>
Parameters
file
The source file to gather documentation for.
compilerArguments
The compiler arguments used to build the module (e.g
["-sdk", "/path/to/sdk"]
).Return Value
The resulting
SKSwiftDocs
. -
A SourceKitten doc info request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func docInfo<Entity: SKBaseEntity>(file: File?, moduleName: String?, compilerArguments: [String]) throws -> SKGenericDocInfo<Entity>
Parameters
file
The source file to gather documentation for.
compilerArguments
The compiler arguments used to build the module (e.g
["-sdk", "/path/to/sdk"]
).Return Value
The resulting
SKSwiftDocs
.
-
A SourceKit code completion request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func codeCompletion(file: File, offset: Offset, compilerArguments: [String]) throws -> SKCodeCompletion
Parameters
file
The
File
of the code completion.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"]
).Return Value
The resulting
SKCodeCompletion
. -
A SourceKit code completion open request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func codeCompletionOpen(file: File, offset: Offset, options: SKCodeCompletionSession.Options?, compilerArguments: [String]) throws -> SKCodeCompletionSession.Response
Parameters
file
The
File
of the code completion session.offset
The byte offset of the code completion point inside the session’s source contents.
options
The
SKCodeCompletionSession.Options
of the open request.compilerArguments
The compiler arguments used to build the module (e.g
["-sdk", "/path/to/sdk"]
).Return Value
The request’s
SKCodeCompletionSession.Response
. -
A SourceKit code completion update request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func codeCompletionUpdate(file: File, offset: Int, options: SKCodeCompletionSession.Options?) throws -> SKCodeCompletionSession.Response
Parameters
file
The
File
of the open code completion session.offset
The byte offset of the code completion point inside the session’s source contents.
options
The
SKCodeCompletionSession.Options
of the update request.Return Value
The request’s
SKCodeCompletionSession.Response
. -
A SourceKit code completion close request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func codeCompletionClose(name: String, offset: Int) throws -> SKCodeCompletionSession.Response
Parameters
name
The name of the open code completion session.
offset
The byte offset of the code completion point inside the session’s source contents.
Return Value
The request’s
SKCodeCompletionSession.Response
.
-
A SourceKit cursor info request.
Important
The cursor info request requires a valid source file path.
Throws
A
SKError
, if an error occurs.Declaration
Swift
public func cursorInfo(file: File, offset: Int?, usr: String?, compilerArguments: [String], cancelOnSubsequentRequest: Bool) throws -> SKCursorInfo?
Parameters
file
The source file.
offset
The byte offset of the code point inside the source contents.
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.
Return Value
The resulting
SKCursorInfo
, ornil
if an invalidoffset
orusr
was provided.
-
A SourceKit Markup parsing request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func convertMarkupToXML(sourceText: String) throws -> SKSourceTextResponse
Parameters
sourceText
The extracted Markup to parse.
Return Value
The Markup parse tree in xml format.
-
A custom YAML SourceKit request.
Throws
ASKError
, if an error occurs.Declaration
Swift
public func customYAML<Response>(_ yaml: String) throws -> Response where Response : Decodable
Parameters
yaml
The SourceKit request in YAML representation.
Return Value
The decoded response as the specified type.
-
Run
xcrun
with the specified arguments.Declaration
Swift
public func xcRun(arguments: [String]) -> String?
Parameters
arguments
The arguments to pass to
xcrun
.Return Value
The
xcrun
‘s standard out output. -
Run
xcodebuild clean build
along with any passed in build arguments.Declaration
Swift
public func xcodeBuild(arguments: [String], currentDirectoryURL: URL) -> String?
Parameters
arguments
The arguments to pass to
xcodebuild
.currentDirectoryURL
The URL to run
xcodebuild
from.Return Value
The
xcodebuild
‘s combined standard error and standard out output. -
Executes a Bash command.
Declaration
Swift
public func executeBash(command: String, currentDirectoryURL: URL? = nil) -> String?
Parameters
command
The command to execute.
currentDirectoryURL
The URL to run the Bash command from.
Return Value
The Bash command’s standard out output.
-
Launches another program as a subprocess.
Declaration
Swift
public func launch(subprocess: SKSubprocess) throws -> String?
Parameters
launchPath
The path to the receiver’s executable.
Return Value
The executable’s standard out (and standard error, if
SKSubprocess.shouldPipeStandardError
is true) output.