I use that feature all the time. I checked "Use External Editor" in preferences, and any changes made in the external editor are automatically loaded. If you’re not using this feature, you’ll need to stick to just the Arduino IDE and avoid external editors.
Hint: Do not have more than one .ino file in the sketch folder. The IDE will combine them, which can lead to confusion and drive you bonkers.
Having it ask to load each external file individually would be a real pain. Instead, it automatically loads all the selected header files, the associated .cpp files, and several other files that help define the specific Arduino board you're using. These files vary between different Arduino models.
I use Geany as my external editor and keep most of the library files in the sketch folder, as I often modify them. This approach prevents issues when libraries are updated. It’s not uncommon for me to have a dozen or more files open as I work on a project. Keeping library files local also lets me review their content, see how to call their functions, and understand what they return.
Note that this is only present in the Arduino IDE 1.x preferences. Arduino IDE 2.x always picks up external changes to sketch files that are in a saved state, without requiring the user to first enable this behavior via a preference.
"Having it ask to load each external file individually would be a real pain. "
Why can't it be an option in preferences!
Use or don't use it - your choice.
I have the opposite problem. It never loads the external changes, and is constantly asking me if I want to overwrite the externally changed files. Since I'm editing files in two different IDEs, I want Arduino to pick up those changes. I can't find a pref to adjust this behavior.
So what is the sequence/scenario where you actually lose edits?
Was this from using the IDE and an external editor?
If so, you really should only be editing/modifying the file in one place.
either in the IDE or in an external editor.
For temporary changes, just use an external editor, and undo the changes if you don't like them before you finally exit the editor.
It will only load the external changes if the sketch is in a saved state.
You can ensure it is always in a saved state by enabling the "Auto save" preference. The IDE will then save the sketch automatically whenever you made any edits via the Arduino IDE editor. Of course this setting significantly changes the behavior of Arduino IDE, so you should make sure to consider whether this is something you want, and to adjust your workflow as needed.
It will never load the external changes if the sketch is a library example sketch opened through the menu down in the examples for a library.
This is a different behavior from IDE 1.x
--- bill
This 2.x behavior change can create some confusion due to it creating unexpected behaviors. It also makes it kind of PITA for a library developer to use the Arduino 2.x IDE for library development of the library examples.
There is a work around. Which is open the sketch from the "open" menu rather than through the examples menu.
I really abhor nanny modes.
And in this case I still strongly believe that the 2.x developers got it wrong.
I think always loading in any external file changes and a simple warning when attempting to change/save a library example through the IDE would have been better and much simpler to implement.
The current nanny mode for library examples can be confusing due to its inconsistent behaviors between library example sketches and non library sketches.
This is why I still primarily use Arduino IDE 1.x when doing development work on my Arduino libraries.
My apologies, I misread your post thinking you were talking about a Load External Change option. I do have the Auto Save option and mine is turned off. Is that option anything different then me clicking Save occasionally?
The only difference is that you might forget to click save.
As I mentioned earlier in the thread, Arduino IDE 2.x only loads external changes if the sketch is in a saved state. The "Auto save" feature is relevant because, when enabled, it ensures the sketch is always in the saved state and thus we don't need to consider an unsaved state as a possible cause of external changes not being loaded.
When you restart Arduino IDE, the sketch will be in a saved state. So my hypothesis was that the "stops loading external changes" behavior you encountered might have occurred under the following conditions:
"Auto save" preference is disabled
Changes were made to the sketch in the Arduino IDE editor since the last time it was saved.