mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SourceKit: Add a new request to collect expression types in a source file.
This request collects the types of all expressions in a source file after type checking.
To fulfill this task, the client must provide the path to the Swift source file under
type checking and the necessary compiler arguments to help resolve all dependencies.
Request:
{
<key.request>: (UID) <source.request.expression.type>,
<key.sourcefile>: (string) // Absolute path to the file.
<key.compilerargs>: [string*] // Array of zero or more strings for the compiler arguments,
// e.g ["-sdk", "/path/to/sdk"]. If key.sourcefile is provided,
// these must include the path to that file.
}
Response:
{
<key.printedtypebuffer>: (string) // A text buffer where all expression types are printed to.
<key.expression_type_list>: (array) [expr-type-info*] // A list of expression and type
}
expr-type-info ::=
{
<key.expression_offset>: (int64) // Offset of an expression in the source file
<key.expression_length>: (int64) // Length of an expression in the source file
<key.type_offset>: (int64) // Offset of the printed type of the expression in the printed type buffer
<key.type_length>: (int64) // Length of the printed type of the expression in the printed type buffer
}
rdar:://35199889
This commit is contained in:
@@ -163,6 +163,12 @@ UID_KEYS = [
|
||||
KEY('ImplicitMembers', 'key.implicitmembers'),
|
||||
KEY('ExpectedTypes', 'key.expectedtypes'),
|
||||
KEY('Members', 'key.members'),
|
||||
KEY('TypeBuffer', 'key.printedtypebuffer'),
|
||||
KEY('ExpressionTypeList', 'key.expression_type_list'),
|
||||
KEY('ExpressionOffset', 'key.expression_offset'),
|
||||
KEY('ExpressionLength', 'key.expression_length'),
|
||||
KEY('TypeOffset', 'key.type_offset'),
|
||||
KEY('TypeLength', 'key.type_length'),
|
||||
]
|
||||
|
||||
|
||||
@@ -219,6 +225,7 @@ UID_REQUESTS = [
|
||||
REQUEST('EnableCompileNotifications',
|
||||
'source.request.enable-compile-notifications'),
|
||||
REQUEST('TestNotification', 'source.request.test_notification'),
|
||||
REQUEST('CollectExpressionType', 'source.request.expression.type'),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user