Arduino IDE 2.0 read-only editor issue

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 ?

Kind regards,
Rob

Welcome to the forum

Can we assume that all is OK with version 1 of the IDE ?

What is the full path to your sketchbook folder ?

Hi Bob,

Yes, version 1.8 works good. Maybe it has to do with the fact that I have my Documents folder on a non standard location ?

D:\documents\Arduino

(the reason for that is that my d: drive is much bigger than my c drive)

That location was no problem with version 1.8.

Kind regards,
Rob

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

Hi @rouderaa42

When you say "Read Only mode", do you mean that a "Cannot edit in read-only editor" tooltip appears any time you attempt to type in the editor?

image

Or are you seeing something different from that?

Does the problem also occur if you save the sketch to your C: drive?

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 ?

Why speculate when it would only take a few seconds for you to find out?

Save the sketch to a path that does not contain the Windows user path and then comment here to let us know your findings.

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 :slight_smile: )

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.

Hi,

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.

Kind regards,
Rob

If you are interested in building the Arduino IDE from source, I would be happy to help you out with that. There are some instructions here:

https://github.com/arduino/arduino-ide/blob/main/docs/development.md

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:

  1. Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
  2. Run the "Toggle Developer Tools" command.
    The "Developer Tools" panel will open on the left side of the Arduino IDE window.
  3. Select the "Sources" tab from the Developer Tools panel.
  4. 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.
  5. Select the "Page" tab from the the "Navigator" panel on the left of the "Developer Tools" panel.
  6. Select top > file:// > <IDE installation URI> > bundle.js from the "Navigator" panel.
  7. The Arduino IDE UI will now hang for a while. Wait for it to become responsive again.
  8. Click the icon on the "Developer Tools" panel toolbar.
  9. Select "Open file" from the menu.
  10. From the menu that opens, select the source file where you want to set a breakpoint.
  11. Click on the left gutter at the line that contains the code of interest to add a breakpoint.
  12. Deselect the "Deactivate breakpoints" icon if it is selected.
  13. 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.
  14. When finished debugging, select the "Deactivate breakpoints" icon.

Try opening Arduino IDE to run as administrator. I experienced the same issue and this got me by until I can sort it out.

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