Skip to content

Commit dafb44f

Browse files
committed
code cleanup
1 parent cb96dcb commit dafb44f

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

client/modules/IDE/components/Editor/highlightStyle.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,4 @@ export const highlightStyle = HighlightStyle.define([
5151
{ tag: tags.link, class: 'cm-tag' },
5252
{ tag: tags.propertyName, class: 'cm-property' },
5353
{ tag: tags.attributeName, class: 'cm-attribute' }
54-
55-
// TODO(connie): Add p5 specific highlighting, like .p5-variable
56-
// There might be a way to do this with Lezer's special tags like
57-
// special(), definition(), const(), local()
5854
]);

client/modules/IDE/components/Editor/p5JavaScript.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ const p5Variables = new Set(Object.keys(p5VariableKeywords));
1616
const p5FunctionMark = Decoration.mark({ class: 'cm-p5-function' });
1717
const p5VariableMark = Decoration.mark({ class: 'cm-p5-variable' });
1818

19-
function buildDecorations(view) {
19+
// Used to add highlighting to the p5-specific keywords.
20+
function buildHighlightDecorations(view) {
2021
const builder = new RangeSetBuilder();
2122
view.visibleRanges.forEach(({ from, to }) => {
2223
syntaxTree(view.state).iterate({
@@ -41,12 +42,12 @@ function buildDecorations(view) {
4142
const p5Highlight = ViewPlugin.fromClass(
4243
class {
4344
constructor(view) {
44-
this.decorations = buildDecorations(view);
45+
this.decorations = buildHighlightDecorations(view);
4546
}
4647

4748
update(update) {
4849
if (update.docChanged || update.viewportChanged) {
49-
this.decorations = buildDecorations(update.view);
50+
this.decorations = buildHighlightDecorations(update.view);
5051
}
5152
}
5253
},

0 commit comments

Comments
 (0)