Skip to content

Use user-defined tab settings in new sketch generation #8686

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

Conversation

Pieter12345
Copy link
Contributor

When creating a new sketch, it is initialized with the BareMinimum example sketch. This example sketch uses 2-width whitespace indentation, which might differ from the user-defined tab settings. This PR makes the generated example sketch consistent with the user-defined tab settings.

@Pieter12345
Copy link
Contributor Author

@facchinm @cmaglie When making this change, I were left with two questions:

  1. The arduino-core/src/processing/app/helpers/FileUtils.java class has a high overlap with the org.apache.commons.io.FileUtils class. Is there a reason for not using this library?
  2. The arduino-core/src/processing/app/helpers/StringUtils.java class has the same name as org.apache.commons.lang3.StringUtils. In this PR, I wrapped an Apache StringUtils method so that I didn't have to specify the full path in the Base path (to disambiguate from the other StringUtils). What is the desired way to handle this issue in this project?

@facchinm
Copy link
Member

Apache commons was introduced as a dependency very late, so that's the reason for code duplication. Using commons everywhere would be a good solution IMO. In parallel it would be awesome to make the whole codebase consistent again (I'm sure there are at least 3 methods to write a string to a file in use right now 🙂 )

Anyway, I really like this PR! We are currently having a small problem on the download server so I can't launch the ArduinoBot build on it but I'll do as soon as we fix it.

@facchinm facchinm added the feature request A request to make an enhancement (not a bug fix) label Mar 21, 2019
@facchinm facchinm added this to the Release 1.8.10 milestone Mar 21, 2019
When creating a new sketch, it is initialized with the BareMinimum example sketch. This example sketch uses 2-width whitespace indentation, which might differ from the user-defined tab settings. This commit makes the generated example sketch consistent with the user-defined tab settings.
@Pieter12345 Pieter12345 force-pushed the new-sketch-indentation-consistency branch from 03d88ee to f3e787e Compare March 29, 2019 02:14
@Pieter12345
Copy link
Contributor Author

Rebased this PR onto master.

@@ -764,7 +764,20 @@ protected File createNewUntitled() throws IOException {
if (!newbieFile.createNewFile()) {
throw new IOException();
}
FileUtils.copyFile(new File(getContentFile("examples"), "01.Basics" + File.separator + "BareMinimum" + File.separator + "BareMinimum.ino"), newbieFile);

// Initialize the pde file with the BareMinimum sketch.
Copy link
Contributor

Choose a reason for hiding this comment

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

We're still talking about pde files? That's so last year! 😆 🤣

@facchinm facchinm merged commit 9aea65b into arduino:master Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A request to make an enhancement (not a bug fix)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants