forked from balanceiskey/vsc-material-theme
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtoken_count.rb
25 lines (21 loc) · 923 Bytes
/
token_count.rb
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
require "atk_toolbox"
json_data = JSON.load(FS.read("./theme.json"))
language_endings = [ "markdown", "coffee", "ts", "js", "css", "sass", "scss", "less", "postcss", "json", "python", "c", "shell", "ruby", "go", "cpp", "assembly", "pug", "powershell", "haml", "html", "glsl", "dockerfile", "perl", "yaml", "php", "asm",]
all_scopes = Set.new
all_endings = Set.new
for each_obj in json_data["tokenColors"]
if each_obj["scope"].is_a?(Array)
for each_scope in each_obj["scope"]
for each_seperate_scope in each_scope.split(/\s+/)
dot_seperated = each_seperate_scope.split(/\./)
if language_endings.include?(dot_seperated[-1])
# remove the language ending
dot_seperated.pop()
end
all_scopes.add(dot_seperated.join("."))
end
end
end
end
p all_scopes.to_a
p all_scopes.size