Hi,
I like the Arduino environment but the latest version 2.0.0 gives me a headache. I can not edit my own source code any more. (platform is a Windows 10 PC)
Steps to reproduce:
Start Arduino IDE 2.0.0
Select BBC micro:bit V2
File->New
Sketch opens as expected. I can edit, no problem.
File->Save
(leaving the suggested filename, no change)
Press Save
Unexpected behaviour: sketch editor is now in Read Only mode ? I can not edit my own, newly created sketch.
Is this a bug or a new special trick I need to do ?
Locating your sketchbook folder on drive D: should not cause a problem. The reason that I asked was that I have seen reports of problems where people used OneDrive
I did an additional test with doing a 'save as..' to the standard windows directory : C:\Users<username>\Arduino
This gives no 'read-only' tooltip problems.
So could it be that the IDE 2.0 decides on being read-only if the filename path does not contain the windows user path c:\users<username> ?
If that is the case, maybe it would be another idea to being read-only if the 'libraries' entry is present in the full path ?
Some more test; only the path 'd:\Documents\Arduino' has the issue. If I use 'd:\Arduino' then there is no problem. (puzzling?)
The Windows default directory is 'd:\Documents' on this system, maybe that has to do with it ?
(may you live in interesting times )
That is indeed puzzling. The only similar report I am aware of is this:
The IDE is designed to treat any file from outside the sketch folder as "read-only". This is done to prevent the user from accidentally modifying library, core, or toolchain files opened via the "Go to Definition" or "Peek Definition" features, which would result in very confusing bugs.
In the bug report above, I believe the symlink makes the IDE think the files are outside the sketch folder (likely one of the two paths is being resolved to its true location on the file system).
So there might be something special about your 'd:\Documents\Arduino that causes some similar confusion in the IDE.
Note that the "read-only" I refer to is completely unrelated to a read only file attribute set in the file system.
Thank you for your help and feedback.
I had a look at compiling the Arduino IDE to debug this problem but that is not an easy task for me.
So I am going to use the workaround of using the 'd:\Arduino' directory that I created and that resolves this issue for me.
I'll be the first to say those instructions need improvement. This is something I plan to work on, but have been having trouble finding the time to do so.
If you want to play around with debugging the IDE, you might be interested to know that it has a built-in debugger. This is available even in the normal IDE distribution you already have installed. So you can use that even if you don't manage to build the IDE from source.
I'll share the instructions for the basic use of this debugger:
Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
Run the "Toggle Developer Tools" command.
The "Developer Tools" panel will open on the left side of the Arduino IDE window.
Select the "Sources" tab from the Developer Tools panel.
If it is not already open, click the "Show navigator" icon on the left side of the "Sources" tab toolbar to open the "Navigator" panel.
Select the "Page" tab from the the "Navigator" panel on the left of the "Developer Tools" panel.
Select top > file:// > <IDE installation URI> > bundle.js from the "Navigator" panel.
The Arduino IDE UI will now hang for a while. Wait for it to become responsive again.
Click the ⋮ icon on the "Developer Tools" panel toolbar.
Select "Open file" from the menu.
From the menu that opens, select the source file where you want to set a breakpoint.
Click on the left gutter at the line that contains the code of interest to add a breakpoint.
Deselect the "Deactivate breakpoints" icon if it is selected.
Trigger the action in the Arduino IDE that will execute that line of code.
The execution will pause when it hits the breakpoint. You can hover the mouse over the variables to see their values. You can use the "Resume script execution", "Step over ...", "Step into ...", "Step out of ...", "Step" buttons in the widget on the right of the "Developer Tools" panel.
When finished debugging, select the "Deactivate breakpoints" icon.