jazzy 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +11 -1
- data/.travis.yml +2 -2
- data/CHANGELOG.md +51 -9
- data/Gemfile.lock +19 -22
- data/README.md +3 -3
- data/Rakefile +3 -2
- data/jazzy.gemspec +1 -1
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/SourceKittenFramework +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Commandant +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Commandant +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Resources/Info.plist +6 -6
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Result +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Versions/A/Resources/Info.plist +6 -6
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Versions/A/Result +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/SWXMLHash +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/Resources/Info.plist +5 -5
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/SWXMLHash +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftCore.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftCoreGraphics.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftDarwin.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftDispatch.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftFoundation.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftObjectiveC.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Resources/Info.plist +6 -6
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/SourceKittenFramework +0 -0
- data/lib/jazzy/SourceKitten/bin/sourcekitten +0 -0
- data/lib/jazzy/config.rb +44 -9
- data/lib/jazzy/doc_builder.rb +80 -34
- data/lib/jazzy/gem_version.rb +1 -1
- data/lib/jazzy/jazzy_markdown.rb +3 -5
- data/lib/jazzy/podspec_documenter.rb +8 -8
- data/lib/jazzy/source_declaration.rb +7 -0
- data/lib/jazzy/source_declaration/access_control_level.rb +3 -3
- data/lib/jazzy/source_declaration/type.rb +35 -3
- data/lib/jazzy/source_mark.rb +1 -1
- data/lib/jazzy/sourcekitten.rb +28 -13
- data/spec/integration_spec.rb +12 -5
- metadata +4 -11
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Curry.framework/Curry +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Curry.framework/Versions/A/Curry +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Curry.framework/Versions/A/Resources/Info.plist +0 -49
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SwiftXPC.framework/SwiftXPC +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SwiftXPC.framework/Versions/A/Resources/Info.plist +0 -46
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SwiftXPC.framework/Versions/A/SwiftXPC +0 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<plist version="1.0">
|
4
4
|
<dict>
|
5
5
|
<key>BuildMachineOSBuild</key>
|
6
|
-
<string>
|
6
|
+
<string>15E65</string>
|
7
7
|
<key>CFBundleDevelopmentRegion</key>
|
8
8
|
<string>en</string>
|
9
9
|
<key>CFBundleExecutable</key>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<key>CFBundlePackageType</key>
|
18
18
|
<string>FMWK</string>
|
19
19
|
<key>CFBundleShortVersionString</key>
|
20
|
-
<string>0.
|
20
|
+
<string>0.12.0</string>
|
21
21
|
<key>CFBundleSignature</key>
|
22
22
|
<string>????</string>
|
23
23
|
<key>CFBundleSupportedPlatforms</key>
|
@@ -29,17 +29,17 @@
|
|
29
29
|
<key>DTCompiler</key>
|
30
30
|
<string>com.apple.compilers.llvm.clang.1_0</string>
|
31
31
|
<key>DTPlatformBuild</key>
|
32
|
-
<string>
|
32
|
+
<string>7D175</string>
|
33
33
|
<key>DTPlatformVersion</key>
|
34
34
|
<string>GM</string>
|
35
35
|
<key>DTSDKBuild</key>
|
36
|
-
<string>
|
36
|
+
<string>15E60</string>
|
37
37
|
<key>DTSDKName</key>
|
38
38
|
<string>macosx10.11</string>
|
39
39
|
<key>DTXcode</key>
|
40
|
-
<string>
|
40
|
+
<string>0730</string>
|
41
41
|
<key>DTXcodeBuild</key>
|
42
|
-
<string>
|
42
|
+
<string>7D175</string>
|
43
43
|
<key>NSHumanReadableCopyright</key>
|
44
44
|
<string>Copyright © 2015 SourceKitten. All rights reserved.</string>
|
45
45
|
</dict>
|
Binary file
|
Binary file
|
data/lib/jazzy/config.rb
CHANGED
@@ -11,15 +11,17 @@ module Jazzy
|
|
11
11
|
class Config
|
12
12
|
# rubocop:disable Style/AccessorMethodName
|
13
13
|
class Attribute
|
14
|
-
attr_reader :name, :description, :command_line, :
|
14
|
+
attr_reader :name, :description, :command_line, :config_file_key,
|
15
|
+
:default, :parse
|
15
16
|
|
16
17
|
def initialize(name, description: nil, command_line: nil,
|
17
18
|
default: nil, parse: ->(x) { x })
|
18
|
-
@name = name
|
19
|
+
@name = name.to_s
|
19
20
|
@description = Array(description)
|
20
21
|
@command_line = Array(command_line)
|
21
22
|
@default = default
|
22
23
|
@parse = parse
|
24
|
+
@config_file_key = full_command_line_name || @name
|
23
25
|
end
|
24
26
|
|
25
27
|
def get(config)
|
@@ -53,6 +55,21 @@ module Jazzy
|
|
53
55
|
set(config, val)
|
54
56
|
end
|
55
57
|
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def full_command_line_name
|
62
|
+
long_option_names = command_line.map do |opt|
|
63
|
+
Regexp.last_match(1) if opt =~ %r{
|
64
|
+
^-- # starts with double dash
|
65
|
+
(?:\[no-\])? # optional prefix for booleans
|
66
|
+
([^\s]+) # long option name
|
67
|
+
}x
|
68
|
+
end
|
69
|
+
if long_option_name = long_option_names.compact.first
|
70
|
+
long_option_name.tr('-', '_')
|
71
|
+
end
|
72
|
+
end
|
56
73
|
end
|
57
74
|
# rubocop:enable Style/AccessorMethodName
|
58
75
|
|
@@ -142,7 +159,7 @@ module Jazzy
|
|
142
159
|
|
143
160
|
config_attr :swift_version,
|
144
161
|
command_line: '--swift-version VERSION',
|
145
|
-
default: '2.
|
162
|
+
default: '2.2',
|
146
163
|
parse: ->(v) do
|
147
164
|
raise 'jazzy only supports Swift 2.0 or later.' if v.to_f < 2
|
148
165
|
v
|
@@ -221,6 +238,11 @@ module Jazzy
|
|
221
238
|
|
222
239
|
# ──────── Doc generation options ────────
|
223
240
|
|
241
|
+
config_attr :skip_documentation,
|
242
|
+
command_line: '--skip-documentation',
|
243
|
+
description: 'Will skip the documentation generation phase.',
|
244
|
+
default: false
|
245
|
+
|
224
246
|
config_attr :min_acl,
|
225
247
|
command_line: '--min-acl [private | internal | public]',
|
226
248
|
description: 'minimum access control level to document',
|
@@ -237,7 +259,7 @@ module Jazzy
|
|
237
259
|
|
238
260
|
config_attr :hide_documentation_coverage,
|
239
261
|
command_line: '--[no-]hide-documentation-coverage',
|
240
|
-
description:
|
262
|
+
description: 'Hide "(X% documented)" from the generated documents',
|
241
263
|
default: false
|
242
264
|
|
243
265
|
config_attr :custom_categories,
|
@@ -346,11 +368,24 @@ module Jazzy
|
|
346
368
|
|
347
369
|
puts "Using config file #{config_path}"
|
348
370
|
config_file = read_config_file(config_path)
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
371
|
+
|
372
|
+
attrs_by_conf_key, attrs_by_name = %i(config_file_key name).map do |prop|
|
373
|
+
self.class.all_config_attrs.group_by(&prop)
|
374
|
+
end
|
375
|
+
|
376
|
+
config_file.each do |key, value|
|
377
|
+
unless attr = attrs_by_conf_key[key]
|
378
|
+
message = "WARNING: Unknown config file attribute #{key.inspect}"
|
379
|
+
if matching_name = attrs_by_name[key]
|
380
|
+
message << ' (Did you mean '
|
381
|
+
message << matching_name.first.config_file_key.inspect
|
382
|
+
message << '?)'
|
383
|
+
end
|
384
|
+
warn message
|
385
|
+
next
|
353
386
|
end
|
387
|
+
|
388
|
+
attr.first.set_if_unconfigured(self, value)
|
354
389
|
end
|
355
390
|
|
356
391
|
self.base_path = nil
|
@@ -404,7 +439,7 @@ module Jazzy
|
|
404
439
|
puts
|
405
440
|
puts attr.name.to_s.tr('_', ' ').upcase
|
406
441
|
puts
|
407
|
-
puts " Config file: #{attr.
|
442
|
+
puts " Config file: #{attr.config_file_key}"
|
408
443
|
cmd_line_forms = attr.command_line.select { |opt| opt.is_a?(String) }
|
409
444
|
if cmd_line_forms.any?
|
410
445
|
puts " Command line: #{cmd_line_forms.join(', ')}"
|
data/lib/jazzy/doc_builder.rb
CHANGED
@@ -30,9 +30,8 @@ module Jazzy
|
|
30
30
|
def self.doc_structure_for_docs(docs)
|
31
31
|
docs.map do |doc|
|
32
32
|
children = doc.children
|
33
|
-
|
34
|
-
|
35
|
-
.map do |child|
|
33
|
+
.sort_by { |c| [c.nav_order, c.name] }
|
34
|
+
.map do |child|
|
36
35
|
{ name: child.name, url: child.url }
|
37
36
|
end
|
38
37
|
{
|
@@ -64,7 +63,7 @@ module Jazzy
|
|
64
63
|
exit $?.exitstatus || 1
|
65
64
|
end
|
66
65
|
end
|
67
|
-
|
66
|
+
|
68
67
|
build_docs_for_sourcekitten_output(stdout, options)
|
69
68
|
end
|
70
69
|
|
@@ -99,19 +98,8 @@ module Jazzy
|
|
99
98
|
end
|
100
99
|
end
|
101
100
|
|
102
|
-
|
103
|
-
|
104
|
-
# @param [Config] options Build options
|
105
|
-
# @return [SourceModule] the documented source module
|
106
|
-
def self.build_docs_for_sourcekitten_output(sourcekitten_output, options)
|
107
|
-
output_dir = options.output
|
108
|
-
prepare_output_dir(output_dir, options.clean)
|
109
|
-
|
110
|
-
(docs, coverage, undocumented) = SourceKitten.parse(
|
111
|
-
sourcekitten_output,
|
112
|
-
options.min_acl,
|
113
|
-
options.skip_undocumented,
|
114
|
-
)
|
101
|
+
def self.build_site(docs, coverage, options)
|
102
|
+
warn 'building site'
|
115
103
|
|
116
104
|
structure = doc_structure_for_docs(docs)
|
117
105
|
|
@@ -121,9 +109,9 @@ module Jazzy
|
|
121
109
|
end
|
122
110
|
|
123
111
|
source_module = SourceModule.new(options, docs, structure, coverage)
|
124
|
-
build_docs(output_dir, source_module.docs, source_module)
|
125
112
|
|
126
|
-
|
113
|
+
output_dir = options.output
|
114
|
+
build_docs(output_dir, source_module.docs, source_module)
|
127
115
|
|
128
116
|
copy_assets(output_dir)
|
129
117
|
|
@@ -135,6 +123,25 @@ module Jazzy
|
|
135
123
|
source_module
|
136
124
|
end
|
137
125
|
|
126
|
+
# Build docs given sourcekitten output
|
127
|
+
# @param [String] sourcekitten_output Output of sourcekitten command
|
128
|
+
# @param [Config] options Build options
|
129
|
+
# @return [SourceModule] the documented source module
|
130
|
+
def self.build_docs_for_sourcekitten_output(sourcekitten_output, options)
|
131
|
+
(docs, coverage, undocumented) = SourceKitten.parse(
|
132
|
+
sourcekitten_output,
|
133
|
+
options.min_acl,
|
134
|
+
options.skip_undocumented,
|
135
|
+
)
|
136
|
+
|
137
|
+
prepare_output_dir(options.output, options.clean)
|
138
|
+
write_lint_report(undocumented, options)
|
139
|
+
|
140
|
+
unless options.skip_documentation
|
141
|
+
build_site(docs, coverage, options)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
138
145
|
def self.relative_path_if_inside(path, base_path)
|
139
146
|
relative = path.relative_path_from(base_path)
|
140
147
|
if relative.to_path =~ %r{/^..(\/|$)/}
|
@@ -156,8 +163,40 @@ module Jazzy
|
|
156
163
|
end
|
157
164
|
end
|
158
165
|
|
159
|
-
def self.
|
160
|
-
|
166
|
+
def self.filepath_for_token(token)
|
167
|
+
if ENV['JAZZY_INTEGRATION_SPECS']
|
168
|
+
Pathname.new(token['key.filepath']).basename.to_s
|
169
|
+
else
|
170
|
+
token['key.filepath']
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def self.line_number_for_token(token)
|
175
|
+
if token['key.doc.line']
|
176
|
+
token['key.doc.line'] # Objective-C
|
177
|
+
else
|
178
|
+
token['key.parsed_scope.start'] # Swift
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
def self.warnings_for_tokens(tokens_by_file)
|
183
|
+
warnings = []
|
184
|
+
tokens_by_file.each_key do |file|
|
185
|
+
tokens_by_file[file].each do |token|
|
186
|
+
warnings << {
|
187
|
+
file: filepath_for_token(token),
|
188
|
+
line: line_number_for_token(token),
|
189
|
+
symbol: token['key.name'],
|
190
|
+
symbol_kind: token['key.kind'],
|
191
|
+
warning: 'undocumented',
|
192
|
+
}
|
193
|
+
end
|
194
|
+
end
|
195
|
+
warnings
|
196
|
+
end
|
197
|
+
|
198
|
+
def self.write_lint_report(undocumented, options)
|
199
|
+
(options.output + 'undocumented.json').open('w') do |f|
|
161
200
|
tokens_by_file = undocumented.group_by do |d|
|
162
201
|
if d['key.filepath']
|
163
202
|
Pathname.new(d['key.filepath']).basename.to_s
|
@@ -165,12 +204,19 @@ module Jazzy
|
|
165
204
|
d['key.modulename'] || ''
|
166
205
|
end
|
167
206
|
end
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
207
|
+
|
208
|
+
warnings = warnings_for_tokens(tokens_by_file)
|
209
|
+
|
210
|
+
lint_report = {
|
211
|
+
warnings: warnings,
|
212
|
+
source_directory: (
|
213
|
+
if ENV['JAZZY_INTEGRATION_SPECS']
|
214
|
+
'Specs'
|
215
|
+
else
|
216
|
+
options.source_directory
|
217
|
+
end),
|
218
|
+
}
|
219
|
+
f.write(lint_report.to_json)
|
174
220
|
end
|
175
221
|
end
|
176
222
|
|
@@ -221,11 +267,11 @@ module Jazzy
|
|
221
267
|
def self.gh_token_url(item, source_module)
|
222
268
|
return unless github_prefix = source_module.github_file_prefix
|
223
269
|
return unless should_link_to_github(item.file)
|
224
|
-
if item.start_line && (item.start_line != item.end_line)
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
270
|
+
gh_line = if item.start_line && (item.start_line != item.end_line)
|
271
|
+
"#L#{item.start_line}-L#{item.end_line}"
|
272
|
+
else
|
273
|
+
"#L#{item.line}"
|
274
|
+
end
|
229
275
|
relative_file_path = item.file.realpath.relative_path_from(
|
230
276
|
source_module.root_path)
|
231
277
|
"#{github_prefix}/#{relative_file_path}#{gh_line}"
|
@@ -278,10 +324,10 @@ module Jazzy
|
|
278
324
|
marks.map do |mark|
|
279
325
|
mark_children = children.select { |child| child.mark == mark }
|
280
326
|
items = mark_children.map { |child| render_item(child, source_module) }
|
281
|
-
uid =
|
327
|
+
uid = (mark.name || 'Unnamed').to_s
|
282
328
|
if mark_names_counts.key?(uid)
|
283
329
|
mark_names_counts[uid] += 1
|
284
|
-
uid +=
|
330
|
+
uid += (mark_names_counts[uid]).to_s
|
285
331
|
else
|
286
332
|
mark_names_counts[uid] = 1
|
287
333
|
end
|
data/lib/jazzy/gem_version.rb
CHANGED
data/lib/jazzy/jazzy_markdown.rb
CHANGED
@@ -9,9 +9,9 @@ module Jazzy
|
|
9
9
|
|
10
10
|
def header(text, header_level)
|
11
11
|
text_slug = text.gsub(/[^a-zA-Z0-9]+/, '_')
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
.downcase
|
13
|
+
.sub(/^_/, '')
|
14
|
+
.sub(/_$/, '')
|
15
15
|
|
16
16
|
"<a href='##{text_slug}' class='anchor' aria-hidden=true>" \
|
17
17
|
'<span class="header-anchor"></span>' \
|
@@ -44,7 +44,6 @@ module Jazzy
|
|
44
44
|
Version
|
45
45
|
Warning).freeze
|
46
46
|
|
47
|
-
# rubocop:disable RegexpLiteral
|
48
47
|
SPECIAL_LIST_TYPE_REGEX = %r{
|
49
48
|
\A\s* # optional leading spaces
|
50
49
|
(<p>\s*)? # optional opening p tag
|
@@ -52,7 +51,6 @@ module Jazzy
|
|
52
51
|
(#{SPECIAL_LIST_TYPES.map(&Regexp.method(:escape)).join('|')})
|
53
52
|
[\s:] # followed by either a space or a colon
|
54
53
|
}ix
|
55
|
-
# rubocop:enable RegexpLiteral
|
56
54
|
|
57
55
|
ELIDED_LI_TOKEN = '7wNVzLB0OYPL2eGlPKu8q4vITltqh0Y6DPZf659TPMAeYh49o'.freeze
|
58
56
|
|
@@ -16,7 +16,7 @@ module Jazzy
|
|
16
16
|
stdout = Dir.chdir(sandbox.root) do
|
17
17
|
pod_targets.map do |t|
|
18
18
|
SourceKitten.run_sourcekitten(
|
19
|
-
%W(doc --module-name #{podspec.module_name} -target #{t})
|
19
|
+
%W(doc --module-name #{podspec.module_name} -- -target #{t}),
|
20
20
|
)
|
21
21
|
end
|
22
22
|
end
|
@@ -62,15 +62,13 @@ module Jazzy
|
|
62
62
|
def self.author_name(podspec)
|
63
63
|
if podspec.authors.respond_to? :to_hash
|
64
64
|
podspec.authors.keys.to_sentence || ''
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
else
|
69
|
-
podspec.authors
|
70
|
-
end
|
71
|
-
end || ''
|
65
|
+
elsif podspec.authors.respond_to? :to_ary
|
66
|
+
podspec.authors.to_sentence
|
67
|
+
end || podspec.authors || ''
|
72
68
|
end
|
73
69
|
|
70
|
+
private_class_method :author_name
|
71
|
+
|
74
72
|
def self.github_file_prefix(podspec)
|
75
73
|
return unless podspec.source[:url] =~ %r{github.com[:/]+(.+)/(.+)}
|
76
74
|
org, repo = Regexp.last_match
|
@@ -80,6 +78,8 @@ module Jazzy
|
|
80
78
|
"https://github.com/#{org}/#{repo}/blob/#{rev}"
|
81
79
|
end
|
82
80
|
|
81
|
+
private_class_method :github_file_prefix
|
82
|
+
|
83
83
|
# @!group SourceKitten output helper methods
|
84
84
|
|
85
85
|
attr_reader :pod_targets
|
@@ -41,6 +41,13 @@ module Jazzy
|
|
41
41
|
namespace_path.map(&:name).join('.')
|
42
42
|
end
|
43
43
|
|
44
|
+
# If this declaration is an objc category, returns an array with the name
|
45
|
+
# of the extended objc class and the category name itself, i.e.
|
46
|
+
# ["NSString", "MyMethods"], nil otherwise.
|
47
|
+
def objc_category_name
|
48
|
+
name.split(/[\(\)]/) if type.objc_category?
|
49
|
+
end
|
50
|
+
|
44
51
|
attr_accessor :file
|
45
52
|
attr_accessor :line
|
46
53
|
attr_accessor :column
|
@@ -5,9 +5,9 @@ module Jazzy
|
|
5
5
|
|
6
6
|
attr_reader :level
|
7
7
|
|
8
|
-
ACCESSIBILITY_PRIVATE = 'source.lang.swift.accessibility.private'
|
9
|
-
ACCESSIBILITY_INTERNAL = 'source.lang.swift.accessibility.internal'
|
10
|
-
ACCESSIBILITY_PUBLIC = 'source.lang.swift.accessibility.public'
|
8
|
+
ACCESSIBILITY_PRIVATE = 'source.lang.swift.accessibility.private'.freeze
|
9
|
+
ACCESSIBILITY_INTERNAL = 'source.lang.swift.accessibility.internal'.freeze
|
10
|
+
ACCESSIBILITY_PUBLIC = 'source.lang.swift.accessibility.public'.freeze
|
11
11
|
|
12
12
|
def initialize(accessibility)
|
13
13
|
@level = case accessibility
|
@@ -40,6 +40,14 @@ module Jazzy
|
|
40
40
|
kind == 'sourcekitten.source.lang.objc.decl.typedef'
|
41
41
|
end
|
42
42
|
|
43
|
+
def objc_category?
|
44
|
+
kind == 'sourcekitten.source.lang.objc.decl.category'
|
45
|
+
end
|
46
|
+
|
47
|
+
def objc_class?
|
48
|
+
kind == 'sourcekitten.source.lang.objc.decl.class'
|
49
|
+
end
|
50
|
+
|
43
51
|
def swift_enum_case?
|
44
52
|
kind == 'source.lang.swift.decl.enumcase'
|
45
53
|
end
|
@@ -53,8 +61,12 @@ module Jazzy
|
|
53
61
|
end
|
54
62
|
|
55
63
|
def declaration?
|
56
|
-
kind.start_with?('source.lang.swift.decl'
|
57
|
-
|
64
|
+
kind.start_with?('source.lang.swift.decl',
|
65
|
+
'sourcekitten.source.lang.objc.decl')
|
66
|
+
end
|
67
|
+
|
68
|
+
def extension?
|
69
|
+
swift_extension? || objc_category?
|
58
70
|
end
|
59
71
|
|
60
72
|
def swift_extension?
|
@@ -84,7 +96,7 @@ module Jazzy
|
|
84
96
|
kind.hash
|
85
97
|
end
|
86
98
|
|
87
|
-
|
99
|
+
alias equals ==
|
88
100
|
def ==(other)
|
89
101
|
other && kind == other.kind
|
90
102
|
end
|
@@ -156,6 +168,10 @@ module Jazzy
|
|
156
168
|
jazzy: 'Ivar',
|
157
169
|
dash: 'Ivar',
|
158
170
|
}.freeze,
|
171
|
+
'sourcekitten.source.lang.objc.module.import' => {
|
172
|
+
jazzy: 'Module',
|
173
|
+
dash: 'Module',
|
174
|
+
}.freeze,
|
159
175
|
|
160
176
|
# Swift
|
161
177
|
'source.lang.swift.decl.function.accessor.address' => {
|
@@ -186,6 +202,18 @@ module Jazzy
|
|
186
202
|
jazzy: 'Operator',
|
187
203
|
dash: 'Function',
|
188
204
|
}.freeze,
|
205
|
+
'source.lang.swift.decl.function.operator.infix' => {
|
206
|
+
jazzy: 'Infix Operator',
|
207
|
+
dash: 'Function',
|
208
|
+
}.freeze,
|
209
|
+
'source.lang.swift.decl.function.operator.postfix' => {
|
210
|
+
jazzy: 'Postfix Operator',
|
211
|
+
dash: 'Function',
|
212
|
+
}.freeze,
|
213
|
+
'source.lang.swift.decl.function.operator.prefix' => {
|
214
|
+
jazzy: 'Prefix Operator',
|
215
|
+
dash: 'Function',
|
216
|
+
}.freeze,
|
189
217
|
'source.lang.swift.decl.function.method.class' => {
|
190
218
|
jazzy: 'Class Method',
|
191
219
|
dash: 'Method',
|
@@ -290,6 +318,10 @@ module Jazzy
|
|
290
318
|
jazzy: 'Generic Type Parameter',
|
291
319
|
dash: 'Parameter',
|
292
320
|
}.freeze,
|
321
|
+
'source.lang.swift.decl.associatedtype' => {
|
322
|
+
jazzy: 'Associated Type',
|
323
|
+
dash: 'Alias',
|
324
|
+
}.freeze,
|
293
325
|
}.freeze
|
294
326
|
end
|
295
327
|
# rubocop:enable Metrics/ClassLength
|