Skip to content

Commit 842df81

Browse files
committed
update hinter utils
1 parent ee77cd5 commit 842df81

File tree

4 files changed

+83
-73
lines changed

4 files changed

+83
-73
lines changed

client/modules/IDE/components/show-hint.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@
283283
<span class="hint-hidden">, </span>\
284284
${
285285
p5
286-
? `<a href="https://p5js.org/reference/#/p5/${name}" role="link" onclick="event.stopPropagation()" target="_blank">\
286+
? `<a href="https://p5js.org/reference/#/p5/${
287+
typeof p5 === 'string' ? p5 : name
288+
}" role="link" onclick="event.stopPropagation()" target="_blank">\
287289
<span class="hint-hidden">open ${name} reference</span>\
288290
<span aria-hidden="true">&#10132;</span></a>`
289291
: `<span class="no-link-placeholder"><span class="hint-hidden">no reference for ${name}</span></span>`

client/styles/components/_hints.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
color: getThemifyVariable('hint-fun-text-color');
3636
}
3737

38-
.var-name {
38+
.var-name, .boolean-name {
3939
color: getThemifyVariable('hint-var-text-color');
4040
}
4141

@@ -88,7 +88,7 @@
8888
background-color: getThemifyVariable('hint-fun-text-color');
8989
}
9090

91-
.var-name {
91+
.var-name, .boolean-name {
9292
background-color: getThemifyVariable('hint-var-text-color');
9393
}
9494

client/utils/p5-hinter.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/scripts/update-p5-hinter.js

Lines changed: 77 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -7,74 +7,74 @@ const axios = require('axios');
77
// };
88

99
const reservedKeywords = [
10-
'await',
11-
'break',
12-
'case',
13-
'catch',
14-
'class',
15-
'const',
16-
'continue',
17-
'debugger',
18-
'default',
19-
'delete',
20-
'do',
21-
'else',
22-
'export',
23-
'extends',
24-
'finally',
25-
'for',
26-
'function',
27-
'if',
28-
'import',
29-
'in',
30-
'instanceof',
31-
'new',
32-
'return',
33-
'super',
34-
'switch',
35-
'this',
36-
'throw',
37-
'try',
38-
'typeof',
39-
'var',
40-
'void',
41-
'while',
42-
'with',
43-
'yield',
44-
'let'
10+
{ name: 'await', p5DocPath: false },
11+
{ name: 'break', p5DocPath: false },
12+
{ name: 'case', p5DocPath: false },
13+
{ name: 'catch', p5DocPath: false },
14+
{ name: 'class', p5DocPath: 'class' },
15+
{ name: 'const', p5DocPath: 'const' },
16+
{ name: 'continue', p5DocPath: false },
17+
{ name: 'debugger', p5DocPath: false },
18+
{ name: 'default', p5DocPath: false },
19+
{ name: 'delete', p5DocPath: false },
20+
{ name: 'do', p5DocPath: false },
21+
{ name: 'else', p5DocPath: 'if-else' },
22+
{ name: 'export', p5DocPath: false },
23+
{ name: 'extends', p5DocPath: false },
24+
{ name: 'finally', p5DocPath: false },
25+
{ name: 'for', p5DocPath: 'for' },
26+
{ name: 'function', p5DocPath: 'function' },
27+
{ name: 'if', p5DocPath: 'if-else' },
28+
{ name: 'import', p5DocPath: false },
29+
{ name: 'in', p5DocPath: false },
30+
{ name: 'instanceof', p5DocPath: false },
31+
{ name: 'new', p5DocPath: false },
32+
{ name: 'return', p5DocPath: 'return' },
33+
{ name: 'super', p5DocPath: false },
34+
{ name: 'switch', p5DocPath: false },
35+
{ name: 'this', p5DocPath: false },
36+
{ name: 'throw', p5DocPath: false },
37+
{ name: 'try', p5DocPath: false },
38+
{ name: 'typeof', p5DocPath: false },
39+
{ name: 'var', p5DocPath: false },
40+
{ name: 'void', p5DocPath: false },
41+
{ name: 'while', p5DocPath: 'while' },
42+
{ name: 'with', p5DocPath: false },
43+
{ name: 'yield', p5DocPath: false },
44+
{ name: 'let', p5DocPath: 'let' }
4545
];
4646

4747
const reservedObjects = [
48-
'Array',
49-
'Boolean',
50-
'Date',
51-
'Error',
52-
'Function',
53-
'JSON',
54-
'Math',
55-
'Number',
56-
'Object',
57-
'RegExp',
58-
'String',
59-
'Promise',
60-
'Set',
61-
'Map',
62-
'Symbol',
63-
'WeakMap',
64-
'WeakSet',
65-
'ArrayBuffer',
66-
'DataView',
67-
'Int32Array',
68-
'Uint32Array',
69-
'Float32Array',
70-
'window',
71-
'document',
72-
'navigator',
73-
'console',
74-
'localStorage',
75-
'sessionStorage',
76-
'history',
77-
'location'
48+
{ name: 'Array', p5DocPath: false },
49+
{ name: 'Boolean', p5DocPath: false },
50+
{ name: 'Date', p5DocPath: false },
51+
{ name: 'Error', p5DocPath: false },
52+
{ name: 'Function', p5DocPath: false },
53+
{ name: 'JSON', p5DocPath: 'JSON' },
54+
{ name: 'Math', p5DocPath: false },
55+
{ name: 'Number', p5DocPath: false },
56+
{ name: 'Object', p5DocPath: false },
57+
{ name: 'RegExp', p5DocPath: false },
58+
{ name: 'String', p5DocPath: false },
59+
{ name: 'Promise', p5DocPath: false },
60+
{ name: 'Set', p5DocPath: false },
61+
{ name: 'Map', p5DocPath: false },
62+
{ name: 'Symbol', p5DocPath: false },
63+
{ name: 'WeakMap', p5DocPath: false },
64+
{ name: 'WeakSet', p5DocPath: false },
65+
{ name: 'ArrayBuffer', p5DocPath: false },
66+
{ name: 'DataView', p5DocPath: false },
67+
{ name: 'Int32Array', p5DocPath: false },
68+
{ name: 'Uint32Array', p5DocPath: false },
69+
{ name: 'Float32Array', p5DocPath: false },
70+
{ name: 'window', p5DocPath: false },
71+
{ name: 'document', p5DocPath: false },
72+
{ name: 'navigator', p5DocPath: false },
73+
{ name: 'console', p5DocPath: 'console' },
74+
{ name: 'localStorage', p5DocPath: false },
75+
{ name: 'sessionStorage', p5DocPath: false },
76+
{ name: 'history', p5DocPath: false },
77+
{ name: 'location', p5DocPath: false }
7878
];
7979

8080
axios
@@ -114,19 +114,27 @@ axios
114114
}
115115
});
116116

117+
['true', 'false'].forEach((bol) => {
118+
p5Keywords.push({
119+
text: bol,
120+
type: 'boolean',
121+
p5: 'boolean'
122+
});
123+
});
124+
117125
reservedKeywords.forEach((keyword) => {
118126
p5Keywords.push({
119-
text: keyword,
127+
text: keyword.name,
120128
type: 'keyword',
121-
p5: false
129+
p5: keyword.p5DocPath
122130
});
123131
});
124132

125133
reservedObjects.forEach((keyword) => {
126134
p5Keywords.push({
127-
text: keyword,
135+
text: keyword.name,
128136
type: 'obj',
129-
p5: false
137+
p5: keyword.p5DocPath
130138
});
131139
});
132140

0 commit comments

Comments
 (0)