RC9.4 restored sketch - only shows teensy cores header file (Print.h)

Sort of an interesting, sketch window, that I am not fully sure exactly how I was able to get it into this state. I know it is related to the issue if the files are deleted from underneath the browser it will remove the files from the list and sometimes give cryptic error messages, like cannot track all of the files...

I had RC9.4 up with two windows open. One of which (actually both) were part of a github project.
The code they were in was part of a PR back to the master branch. The PRs were pulled in.

So I changed branch back to master. Git gave cryptic message about not being able to delete folder. Fine. I then did the

git pull upstream master
git push origin master

To bring in the changes.
Went back to check the sketches and saw:

The window shows as keyboard_viewer which is the name of the sketch (only source file), but the window is showing the contents of print.h which is in the core files
(C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.0-beta1\cores\teensy4\Print.h)

So how is it displaying this file? I know yesterday I did a build which I screwed up and there was a error messages shown from this file, but?

I know most of this is a duplicate of previous issues on github. Would maybe raise it there, but again not sure how I got there.

Hi @KurtE. I can reproduce this by doing the following:

  1. Create a sketch with the following code;
    void setup() {
      Serial.print("");
    }
    void loop() {}
    
  2. Save the sketch to some convenient location.
  3. Select Tools > Board > Teensy > Teensy MicroMod from the Arduino IDE menus.
    ā“˜ It will work with any board from any platform. I only picked this board since it is the one you were using.
  4. Wait for the "indexing: ..." indicator to appear at the left side of the status bar and then disappear at the completion of that operation.
  5. Right click on print in the sketch code.
  6. Select "Go to Definition" from the context menu.
    The file Print.h from the Teensy platform's core will now open in an editor tab.
  7. Using the Windows File Manager, delete the .ino file from the sketch folder.
  8. Switch back to the Arduino IDE window.

You will now see that the editor tab for the deleted .ino file was removed from the IDE window, leaving only the "Print.h" tab. Arduino IDE 2.x has a "file watcher" that causes it to reflect any changes made to the sketches externally.

I find that if I then restore the .ino file from the recycle bin the editor tab for that file is added back in the IDE window.

1 Like

Thanks,

That is probably it.

I thought I also ran into case where it reopened the window with just print.h in it. But tried to reproduce that, and the current versions now see that the directory does not exist anymore and brings up the default new sketch.

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