You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Autocomplete Hinter should support different p5.js versions #4104
The autocomplete hinter is am important tool to help newcomers navigate the codebase. However, it is not enabled by default, partly because it does not fully support multiple p5.js versions.
Feature enhancement details
Currently, the autocomplete hinter is does not completely support multiple different version of p5.js. You can switch to p5.js 2.0+ version with the hinter on and observe:
Although the link is to the correct website (beta.p5js.org), the dropdown is missing functions that exist on v2 (such as buildMaterialShader) and should be shown.
Hello @ksen0 . I looked into this issue and would like to work on improving the autocomplete hinter’s support for multiple p5.js versions, particularly syncing suggestions with the selected v1/v2 API dataset.
Thanks for the interest @VikasKSingh05 ! This one's a bit tricky, the implementation is not obvious / there are different possible solutions. Could you explain how you would tackle this, where you'd start in the codebase and what approach you'd take, before we consider assignment? Thanks!
Sure @ksen0 . I investigated the autocomplete generation pipeline locally and found that the issue comes from the generated hinter datasets being based on the v1 reference data.
The update-p5-hinter.js script currently fetches from: https://p5js.org/reference/data.json
After switching it to the v2 beta reference JSON and regenerating the hinter files via npm run update-p5-hinter, the missing v2 APIs (such as buildMaterialShader) started appearing correctly in the editor autocomplete suggestions.
So the autocomplete itself already supports these APIs, its just that the generated datasets are outdated and still built against the v1 reference source.
Before proceeding further, should the intended fix here be:
updating the generation scripts/generated datasets to use the v2 reference data, or
implementing proper multi-version-aware hinter generation/support?
update update-p5-hinter.js to generate both p5-hinter-v1.js and p5-hinter-v2.js.
pass version information to p5Javascript.js through stateUtils.js (either similarly to referenceBaseUrl, or infer it from referenceBaseUrl if that ends up being the better source of truth).
select and pass the appropriate hints dataset (p5-hinter-v1 or p5-hinter-v2) to contextAwareHinter based on the active version.
regardless of the implementation details, generating separate hinter files for both versions seems necessary since the APIs differ:
both files would be generated from update-p5-hinter.js. we could also structure the script around an array of reference API URLs, making it easier to support additional p5.js versions in the future.
for version propagation, i'd start by tracing the existing version-switching flow. we can pass versionInfo from client/modules/IDE/components/Editor/index.jsx to createNewFileState in client/modules/IDE/components/Editor/stateUtils.js through settings (similar to referenceBaseUrl). from there, it can be passed into p5Javascript via fileLanguage(versionInfo).
then in p5Javascript.js, we can select the appropriate hinter dataset and pass it to contextAwareHinter.
i also considered an alternative approach of merging all hints into a single dataset and filtering suggestions based on the active version. i ended up ruling that out because it would require propagating version information deeper into the completion pipeline, adding version metadata to hints, and performing filtering during completion generation. keeping separate generated datasets and selecting the correct one upfront seems simpler and easier to maintain.
Thanks for the quite complete/thorough proposal @skyash-dev , I'll assign! I'm keeping this as "Discussion" though in case there are roadblocks or other implementation challenges to be considered during review. Thanks!
Activity
VikasKSingh05 commentedon May 8, 2026
Hello @ksen0 . I looked into this issue and would like to work on improving the autocomplete hinter’s support for multiple p5.js versions, particularly syncing suggestions with the selected v1/v2 API dataset.
Please assign this issue to me if available.
ksen0 commentedon May 8, 2026
Thanks for the interest @VikasKSingh05 ! This one's a bit tricky, the implementation is not obvious / there are different possible solutions. Could you explain how you would tackle this, where you'd start in the codebase and what approach you'd take, before we consider assignment? Thanks!
VikasKSingh05 commentedon May 9, 2026
Sure @ksen0 . I investigated the autocomplete generation pipeline locally and found that the issue comes from the generated hinter datasets being based on the v1 reference data.
The
update-p5-hinter.jsscript currently fetches from:https://p5js.org/reference/data.jsonAfter switching it to the v2 beta reference JSON and regenerating the hinter files via
npm run update-p5-hinter, the missing v2 APIs (such asbuildMaterialShader) started appearing correctly in the editor autocomplete suggestions.So the autocomplete itself already supports these APIs, its just that the generated datasets are outdated and still built against the v1 reference source.
Before proceeding further, should the intended fix here be:
skyyash commentedon Jun 2, 2026
hi @ksen0!
interested in taking this on.
my proposed approach:
tldr:
update-p5-hinter.jsto generate bothp5-hinter-v1.jsandp5-hinter-v2.js.p5Javascript.jsthroughstateUtils.js(either similarly toreferenceBaseUrl, or infer it fromreferenceBaseUrlif that ends up being the better source of truth).p5-hinter-v1orp5-hinter-v2) tocontextAwareHinterbased on the active version.regardless of the implementation details, generating separate hinter files for both versions seems necessary since the APIs differ:
p5-hinter-v1→ https://p5js.org/reference/data.jsonp5-hinter-v2→ https://beta.p5js.org/reference/data.jsonboth files would be generated from
update-p5-hinter.js. we could also structure the script around an array of reference API URLs, making it easier to support additional p5.js versions in the future.for version propagation, i'd start by tracing the existing version-switching flow. we can pass
versionInfofromclient/modules/IDE/components/Editor/index.jsxtocreateNewFileStateinclient/modules/IDE/components/Editor/stateUtils.jsthroughsettings(similar toreferenceBaseUrl). from there, it can be passed intop5JavascriptviafileLanguage(versionInfo).then in
p5Javascript.js, we can select the appropriate hinter dataset and pass it tocontextAwareHinter.i also considered an alternative approach of merging all hints into a single dataset and filtering suggestions based on the active version. i ended up ruling that out because it would require propagating version information deeper into the completion pipeline, adding version metadata to hints, and performing filtering during completion generation. keeping separate generated datasets and selecting the correct one upfront seems simpler and easier to maintain.
ksen0 commentedon Jun 2, 2026
Thanks for the quite complete/thorough proposal @skyash-dev , I'll assign! I'm keeping this as "Discussion" though in case there are roadblocks or other implementation challenges to be considered during review. Thanks!
ksen0 commentedon Jun 16, 2026
Related PR has been merged, closing but please reopen as needed