From 19bf2bfcc864567dab54b1d5942dba380389e8e0 Mon Sep 17 00:00:00 2001 From: John Fairhurst Date: Sun, 18 Jun 2023 11:41:08 +0100 Subject: [PATCH 1/3] Add support for Swift macro declarations --- CHANGELOG.md | 5 ++++- lib/jazzy/source_declaration/type.rb | 4 ++++ lib/jazzy/symbol_graph/symbol.rb | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e3ad1f4b..d026bbf1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,10 @@ * Update Javascript: jQuery 3.6.3, KaTeX 0.16.4 [John Fairhurst](https://github.com/johnfairh) -* Support Swift 5.9 `package` access control level. +* Support Swift `package` access control level. + [John Fairhurst](https://github.com/johnfairh) + +* Support documenting Swift macro declarations. [John Fairhurst](https://github.com/johnfairh) ##### Bug Fixes diff --git a/lib/jazzy/source_declaration/type.rb b/lib/jazzy/source_declaration/type.rb index 26833ebc2..9a635d5b4 100644 --- a/lib/jazzy/source_declaration/type.rb +++ b/lib/jazzy/source_declaration/type.rb @@ -456,6 +456,10 @@ def ==(other) jazzy: 'Associated Type', dash: 'Alias', }.freeze, + 'source.lang.swift.decl.macro' => { + jazzy: 'Macro', + dash: 'Macro', + }.freeze, }.freeze end # rubocop:enable Metrics/ClassLength diff --git a/lib/jazzy/symbol_graph/symbol.rb b/lib/jazzy/symbol_graph/symbol.rb index 7429934c6..125a954b7 100644 --- a/lib/jazzy/symbol_graph/symbol.rb +++ b/lib/jazzy/symbol_graph/symbol.rb @@ -100,6 +100,7 @@ def init_func_signature(func_signature) 'typealias' => 'typealias', 'associatedtype' => 'associatedtype', 'actor' => 'actor', + 'macro' => 'macro', }.freeze # We treat 'static var' differently to 'class var' From ce66cb4d8fd7f640c6c03ab632c887d70ede08ae Mon Sep 17 00:00:00 2001 From: John Fairhurst Date: Mon, 7 Aug 2023 11:41:49 +0100 Subject: [PATCH 2/3] Add macro example to testcases --- spec/integration_spec.rb | 2 ++ spec/integration_specs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/integration_spec.rb b/spec/integration_spec.rb index 299d3d170..03dfe8725 100644 --- a/spec/integration_spec.rb +++ b/spec/integration_spec.rb @@ -119,6 +119,8 @@ def configure_cocoapods s.replace_pattern(/:0: remark.*?\n/, '') # CLIntegracon 0.8 s.replace_pattern(%r{/transformed/}, '/') + # Xcode 15 workaround + s.replace_pattern(/objc\[.....\]: Class _?DTX\w+ is implemented in both.*?\n/, '') end require 'shellwords' diff --git a/spec/integration_specs b/spec/integration_specs index c93ac7099..97fff62ee 160000 --- a/spec/integration_specs +++ b/spec/integration_specs @@ -1 +1 @@ -Subproject commit c93ac70995efdc651cd93e2f0d9f39d67af9538d +Subproject commit 97fff62eedb0645a93007852acad65d2f64a7742 From 4adc031877da3a6027e27f567becef135b85ef4e Mon Sep 17 00:00:00 2001 From: John Fairhurst Date: Mon, 7 Aug 2023 12:03:51 +0100 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d026bbf1e..9fc7fd577 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,8 @@ * Support Swift `package` access control level. [John Fairhurst](https://github.com/johnfairh) -* Support documenting Swift macro declarations. +* Initial support for Swift macro declarations. Requires + `--swift-build-tool symbolgraph`. [John Fairhurst](https://github.com/johnfairh) ##### Bug Fixes