Skip to content

Autocomplete and Hinter #1873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Jun 7, 2023
Merged

Conversation

peilingjiang
Copy link
Contributor

@peilingjiang peilingjiang commented May 23, 2021

Resolves #99

js-hinter

I was looking for WIPs and issues regarding autocompletion and found #99. Although the issue has been idle for a while, I think this feature can greatly help beginners to start and help reduce typos and increase efficiency in general. It turns out that CodeMirror provides a great base for implementing it so I tried to use its hinter addon and build this PR.

In addition to autocompletion, the hinters also have links to the corresponding documentation page. Not exactly the same as requested in #99 but provides a similar reference capability.

Some more details of this implementation:

  • The style has been configured to work in all three themes.
  • TBD It is triggered every time an alphabet is typed, unlike the native CodeMirror hinter that will only be triggered by Ctrl-Space.
  • TBD It only works in css and javascript modes, as CodeMirror's HTML hinter works weirdly.
  • TBD For JavaScript, it can only hint and autocomplete p5 keywords, unlike fancy IDEs that can also complete JS and customized keywords.
  • I added a lightweight new dependency, fuse.js, to tolerate some misspellings, e.g., you can still get an option of circle even when you type cic as a start.
  • It depends on a new utils file - p5-hinter.js - that can be updated by update-p5-hinter.js (just like update-syntax-highlighting.js). It fetches the same data but organizes it in a different way.

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • is from a uniquely-named feature branch and has been rebased on top of the latest develop branch. (If I was asked to make more changes, I have made sure to rebase onto develop then too)
  • is descriptively named and links to an issue number, i.e. Fixes #123

@welcome
Copy link

welcome bot commented May 23, 2021

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already.

@release-com

This comment has been minimized.

@catarak
Copy link
Member

catarak commented Jun 11, 2021

!!!!!!!!!!!! thank you for working on this! there's actually a google summer of code project focused on autocomplete for the web editor, so I'm going to let them take the charge in reviewing this and making sure the UI/UX is good/is web accessible/keyboard shortcuts are good/etc.

@peilingjiang
Copy link
Contributor Author

!!!!!!!!!!!! thank you for working on this! there's actually a google summer of code project focused on autocomplete for the web editor, so I'm going to let them take the charge in reviewing this and making sure the UI/UX is good/is web accessible/keyboard shortcuts are good/etc.

Didn't know about the ongoing progress. If possible, I'm also happy to work with the corresponding developer(s) to push it to the shipping state. Please let me know!

@catarak
Copy link
Member

catarak commented Jul 15, 2021

Thank you for continuing to update this PR! Sorry that progress has been slow. It turns out that there's not a GSoC project focusing on this issue, so I'm happy to review it.

@catarak
Copy link
Member

catarak commented Jul 15, 2021

Create Release Environment

@catarak
Copy link
Member

catarak commented Jul 15, 2021

@peilingjiang
Copy link
Contributor Author

Thank you for continuing to update this PR! Sorry that progress has been slow. It turns out that there's not a GSoC project focusing on this issue, so I'm happy to review it.

Thanks! Please let me know anything that I need to put more work on!

@catarak
Copy link
Member

catarak commented Jul 16, 2021

  • TBD It is triggered every time an alphabet is typed, unlike the native CodeMirror hinter that will only be triggered by Ctrl-Space.
    I think this is the right approach as it functions like more "normal" IDE's.
  • TBD It only works in css and javascript modes, as CodeMirror's HTML hinter works weirdly.
    In what way does it work weirdly?
  • TBD For JavaScript, it can only hint and autocomplete p5 keywords, unlike fancy IDEs that can also complete JS and customized keywords.
    Do you know how much work it would be to complete JS keywords and user-defined functions/keywords? This could be a separate PR.
  • I added a lightweight new dependency, fuse.js, to tolerate some misspellings, e.g., you can still get an option of circle even when you type cic as a start.
    This is great!
  • It depends on a new utils file - p5-hinter.js - that can be updated by update-p5-hinter.js (just like update-syntax-highlighting.js). It fetches the same data but organizes it in a different way.
    This is totally cool. I think a separate PR could document these scripts 😄

@catarak
Copy link
Member

catarak commented Jul 16, 2021

One UI feedback—I think that the font size of the text in the hinter should be the same size as whatever the text size is set to in a user's preferences. This may need to be done in JS rather than CSS.

@catarak
Copy link
Member

catarak commented Jul 16, 2021

Overall this works so well and I can't wait to refine it and merge it in!!

@Atcold
Copy link

Atcold commented Aug 18, 2021

Hi @catarak, when were you thinking to merge this?

@peilingjiang
Copy link
Contributor Author

Hi @catarak, when were you thinking to merge this?

So sorry for the delay in updating the PR! I don't think I'll have time to resolve the problems until early September as I'm running for some submission deadlines. I'll try to update as soon as possible for it to be ready to merge.

@catarak
Copy link
Member

catarak commented Aug 19, 2021

So sorry for the delay in updating the PR! I don't think I'll have time to resolve the problems until early September as I'm running for some submission deadlines. I'll try to update as soon as possible for it to be ready to merge.

No worries at all! I really appreciate the work you have done so far ✨

@catarak
Copy link
Member

catarak commented Apr 27, 2022

Apologies for this taking so long to merge in! I clearly reached a place of burnout and am in the process of finding new leadership (see #2010). That being said, I am doing a lot better, and am focusing my attention on updating packages, documentation, closing pull requests, and organizing issues, so I will merge this one within the next month.

@Atcold
Copy link

Atcold commented May 27, 2022

Yay! One month anniversary today! 🥹
Jokes aside, I hope you're doing well 😊

@peilingjiang
Copy link
Contributor Author

Any plans to reboot the merging of this PR? @catarak @raclim

@raclim
Copy link
Collaborator

raclim commented Oct 26, 2022

Hi @peilingjiang! Thank you so much for your patience and understanding during our transitional period. I'm still learning the ropes for this position so merging in PRs and deployment might take some time, but I'd definitely love to continue the efforts that went into this feature.

Timeline wise, I'm hoping to get a flow established over the following month and will be delving into the PRs (including this one) within that time. 🙂

@peilingjiang
Copy link
Contributor Author

Hey @raclim any plan on merging this? Thanks!

@raclim
Copy link
Collaborator

raclim commented May 22, 2023

Hi @peilingjiang! I'm really sorry for not getting to this 😅 I'm currently away until the end of the week so I won't be as active here until then, but I'd still love to merge your work in! Would you be able to resolve some of the conflicts in this branch?

@peilingjiang
Copy link
Contributor Author

@raclim I have resolved the conflicts, added the switch to turn it on and off, added tests for the switch, and updated the UI a little. It should be all ready to merge now.

Screenshot 2023-05-25 at 15 36 27

@Atcold
Copy link

Atcold commented May 25, 2023

Let's do it! I'm waiting for this to be merged to start teaching P5.js using the native editor! 🥳🥳🥳

@peilingjiang
Copy link
Contributor Author

@raclim Please let me know if there's anything that needs an update! Thanks for the review!

@raclim
Copy link
Collaborator

raclim commented May 30, 2023

@peilingjiang Thanks so much for continuing to work on this! I just got back so I'll start looking over this today, and will hopefully get back to you on this by tomorrow!

Copy link
Collaborator

@raclim raclim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Overall, I feel like this looks really great so far! :)

As noted in my other comments, I had some difficulty activating the feature without the noted line change within the show-hint.js file. Visually, it also appeared a bit differently for me.

Screenshot 2023-06-01 at 5 13 54 PM

Please let me know if there was something I might've missed or done incorrectly while reviewing this, or go ahead with adding any updates, thanks!

@raclim raclim dismissed catarak’s stale review June 7, 2023 17:42

Some of the requested changes have become outdated!

@raclim
Copy link
Collaborator

raclim commented Jun 7, 2023

I looked through it with the updates and think it looks great! I also created a release environment for it. Thanks again so much for your hard work and super excited to see it live soon! :)

@raclim raclim merged commit 4aaa5a0 into processing:develop Jun 7, 2023
@Atcold
Copy link

Atcold commented Jun 7, 2023

Yay! 🥳🥳🥳

@peilingjiang, is there a way to trigger a command syntax suggestion?
Say I type re, the suggestion rect is provided, but there is no mention of what arguments it expects.
Having something like rect(x, y, w, [h], [tl], [tr], [br], [bl]) would help a lot!

@peilingjiang peilingjiang mentioned this pull request Jun 8, 2023
4 tasks
@peilingjiang
Copy link
Contributor Author

Thanks a lot @raclim @catarak @Atcold for all the support and comments! Pretty excited to see it being merged!

@Atcold Great suggestion! And here you go #2236 : )

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.

p5.js library Autocomplete and/or link to specific parts of reference
4 participants