p5.js-web-editor icon indicating copy to clipboard operation
p5.js-web-editor copied to clipboard

Add Syntax Highlighting for p5.js Variables

Open raclim opened this issue 9 months ago • 10 comments

Notes

This issue is part of the ongoing work to upgrade CodeMirror from v5 to v6 (see the parent issue for additional context). This also references the develop-codemirror-v6 branch for development, and not the main develop branch.

Background

In the p5.js Editor, variables and functions from the p5.js library are visually highlighted to make them easier to identify while coding. For example, p5.js functions have bold text, while p5.js variables have bold text and a pink color.

At the moment, this highlighting is missing in the CodeMirror v6 branch. Here are two screenshots below showing what the editor looks like with and without syntax highlighting.

With Syntax Highlighting - Current p5.js Editor: Image

Without Syntax Highlighting - CodeMirror v6 Branch: Image

Implementation

We'd like to add syntax highlighting for p5.js-specific keywords back in to help make distinguishing p5.js from regular JavaScript easier. It should look like:

  • p5.js Functions: bolded text
  • p5.js Variables: bolded text and pink text color

Updated styling should be added on line 55 within client/modules/IDE/components/Editor/highlightStyle.js. These changes should mirror current editor behavior.

Suggestions to Start

  • Review how styles are currently applied within highlightStyle.js to understand how they're setup.
  • The p5.js Editor is a great reference to check and confirm what the expected colors and emphasis for specific keywords should be.
  • You can also use the p5.js Reference to see a full list of all p5.js functions and variables.

raclim avatar Feb 13 '26 15:02 raclim

Please note: This issue is reserved for CodeDay Contributors, and is not open for general contribution—for these, please check out issues that do not have the "CodeDay" or "On Hold" label!

ksen0 avatar Feb 13 '26 16:02 ksen0

I'm working on this. :)

PeterKamau24 avatar Mar 03 '26 03:03 PeterKamau24

Hi @PeterKamau24 ! Can you confirm if you're coming here through CodeDay? Please not the issue is reserved for the CodeDay microinternship. Thanks for understanding!

ksen0 avatar Mar 04 '26 00:03 ksen0

Hi Ksen0. I got caught in traffic I’ll try to join when I get home.

Get Outlook for iOShttps://aka.ms/o0ukef


From: kit @.> Sent: Tuesday, March 3, 2026 4:31:51 PM To: processing/p5.js-web-editor @.> Cc: Pm Kamau @.>; Mention @.> Subject: Re: [processing/p5.js-web-editor] Add Syntax Highlighting for p5.js Variables (Issue #3868)

You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

CAUTION: This email originated from outside Bellevue College. Do not click links or open attachments unless you validate the sender and know the content is safe. If you are unsure, contact the Service Desk at x4357 (425-564-4357) or email @.***

[https://avatars.githubusercontent.com/u/1304340?s=20&v=4]ksen0 left a comment (processing/p5.js-web-editor#3868)https://github.com/processing/p5.js-web-editor/issues/3868#issuecomment-3994433077

Hi @PeterKamau24https://github.com/PeterKamau24 ! Can you confirm if you're coming here through CodeDay? Please not the issue is reserved for the CodeDay microinternship. Thanks for understanding!

— Reply to this email directly, view it on GitHubhttps://github.com/processing/p5.js-web-editor/issues/3868#issuecomment-3994433077, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BMMXSZ7C37JRQ7AD3WFTMCT4O52PPAVCNFSM6AAAAACVBKE4C6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTSOJUGQZTGMBXG4. You are receiving this because you were mentioned.Message ID: @.***>

PeterKamau24 avatar Mar 04 '26 00:03 PeterKamau24

@ksen0 Should we re-open this to codeday contributors and remove the on hold label?

khanniie avatar May 30 '26 16:05 khanniie

Hi @khanniie I've removed the on hold! It was for CodeDay in March, and it was assigned to @PeterKamau24 but no PR was raised. We could either release it to general contributors or keep it for the next round of microinternships (next month or so) - let me know if you think it's better to make it generally available?

ksen0 avatar May 31 '26 14:05 ksen0

@ksen0 id be down to make it generally available! There's always new things I can think of for code day contributions and I plan to merge cm6 soon so it would be good to get this fixed sooner if possible

khanniie avatar May 31 '26 15:05 khanniie

Thanks @khanniie ! This issue is now open for new volunteers.

ksen0 avatar May 31 '26 17:05 ksen0

hi @khanniie can i work on this issue

parthjadhao01 avatar May 31 '26 18:05 parthjadhao01

@parthjadhao01 yes, thank you!

khanniie avatar May 31 '26 18:05 khanniie