Skip to content
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

Processing doesn't recognize methods of PApplet when the sketchfolder has a hyphen in it #610

Closed
mythicaleinhorn opened this issue Nov 29, 2022 · 10 comments · Fixed by #637

Comments

@mythicaleinhorn
Copy link

mythicaleinhorn commented Nov 29, 2022

Description

When the name of a sketch folder contains a hyphen, Processing doesn't recognize the methods of PApplet like draw(), background(), etc.
The sketch will compile and run without any problems anyway.

Steps to Reproduce

  1. Create a sketch in a folder with a name containing a hyphen
  2. A sketch.properties file is created pointing to the main file (which can't have a hyphen in it, Processing will refuse to start in that case)
  3. Processing won't recognize the methods of PApplet anymore (draw(), background(), etc.)

Your Environment

  • Processing version: 4.1.1
  • Operating System and OS version: TUXEDO OS 1 (KDE Plasma) / Windows 11
  • Other information: This problem exists since 4.1.0
@mythicaleinhorn
Copy link
Author

Suggested fix:
Adding a check similar to https://github.com/processing/processing4/blob/1e1d1964eef5a2660296d56ce68f4612b1c9e33e/app/src/processing/app/Base.java#L1606-L1615 to check for hypens in a folder name.

@clankill3r
Copy link

This does not happen on OSX. But it does indeed happen on windows.
The thing is, instead of a "sanitary check", it would be better to find why it breaks with a hyphen and fix that.

@benfry
Copy link
Owner

benfry commented Jan 16, 2023

@sampottinger Any quick thoughts? (Not your fault, just that you were in this code recently dealing with incorrect/superficial errors/warnings being reported.)

This is another split between the live error checking and the generated code that's actually run. It looks like there's probably an assumption about class name being the same as the main tab name or the folder name, so this is showing errors when the sketch folder doesn't match up (i.e. it has spaces, hyphens, anything else that's now allowed if you un-check “Keep sketch name and main tab in sync”.

benfry added a commit that referenced this issue Jan 16, 2023
@sampottinger
Copy link
Collaborator

Weird. Yeah it could be something with the edt edit generation. It's strange that it is OS specific though. I'll take a look.

@benfry
Copy link
Owner

benfry commented Jan 16, 2023

I'm seeing it on macOS, I don't think it's OS-specific. To reproduce:

  1. Uncheck the pref to keep sketch name and tab in sync
  2. Do a “Save As” and re-save the sketch to a folder that has spaces or hyphens in the name
  3. You should see red squiggles in the editor area for built-in functions

(i.e. potentially nearby the other bit you had just fixed w/ error squiggles.)

@benfry
Copy link
Owner

benfry commented Jan 16, 2023

Here's an example: issue4 0610 hyphen trouble.zip

@sampottinger
Copy link
Collaborator

Ah I must have misinterpreted an earlier comment. I'll try to take a look tomorrow!

@sampottinger
Copy link
Collaborator

Actually I think I have a minute let me pop in now @benfry

@benfry
Copy link
Owner

benfry commented Jan 16, 2023

All set for 4.1.2 thanks to @sampottinger.

benfry added a commit that referenced this issue Jan 16, 2023
@github-actions
Copy link

This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants