Skip to content

Autocomplete Hinter support for different p5.js versions#4151

Open
skyash-dev wants to merge 3 commits into
processing:develop-codemirror-v6from
skyash-dev:feat/version-aware-autocomplete
Open

Autocomplete Hinter support for different p5.js versions#4151
skyash-dev wants to merge 3 commits into
processing:develop-codemirror-v6from
skyash-dev:feat/version-aware-autocomplete

Conversation

@skyash-dev
Copy link
Copy Markdown

Issue:

Fixes #4104
Adds support for version-specific autocomplete hints by generating separate hinter datasets for p5.js v1 and v2, and reconfiguring the JavaScript language extension when the selected p5.js version changes.

Demo:

image

Changes:

Generate versioned hinter files

Updated update-p5-hinter.js to generate:

  • p5-hinter-v1.js from https://p5js.org/reference/data.json
  • p5-hinter-v2.js from https://beta.p5js.org/reference/data.json

This ensures the autocomplete dataset matches the selected p5.js version and includes APIs that are only available in v2.

Reconfigure language support on version changes

Added a dedicated CodeMirror compartment for the JavaScript language extension and reconfigure it when the selected p5.js version changes.

This allows the completion source to switch between the v1 and v2 hinter datasets without recreating editor state.

Version-aware completion source

p5JavaScript() now selects the appropriate hinter dataset based on the active p5.js version:

  • v1 → p5HinterV1
  • v2 → p5HinterV2

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • has no typecheck errors (npm run typecheck)
  • is from a uniquely-named feature branch and is up to date with the develop-codemirror-v6 branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123
  • meets the standards outlined in the accessibility guidelines

@khanniie
Copy link
Copy Markdown
Member

khanniie commented Jun 4, 2026

Hi @skyash-dev just fyi I moved around a bunch of files recently as a final cleanup before we merge v6 into develop! I didn't realize there were other PRs that would be opened against this branch as it looked like most of the subissues had been resolved (except for 2 that had been assigned). You may need to resolve the merge conflicts or hold onto this PR until v6 is merged in the next week and then just point it at develop?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants