IDE failing to save?

Version: 2.1.1
Date: 2023-06-30T16:04:40.277Z
CLI Version: 0.32.3

Copyright © 2024 Arduino SA

I have this version of IDE with autosave disabled. on W11.
Autosave is disabled because I do not want a change in code being saved when i flahs the arduino to test it.

I am in the habit of saving work after each edit that performs as expected is completed. I was 100% certain yesterday that before shutting down the PC , I had saved my work. I am 100% certain because my power supply went out and the UPS kicked in, and I saved it at least once when that happened. But im also certain I saved before shutting down at the end of the day

yet today there is no saved file, and a days work is lost (luckily i spent most of the day debugging physical issues and not code)

the file is not read only.

Does anyone know what may have caused this? clearly being 100% certain I hit SAVE, I am not fuill of confidence right now.

also, in the arduino sketch folder, the individual folders do not have the modified date correct, at least they dont show the date that the sketch inside them was modified.

Anyone know what is going on ? I certainly dont want to waste another days work.

thanks

Your topic has been moved to the dedicated IDE 2.x section of the forum.

I can not answer the question about the why. Others might if you can provide more details like operating system, if this is on a network drive and possibly other stuff.

Data loss can (mostly?) be prevented by enabling auto save. Pres <F1>, type save and check the setting as shown below.

Autosave is deliberately disabled, as it autosaves each time you upload a sketch, and I do not want that to happen.

storage medium is SSD
OS - w11
folder is on c: in default location

If you have a good reason not to use auto save, that is fine.

However, auto save does not have anything to do with uploads; it just saves occasionally.

im not sure that is correct. I had noticed that it was saving everytime I uploaded, googled it and read that it was correct behaviour for autosave to complete upon each upload....

A lot of information on the web is about the older versions of IDE. If it does not explicitely state a version, I always assume that it's for one of the versions before IDE 2.x unless I can prove that it's not.

I've just tested it. I modified a sketch that was open while monitoring the same sketch in Notepad++, did wait a little and the changes popped up in Notepad++.

Hi @spruce_m00se.

I recommend updating to the latest version of Arduino IDE. Some significant bug fixes and enhancements have been made since the time of the Arduino IDE 2.1.1 release.

There have been some bug fixes related to saving sketches and also some enhancements in effectively communicating to the user when the IDE is not able to save the sketch for some reason, or when performing an action might cause the loss of sketch data.

It is correct. The auto-save only being triggered on every compilation or upload operation is specific to Arduino IDE 1.x. Arduino IDE 2.x has the standard modern auto-save behavior of saving after each modification to the sketch. You can verify this by enabling the setting in your preferences, editing the sketch, and then watching the unsaved indicator on the right side of the sketch file's editor tab. You will see that the indicator appears after the sketch is modified, then 1 s later disappears after the auto-save occurs:

auto-save

thanks for the reply.
I personally dont like the autosave feature regardless, I suppose I could get into the habit of saving a copy before starting to edit it, then I could easily revert.

I will update the IDE and see what happens. Is there a way to turn off the auto complete features that auto add brackets etc as youre typing? or the prompts that show you what kind of values you can use? I find these terribly irritating. I have always used IDE 1.6 up until a few months back when I changed my PC. The "help" features are getting in the way more than anything.

Turn off "Editor Quick Suggestions" in the IDE Preferences to turn of auto complete

2 Likes

This "feature" can be disabled via the Arduino IDE advanced settings:

  1. Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
    A menu will appear on the editor toolbar:
    image
  2. Select the "Preferences: Open Settings (UI)" command from the menu.
    You can scroll down through the list of commands to find it or type the name in the field.
    A "Preferences" tab will open in the Arduino IDE main panel.
  3. Type editor.autoClosingBrackets in the "Search Settings" field of the "Preferences" tab.
  4. Select "never" from the menu under the "Editor: Auto Closing Brackets" setting.
  5. Close the Preferences tab by clicking its X icon.

If you don't like the automatic bracket closure, you might also prefer to disable the feature that automatically adds closing quotes:

  1. Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
  2. Select the "Preferences: Open Settings (UI)" command from the menu.
    You can scroll down through the list of commands to find it or type the name in the field.
    A "Preferences" tab will open in the Arduino IDE main panel.
  3. Type editor.autoClosingQuotes in the "Search Settings" field of the "Preferences" tab.
  4. Select "never" from the menu under the "Editor: Auto Closing Quotes" setting.
  5. Close the Preferences tab by clicking its X icon.
1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.