Skip to content

Saved code is shown in compilation error messages even when compiling dirty sketch #12

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

Closed
per1234 opened this issue Feb 12, 2021 · 1 comment
Labels
conclusion: off topic Off topic for this repository topic: CLI Related to Arduino CLI topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Feb 12, 2021

Describe the bug
When compiling a sketch with unsaved changes, the code in the editor is compiled (good), but the code from the saved version of the sketch is used in the error message when there is a compilation failure (bad).

To Reproduce
Steps to reproduce the behavior:

  1. File > Preferences
  2. Uncheck the box next to "Auto save".
  3. Click the "OK" button.
  4. Open a sketch that will compile without errors (e.g., File > New).
  5. Make changes to the sketch code that would cause a compilation failure. Don't save.
  6. Sketch > Verify/Compile. The compilation fails.
  7. Check the error message in the output menu. The quoted line of code is from the saved version of the sketch, not the code that caused the error.

For example, if I have this sketch saved:

void setup() {}
void loop() {}

and this is the dirty version:

foovoid setup() {}
void loop() {}

The compilation error:

c:\Users\per\AppData\Local\Temp\.arduinoIDE-unsaved2021112-12840-1u0f2iv.mccj\sketch_feb12a\sketch_feb12a.ino:1:1: error: 'foovoid' does not name a type; did you mean 'void'?
 void setup() {}
 ^~~~~~~
 void
c:\Users\per\AppData\Local\Temp\.arduinoIDE-unsaved2021112-12840-1u0f2iv.mccj\sketch_feb12a\sketch_feb12a.ino:1:1: error: 'foovoid' does not name a type; did you mean 'void'?
 void setup() {}
 ^~~~~~~
 void
Compilation error: Error: 2 UNKNOWN: exit status 1

Expected behavior
The code of the sketch that was compiled should be shown in the error output:

c:\Users\per\AppData\Local\Temp\.arduinoIDE-unsaved2021112-12840-1u0f2iv.mccj\sketch_feb12a\sketch_feb12a.ino:1:1: error: 'foovoid' does not name a type; did you mean 'void'?
 foovoid setup() {}
 ^~~~~~~
Compilation error: Error: 2 UNKNOWN: exit status 1

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10
  • Version: 2.0.0-beta.1-snapshot.9e35571
    Date: 2021-02-12T08:28:48.914Z
    CLI Version: nightly-20210212 alpha [560025a6]

Additional context

The compilation of the dirty sketch is a new behavior introduced by f53013b as a fix for https://github.com/arduino/arduino-pro-ide/issues/432

@kittaakos
Copy link
Contributor

Can we just close this and track the CLI issue? arduino/arduino-cli#1185
I do not like duplicating the issue and it's out of control of the IDE.

@kittaakos kittaakos added the CLI label Feb 12, 2021
@per1234 per1234 closed this as completed Feb 12, 2021
@rsora rsora added the type: imperfection Perceived defect in any part of project label Sep 22, 2021
@per1234 per1234 added topic: code Related to content of the project itself conclusion: off topic Off topic for this repository topic: CLI Related to Arduino CLI labels Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: off topic Off topic for this repository topic: CLI Related to Arduino CLI topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants