@@ -393,6 +393,68 @@ range ::=
393
393
394
394
Sub-diagnostics are only diagnostic notes currently.
395
395
396
+ # Demangling
397
+
398
+ SourceKit is capable of "demangling" mangled Swift symbols. In other words,
399
+ it's capable of taking the symbol ` _TF13MyCoolPackageg6raichuVS_7Pokemon ` as
400
+ input, and returning the human-readable
401
+ ` MyCoolPackage.raichu.getter : MyCoolPackage.Pokemon ` .
402
+
403
+ ### Request
404
+
405
+ ```
406
+ {
407
+ <key.request>: (UID) <source.request.demangle>,
408
+ <key.names>: [string*] // An array of names to demangle.
409
+ }
410
+ ```
411
+
412
+ ### Response
413
+
414
+ ```
415
+ {
416
+ <key.results>: (array) [demangle-result+] // The results for each
417
+ // demangling, in the order in
418
+ // which they were requested.
419
+ }
420
+ ```
421
+
422
+ ```
423
+ demangle-result ::=
424
+ {
425
+ <key.name>: (string) // The demangled name.
426
+ }
427
+ ```
428
+
429
+ ### Testing
430
+
431
+ ```
432
+ $ sourcekitd-test -req=demangle [<names>]
433
+ ```
434
+
435
+ For example, to demangle the symbol ` _TF13MyCoolPackageg6raichuVS_7Pokemon ` :
436
+
437
+ ```
438
+ $ sourcekitd-test -req=demangle _TF13MyCoolPackageg6raichuVS_7Pokemon
439
+ ```
440
+
441
+ Note that when using ` sourcekitd-test ` , the output is output in an ad hoc text
442
+ format, not JSON.
443
+
444
+ You could also issue the following request in the ` sourcekitd-repl ` , which
445
+ produces JSON:
446
+
447
+ ```
448
+ $ sourcekitd-repl
449
+ Welcome to SourceKit. Type ':help' for assistance.
450
+ (SourceKit) {
451
+ key.request: source.request.demangle,
452
+ key.names: [
453
+ "_TF13MyCoolPackageg6raichuVS_7Pokemon"
454
+ ]
455
+ }
456
+ ```
457
+
396
458
# UIDs
397
459
398
460
## Keys
@@ -410,4 +472,3 @@ Sub-diagnostics are only diagnostic notes currently.
410
472
- ` key.sourcetext `
411
473
- ` key.typename `
412
474
- ` key.usr `
413
-
0 commit comments