-
Notifications
You must be signed in to change notification settings - Fork 4
/
SourceKittenFramework.swift
1648 lines (1173 loc) · 45.6 KB
/
SourceKittenFramework.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import Clang_C
import Dispatch
import Foundation
import SourceKit
import SwiftOnoneSupport
import SWXMLHash
import Yams
/// A [strict total order](http://en.wikipedia.org/wiki/Total_order#Strict_total_order)
/// over instances of `Self`.
public func < (lhs: SourceKittenFramework.SourceDeclaration, rhs: SourceKittenFramework.SourceDeclaration) -> Bool
/// A [strict total order](http://en.wikipedia.org/wiki/Total_order#Strict_total_order)
/// over instances of `Self`.
public func < (lhs: SourceKittenFramework.SourceLocation, rhs: SourceKittenFramework.SourceLocation) -> Bool
public func == (lhs: SourceKittenFramework.SourceLocation, rhs: SourceKittenFramework.SourceLocation) -> Bool
/**
Returns true if `lhs` Structure is equal to `rhs` Structure.
- parameter lhs: Structure to compare to `rhs`.
- parameter rhs: Structure to compare to `lhs`.
- returns: True if `lhs` Structure is equal to `rhs` Structure.
*/
public func == (lhs: SourceKittenFramework.Structure, rhs: SourceKittenFramework.Structure) -> Bool
/**
Returns true if `lhs` SyntaxMap is equal to `rhs` SyntaxMap.
- parameter lhs: SyntaxMap to compare to `rhs`.
- parameter rhs: SyntaxMap to compare to `lhs`.
- returns: True if `lhs` SyntaxMap is equal to `rhs` SyntaxMap.
*/
public func == (lhs: SourceKittenFramework.SyntaxMap, rhs: SourceKittenFramework.SyntaxMap) -> Bool
/**
Returns true if `lhs` SyntaxToken is equal to `rhs` SyntaxToken.
- parameter lhs: SyntaxToken to compare to `rhs`.
- parameter rhs: SyntaxToken to compare to `lhs`.
- returns: True if `lhs` SyntaxToken is equal to `rhs` SyntaxToken.
*/
public func == (lhs: SourceKittenFramework.SyntaxToken, rhs: SourceKittenFramework.SyntaxToken) -> Bool
public struct ClangAvailability {
public let alwaysDeprecated: Bool
public let alwaysUnavailable: Bool
public let deprecationMessage: String?
public let unavailableMessage: String?
}
/// Represents a group of CXTranslationUnits.
public struct ClangTranslationUnit {
public let declarations: [String: [SourceKittenFramework.SourceDeclaration]]
/**
Create a ClangTranslationUnit by passing Objective-C header files and clang compiler arguments.
- parameter headerFiles: Objective-C header files to document.
- parameter compilerArguments: Clang compiler arguments.
*/
public init(headerFiles: [String], compilerArguments: [String])
/**
Failable initializer to create a ClangTranslationUnit by passing Objective-C header files and
`xcodebuild` arguments. Optionally pass in a `path`.
- parameter headerFiles: Objective-C header files to document.
- parameter xcodeBuildArguments: The arguments necessary pass in to `xcodebuild` to link these header files.
- parameter path: Path to run `xcodebuild` from. Uses current path by default.
*/
public init?(headerFiles: [String], xcodeBuildArguments: [String], inPath path: String = FileManager.default.currentDirectoryPath)
}
extension ClangTranslationUnit: CustomStringConvertible {
/// A textual JSON representation of `ClangTranslationUnit`.
public var description: String { get }
}
public struct CodeCompletionItem: CustomStringConvertible {
public typealias NumBytesInt = Int64
public let kind: String
public let context: String
public let name: String?
public let descriptionKey: String?
public let sourcetext: String?
public let typeName: String?
public let moduleName: String?
public let docBrief: String?
public let associatedUSRs: String?
public let numBytesToErase: SourceKittenFramework.CodeCompletionItem.NumBytesInt?
/// Dictionary representation of CodeCompletionItem. Useful for NSJSONSerialization.
public var dictionaryValue: [String: Any] { get }
/// A textual representation of this instance.
///
/// Calling this property directly is discouraged. Instead, convert an
/// instance of any type to a string by using the `String(describing:)`
/// initializer. This initializer works with any type, and uses the custom
/// `description` property for types that conform to
/// `CustomStringConvertible`:
///
/// struct Point: CustomStringConvertible {
/// let x: Int, y: Int
///
/// var description: String {
/// return "(\(x), \(y))"
/// }
/// }
///
/// let p = Point(x: 21, y: 30)
/// let s = String(describing: p)
/// print(s)
/// // Prints "(21, 30)"
///
/// The conversion of `p` to a string in the assignment to `s` uses the
/// `Point` type's `description` property.
public var description: String { get }
public static func parse(response: [String: SourceKittenFramework.SourceKitRepresentable]) -> [SourceKittenFramework.CodeCompletionItem]
}
public struct Documentation {
public let parameters: [SourceKittenFramework.Parameter]
public let returnDiscussion: [SourceKittenFramework.Text]
}
/// Represents a source file.
public final class File {
/// File path. Nil if initialized directly with `File(contents:)`.
public let path: String?
/// File contents.
public var contents: String
/// File lines.
public var lines: [SourceKittenFramework.Line] { get }
/**
Failable initializer by path. Fails if file contents could not be read as a UTF8 string.
- parameter path: File path.
*/
public init?(path: String)
public init(pathDeferringReading path: String)
/**
Initializer by file contents. File path is nil.
- parameter contents: File contents.
*/
public init(contents: String)
/// Formats the file.
///
/// - Parameters:
/// - trimmingTrailingWhitespace: Boolean
/// - useTabs: Boolean
/// - indentWidth: Int
/// - Returns: formatted String
/// - Throws: Request.Error
public func format(trimmingTrailingWhitespace: Bool, useTabs: Bool, indentWidth: Int) throws -> String
/**
Parse source declaration string from SourceKit dictionary.
- parameter dictionary: SourceKit dictionary to extract declaration from.
- returns: Source declaration if successfully parsed.
*/
public func parseDeclaration(_ dictionary: [String: SourceKittenFramework.SourceKitRepresentable]) -> String?
/**
Parse line numbers containing the declaration's implementation from SourceKit dictionary.
- parameter dictionary: SourceKit dictionary to extract declaration from.
- returns: Line numbers containing the declaration's implementation.
*/
public func parseScopeRange(_ dictionary: [String: SourceKittenFramework.SourceKitRepresentable]) -> (start: Int, end: Int)?
/**
Returns a copy of the input dictionary with comment mark names, cursor.info information and
parsed declarations for the top-level of the input dictionary and its substructures.
- parameter dictionary: Dictionary to process.
- parameter cursorInfoRequest: Cursor.Info request to get declaration information.
*/
public func process(dictionary: [String: SourceKittenFramework.SourceKitRepresentable], cursorInfoRequest: SourceKittenFramework.SourceKitObject? = nil, syntaxMap: SourceKittenFramework.SyntaxMap? = nil) -> [String: SourceKittenFramework.SourceKitRepresentable]
}
extension File: Hashable {
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (lhs: SourceKittenFramework.File, rhs: SourceKittenFramework.File) -> Bool
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: Never call `finalize()` on `hasher`. Doing so may become a
/// compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
}
/// File methods to generate and manipulate OffsetMap's.
extension File {
/**
Creates an OffsetMap containing offset locations at which there are declarations that likely
have documentation comments, but haven't been documented by SourceKitten yet.
- parameter documentedTokenOffsets: Offsets where there are declarations that likely
have documentation comments.
- parameter dictionary: Docs dictionary to check for which offsets are already
documented.
- returns: OffsetMap containing offset locations at which there are declarations that likely
have documentation comments, but haven't been documented by SourceKitten yet.
*/
public func makeOffsetMap(documentedTokenOffsets: [Int], dictionary: [String: SourceKittenFramework.SourceKitRepresentable]) -> SourceKittenFramework.OffsetMap
}
/// Language Enum.
public enum Language {
/// Swift.
case swift
/// Objective-C.
case objc
}
/// Representation of line in String
public struct Line {
/// origin = 0
public let index: Int
/// Content
public let content: String
/// UTF16 based range in entire String. Equivalent to Range<UTF16Index>
public let range: NSRange
/// Byte based range in entire String. Equivalent to Range<UTF8Index>
public let byteRange: NSRange
}
/// Represents source module to be documented.
public struct Module {
/// Module Name.
public let name: String
/// Compiler arguments required by SourceKit to process the source files in this Module.
public let compilerArguments: [String]
/// Source files to be documented in this Module.
public let sourceFiles: [String]
/// Documentation for this Module. Typically expensive computed property.
public var docs: [SourceKittenFramework.SwiftDocs] { get }
public init?(spmName: String, inPath path: String = FileManager.default.currentDirectoryPath)
/**
Failable initializer to create a Module by the arguments necessary pass in to `xcodebuild` to build it.
Optionally pass in a `moduleName` and `path`.
- parameter xcodeBuildArguments: The arguments necessary pass in to `xcodebuild` to build this Module.
- parameter name: Module name. Will be parsed from `xcodebuild` output if nil.
- parameter path: Path to run `xcodebuild` from. Uses current path by default.
*/
public init?(xcodeBuildArguments: [String], name: String? = nil, inPath path: String = FileManager.default.currentDirectoryPath)
/**
Initializer to create a Module by name and compiler arguments.
- parameter name: Module name.
- parameter compilerArguments: Compiler arguments required by SourceKit to process the source files in this Module.
*/
public init(name: String, compilerArguments: [String])
}
extension Module: CustomStringConvertible {
/// A textual representation of `Module`.
public var description: String { get }
}
/**
Objective-C declaration kinds.
More or less equivalent to `SwiftDeclarationKind`, but with made up values because there's no such
thing as SourceKit for Objective-C.
*/
public enum ObjCDeclarationKind: String {
/// `category`.
case category
/// `class`.
case `class`
/// `constant`.
case constant
/// `enum`.
case `enum`
/// `enumcase`.
case enumcase
/// `initializer`.
case initializer
/// `method.class`.
case methodClass
/// `method.instance`.
case methodInstance
/// `property`.
case property
/// `protocol`.
case `protocol`
/// `typedef`.
case typedef
/// `function`.
case function
/// `mark`.
case mark
/// `struct`
case `struct`
/// `field`
case field
/// `ivar`
case ivar
/// `ModuleImport`
case moduleImport
/// `UnexposedDecl`
case unexposedDecl
public init(_ cursorKind: CXCursorKind)
}
/// Type that maps potentially documented declaration offsets to its closest parent offset.
public typealias OffsetMap = [Int: Int]
public struct Parameter {
public let name: String
public let discussion: [SourceKittenFramework.Text]
}
/// Represents a SourceKit request.
public enum Request {
/// An `editor.open` request for the given File.
case editorOpen(file: SourceKittenFramework.File)
/// A `cursorinfo` request for an offset in the given file, using the `arguments` given.
case cursorInfo(file: String, offset: Int64, arguments: [String])
/// A `cursorinfo` request for a USR in the given file, using the `arguments` given.
case cursorInfoUSR(file: String, usr: String, arguments: [String], cancelOnSubsequentRequest: Bool)
/// A custom request by passing in the `SourceKitObject` directly.
case customRequest(request: SourceKittenFramework.SourceKitObject)
/// A request generated by sourcekit using the yaml representation.
case yamlRequest(yaml: String)
/// A `codecomplete` request by passing in the file name, contents, offset
/// for which to generate code completion options and array of compiler arguments.
case codeCompletionRequest(file: String, contents: String, offset: Int64, arguments: [String])
/// ObjC Swift Interface
case interface(file: String, uuid: String, arguments: [String])
/// Find USR
case findUSR(file: String, usr: String)
/// Index
case index(file: String, arguments: [String])
/// Format
case format(file: String, line: Int64, useTabs: Bool, indentWidth: Int64)
/// ReplaceText
case replaceText(file: String, offset: Int64, length: Int64, sourceText: String)
/// A documentation request for the given source text.
case docInfo(text: String, arguments: [String])
/// A documentation request for the given module.
case moduleInfo(module: String, arguments: [String])
/// Gets the serialized representation of the file's SwiftSyntax tree. JSON string if `byteTree` is false,
/// binary data otherwise.
case syntaxTree(file: SourceKittenFramework.File, byteTree: Bool)
/**
Sends the request to SourceKit and return the response as an [String: SourceKitRepresentable].
- returns: SourceKit output as a dictionary.
- throws: Request.Error on fail ()
*/
public func send() throws -> [String: SourceKittenFramework.SourceKitRepresentable]
/// A enum representation of SOURCEKITD_ERROR_*
public enum Error: Error, CustomStringConvertible {
case connectionInterrupted(String?)
case invalid(String?)
case failed(String?)
case cancelled(String?)
case unknown(String?)
/// A textual representation of `self`.
public var description: String { get }
}
/**
Sends the request to SourceKit and return the response as an [String: SourceKitRepresentable].
- returns: SourceKit output as a dictionary.
- throws: Request.Error on fail ()
*/
@available(*, deprecated, renamed: "send()")
public func failableSend() throws -> [String: SourceKittenFramework.SourceKitRepresentable]
}
extension Request: CustomStringConvertible {
/// A textual representation of `Request`.
public var description: String { get }
}
/// Represents a source code declaration.
public struct SourceDeclaration {
public let type: SourceKittenFramework.ObjCDeclarationKind
public let location: SourceKittenFramework.SourceLocation
public let extent: (start: SourceKittenFramework.SourceLocation, end: SourceKittenFramework.SourceLocation)
public let name: String?
public let usr: String?
public let declaration: String?
public let documentation: SourceKittenFramework.Documentation?
public let commentBody: String?
public var children: [SourceKittenFramework.SourceDeclaration]
public let annotations: [String]?
public let swiftDeclaration: String?
public let swiftName: String?
public let availability: SourceKittenFramework.ClangAvailability?
/// Range
public var range: NSRange { get }
/// Returns the USR for the auto-generated getter for this property.
///
/// - warning: can only be invoked if `type == .Property`.
public var getterUSR: String { get }
/// Returns the USR for the auto-generated setter for this property.
///
/// - warning: can only be invoked if `type == .Property`.
public var setterUSR: String { get }
}
extension SourceDeclaration: Hashable {
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: Never call `finalize()` on `hasher`. Doing so may become a
/// compile-time error in the future.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher)
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (lhs: SourceKittenFramework.SourceDeclaration, rhs: SourceKittenFramework.SourceDeclaration) -> Bool
}
extension SourceDeclaration: Comparable {}
/// Swift representation of sourcekitd_object_t
public final class SourceKitObject {
/// Updates the value stored in the dictionary for the given key,
/// or adds a new key-value pair if the key does not exist.
///
/// - Parameters:
/// - value: The new value to add to the dictionary.
/// - key: The key to associate with value. If key already exists in the dictionary,
/// value replaces the existing associated value. If key isn't already a key of the dictionary
public func updateValue(_ value: SourceKittenFramework.SourceKitObjectConvertible, forKey key: SourceKittenFramework.UID)
public func updateValue(_ value: SourceKittenFramework.SourceKitObjectConvertible, forKey key: String)
public func updateValue<T>(_ value: SourceKittenFramework.SourceKitObjectConvertible, forKey key: T) where T: RawRepresentable, T.RawValue == String
}
extension SourceKitObject: SourceKittenFramework.SourceKitObjectConvertible {
public var sourceKitObject: SourceKittenFramework.SourceKitObject? { get }
}
extension SourceKitObject: CustomStringConvertible {
/// A textual representation of this instance.
///
/// Calling this property directly is discouraged. Instead, convert an
/// instance of any type to a string by using the `String(describing:)`
/// initializer. This initializer works with any type, and uses the custom
/// `description` property for types that conform to
/// `CustomStringConvertible`:
///
/// struct Point: CustomStringConvertible {
/// let x: Int, y: Int
///
/// var description: String {
/// return "(\(x), \(y))"
/// }
/// }
///
/// let p = Point(x: 21, y: 30)
/// let s = String(describing: p)
/// print(s)
/// // Prints "(21, 30)"
///
/// The conversion of `p` to a string in the assignment to `s` uses the
/// `Point` type's `description` property.
public var description: String { get }
}
extension SourceKitObject: ExpressibleByArrayLiteral {
/// Creates an instance initialized with the given elements.
public convenience init(arrayLiteral elements: SourceKittenFramework.SourceKitObject...)
}
extension SourceKitObject: ExpressibleByDictionaryLiteral {
/// Creates an instance initialized with the given key-value pairs.
public convenience init(dictionaryLiteral elements: (SourceKittenFramework.UID, SourceKittenFramework.SourceKitObjectConvertible)...)
}
extension SourceKitObject: ExpressibleByIntegerLiteral {
/// Creates an instance initialized to the specified integer value.
///
/// Do not call this initializer directly. Instead, initialize a variable or
/// constant using an integer literal. For example:
///
/// let x = 23
///
/// In this example, the assignment to the `x` constant calls this integer
/// literal initializer behind the scenes.
///
/// - Parameter value: The value to create.
public convenience init(integerLiteral value: IntegerLiteralType)
}
extension SourceKitObject: ExpressibleByStringLiteral {
/// Creates an instance initialized to the given string value.
///
/// - Parameter value: The value of the new instance.
public convenience init(stringLiteral value: StringLiteralType)
}
public protocol SourceKitObjectConvertible {
var sourceKitObject: SourceKittenFramework.SourceKitObject? { get }
}
public protocol SourceKitRepresentable {
func isEqualTo(_ rhs: SourceKittenFramework.SourceKitRepresentable) -> Bool
}
extension SourceKitRepresentable {
public func isEqualTo(_ rhs: SourceKittenFramework.SourceKitRepresentable) -> Bool
}
public struct SourceLocation {
public let file: String
public let line: UInt32
public let column: UInt32
public let offset: UInt32
public func range(toEnd end: SourceKittenFramework.SourceLocation) -> NSRange
}
extension SourceLocation: Comparable {}
/// Swift declaration kinds.
/// Found in `strings SourceKitService | grep source.lang.swift.stmt.`.
public enum StatementKind: String {
/// `brace`.
case brace
/// `case`.
case `case`
/// `for`.
case `for`
/// `foreach`.
case forEach
/// `guard`.
case `guard`
/// `if`.
case `if`
/// `repeatewhile`.
case repeatWhile
/// `switch`.
case `switch`
/// `while`.
case `while`
}
/// Represents the structural information in a Swift source file.
public struct Structure {
/// Structural information as an [String: SourceKitRepresentable].
public let dictionary: [String: SourceKittenFramework.SourceKitRepresentable]
/**
Create a Structure from a SourceKit `editor.open` response.
- parameter sourceKitResponse: SourceKit `editor.open` response.
*/
public init(sourceKitResponse: [String: SourceKittenFramework.SourceKitRepresentable])
/**
Initialize a Structure by passing in a File.
- parameter file: File to parse for structural information.
- throws: Request.Error
*/
public init(file: SourceKittenFramework.File) throws
}
extension Structure: CustomStringConvertible {
/// A textual JSON representation of `Structure`.
public var description: String { get }
}
extension Structure: Equatable {}
/// Swift declaration attribute kinds.
/// Found in `strings SourceKitService | grep source.decl.attribute.`.
public enum SwiftDeclarationAttributeKind: String, CaseIterable {
case ibaction
case iboutlet
case ibdesignable
case ibinspectable
case gkinspectable
case objc
case objcName
case silgenName
case available
case final
case required
case optional
case noreturn
case epxorted
case nsCopying
case nsManaged
case lazy
case lldbDebuggerFunction
case uiApplicationMain
case unsafeNoObjcTaggedPointer
case inline
case semantics
case dynamic
case infix
case prefix
case postfix
case transparent
case requiresStoredProperyInits
case nonobjc
case fixedLayout
case inlineable
case specialize
case objcMembers
case mutating
case nonmutating
case convenience
case override
case silStored
case weak
case effects
case objcBriged
case nsApplicationMain
case objcNonLazyRealization
case synthesizedProtocol
case testable
case alignment
case `rethrows`
case swiftNativeObjcRuntimeBase
case indirect
case warnUnqualifiedAccess
case cdecl
case versioned
case discardableResult
case implements
case objcRuntimeName
case staticInitializeObjCMetadata
case restatedObjCConformance
case `private`
case `fileprivate`
case `internal`
case `public`
case open
case setterPrivate
case setterFilePrivate
case setterInternal
case setterPublic
case setterOpen
case optimize
case consuming
case implicitlyUnwrappedOptional
case underscoredObjcNonLazyRealization
case clangImporterSynthesizedType
case forbidSerializingReference
case usableFromInline
case weakLinked
case inlinable
case dynamicMemberLookup
case frozen
case autoclosure
case noescape
case __raw_doc_comment
case __setter_access
case _borrowed
case _dynamicReplacement
case _effects
case _hasInitialValue
case _hasStorage
case _nonoverride
case _private
case _show_in_interface
case dynamicCallable
}
/// Swift declaration kinds.
/// Found in `strings SourceKitService | grep source.lang.swift.decl.`.
public enum SwiftDeclarationKind: String, CaseIterable {
/// `associatedtype`.
case `associatedtype`
/// `class`.
case `class`
/// `enum`.
case `enum`
/// `enumcase`.
case enumcase
/// `enumelement`.
case enumelement
/// `extension`.
case `extension`
/// `extension.class`.
case extensionClass
/// `extension.enum`.
case extensionEnum
/// `extension.protocol`.
case extensionProtocol
/// `extension.struct`.
case extensionStruct
/// `function.accessor.address`.
case functionAccessorAddress
/// `function.accessor.didset`.
case functionAccessorDidset
/// `function.accessor.getter`.
case functionAccessorGetter
case functionAccessorModify
/// `function.accessor.mutableaddress`.
case functionAccessorMutableaddress
case functionAccessorRead
/// `function.accessor.setter`.
case functionAccessorSetter
/// `function.accessor.willset`.
case functionAccessorWillset
/// `function.constructor`.
case functionConstructor
/// `function.destructor`.
case functionDestructor
/// `function.free`.
case functionFree
/// `function.method.class`.
case functionMethodClass
/// `function.method.instance`.
case functionMethodInstance
/// `function.method.static`.
case functionMethodStatic
case functionOperator
/// `function.operator.infix`.
case functionOperatorInfix
/// `function.operator.postfix`.
case functionOperatorPostfix
/// `function.operator.prefix`.
case functionOperatorPrefix
/// `function.subscript`.
case functionSubscript
/// `generic_type_param`.
case genericTypeParam
/// `module`.
case module
/// `precedencegroup`.
case precedenceGroup
/// `protocol`.
case `protocol`
/// `struct`.
case `struct`
/// `typealias`.