File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
Sources/SourceKitLSP/Swift Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,16 @@ fileprivate final class DocumentSymbolsFinder: SyntaxAnyVisitor {
170
170
return . skipChildren
171
171
}
172
172
173
+ override func visit( _ node: DeinitializerDeclSyntax ) -> SyntaxVisitorContinueKind {
174
+ return record (
175
+ node: node,
176
+ name: node. deinitKeyword. text,
177
+ symbolKind: . null,
178
+ range: node. rangeWithoutTrivia,
179
+ selection: node. deinitKeyword. rangeWithoutTrivia
180
+ )
181
+ }
182
+
173
183
override func visit( _ node: EnumCaseElementSyntax ) -> SyntaxVisitorContinueKind {
174
184
let rangeEnd =
175
185
if let parameterClause = node. parameterClause {
Original file line number Diff line number Diff line change @@ -729,6 +729,35 @@ final class DocumentSymbolTests: XCTestCase {
729
729
]
730
730
}
731
731
}
732
+
733
+ func testShowDeinit( ) async throws {
734
+ try await assertDocumentSymbols (
735
+ """
736
+ 1️⃣class 2️⃣Foo3️⃣ {
737
+ 4️⃣deinit5️⃣ {
738
+ }6️⃣
739
+ }7️⃣
740
+ """
741
+ ) { positions in
742
+ [
743
+ DocumentSymbol (
744
+ name: " Foo " ,
745
+ kind: . class,
746
+ range: positions [ " 1️⃣ " ] ..< positions [ " 7️⃣ " ] ,
747
+ selectionRange: positions [ " 2️⃣ " ] ..< positions [ " 3️⃣ " ] ,
748
+ children: [
749
+ DocumentSymbol (
750
+ name: " deinit " ,
751
+ kind: . null,
752
+ range: positions [ " 4️⃣ " ] ..< positions [ " 6️⃣ " ] ,
753
+ selectionRange: positions [ " 4️⃣ " ] ..< positions [ " 5️⃣ " ] ,
754
+ children: [ ]
755
+ )
756
+ ]
757
+ )
758
+ ]
759
+ }
760
+ }
732
761
}
733
762
734
763
fileprivate func assertDocumentSymbols(
You can’t perform that action at this time.
0 commit comments