Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Losing code (getting nervous!), Editor quirks

in Bugs Posts: 41

Hello all,

1)With Codea 3.0, and with my project file stored in the Working Copy directory, I am experiencing issues where I will run the project, then return back to the code, then maybe try to run it again and return to code, and it seems to have lost recent changes that I had made. This isn’t a proper bug report, as I haven’t yet put a finger on exactly how to reproduce it. I just know I’ve lost some code this way a handful of times today, and I’m wondering if this is a known issue. I will try to pin down a sequence to reproduce the issue.

With the previous version, I never had an issue like this. Code I wrote was code that stayed.

2) The editor isn’t consistently ‘behaving’ properly - for example, I’ll tap return after entering function foo() and Codea doesn’t always auto add the end keyword. It also is not always auto-indenting lines within a code block.

Tagged:

Comments

  • dave1707dave1707 Mod
    Posts: 7,810

    @brianolive What level of 3.0 code are you running. I mentioned the missing end keyword and left justification problem in the Codea version 184 discussion. As far as I know it was fixed and I haven’t seen it since. As for the missing code, I think I remember that happening but I’m not sure what version that was in and if that was also fixed. I’m not sure if it has happened recently. I’m currently running Codea 3.0.1 version 187.

  • Posts: 41

    Version showing as 3.0 (187).

    Project being in working copy doesn’t seem to have anything to do with it. It just happened with a project stored in the Codea folder.

    I’m not doing a good job tonight of tracking what leads up to the problem! Each time it happens, I don’t clearly recall what I did right before it happens...to be continued...

  • Posts: 1,326
    All,
    I wonder if this is tied in with the disappearing keyboard. Recently found the keyboard not being launched after tapping an input or the screen in the editor. Seemed to happen when I had left the editor for a while. Closing project and re-opening needed to resume normal editing.
  • SimeonSimeon Admin Mod
    Posts: 5,054

    @brianolive are you using the feature where you can drag-and-drop sprites or shaders into code? Because there appears to be a bug with that where changes are lost

  • Posts: 41

    @Simeon No, I am not using that feature (but sweet feature, btw!). I'm sorry to make you have to guess what I'm doing. I'll figure out exactly what I'm doing that causes this to happen - hopefully later this evening.

  • Posts: 13

    I’m losing code also, just by tapping code, run it, and Codea crash.
    When I reopen the project, it has returned to it’s preview save. My solution is to close and reopen the project before each run. -_-

  • edited October 3 Posts: 1,326
    Hi All,
    Could you all post your iOS and Codea versions when you post (like @dave1707), it helps narrow down the problems and helps @Simeon et al focus on the right code. Or, you could fill those details in your profile and update when necessary.

    I'm on iOS 13.1 and Codea 3.0.1 (187).
  • Posts: 41

    @Simeon , what is happening to @moechofe2 is what I am experiencing. I thought it happened in another case too, but at least once I definitely had the same sequence of events he had. 3.0 (187)

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @brianolive @moechofe2

    So the process is
    1. Run code
    2. Codea crashes (code doesn't run)
    3. Re-open Codea and notice that last edits are not saved in the file

    But I'm guessing (2) doesn't happen consistently?

    There is a hidden feature that might help you work around this while I debug the issue:

    1. Long press the play button in the top right corner
    2. A dialog will pop up asking to save your project prior to running it
    3. Choose "Save & Run"
  • Posts: 41

    Long press play - nice! Great to know.

    Step 2 is not a problem on your end - it is not consistent. That (usually) only happens when something is wrong with my code that makes Codea/Lua unhappy...

    The loss of state after that crash is the issue.

    I have also seen this code loss happen though without an app crash. I’ll return to the code editor, maybe make some code changes, run my code again, and then notice that the program is still executing from the previous version of my code (i.e. how the code was before my most recent edits). I’ll think to myself (for example), “How can that be? I just commented those lines out”, or something like that...then return to the editor, only to see that the changes I made (commenting out lines, adding new lines, etc.) are gone. Codea was running the code from a state before my last changes.

  • Posts: 13

    IOS 12.4.1
    Codea 3.0 (187)
    I’m using iCloud as document storage from the setting app.

    @Simeon the steps are exactly as you describes.

    I will be aware the next it crash and trying to explain more precisely.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    Thanks for the details! I'll keep looking into this, for now please try using the long-press option

    (The reason this isn't the default behaviour is in case you are editing documents over a network, where the save could take a long time)

  • Posts: 1,326

    @Simeon - may be related. Firstly I have had a few crashes recently with a project that I have been putting together. It involves multiple print() commands and I think memory requirements were probably exceeded.

    The issue I would like to raise was after running Codea, I opened the Codea root folder up in the files app. Whilst playing around in the files app looking for a file Codea bombed out. I will try to reproduce - have you altered the file system within Codea in the latest version?

  • Posts: 437

    I'd like to add a data point. I'm on the latest published version of Codea on iPadOS. I've experienced it where Codea seems to have cached an old version of the code and it runs that rather than any changes. If I exit the editor, run another Codea program, and then return to the original one then the code is the old version and my changes are lost. It is intermittent, but there are no crashes involved.

    The long press to reveal a "save" option is fantastic - I was going to request a "force save" option to avoid this issue.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @Bri_G what issue did you find in the file system? I haven't altered it, inside the Codea folder there is your documents, and any folders with projects are treated as collections in the UI

    @LoopSpace thank you for the extra report. Would you say it happens often? I'll try to track this down

  • edited October 5 Posts: 1,326
    @Simeon - No issue with the file system, Codea was running in the background whilst I was using file app on the Codea folder. A shrinking window.popped up over the file window - an alert to say Codea had bombed. The alert was very brief, so I missed the detail but got the message.

    Oh, by the way - thanks for the save then run option, I may use that by default.
  • Posts: 1,326

    @Simeon - just found another issue. After using search and replace, on returning to the editor window, I found several instances of the highlighted search term dotted round my code - in some cases in free space in others overlapping my code.

  • Just an update: long press save (see @Simeon ‘s comment above, is not fixing my problem...

    I just spent a few cycles of tweaking a function, then long-press saving and running, and not seeing results I would expect. Once I added some obvious print statements and didn’t see them, I decided to exit the project and reopen. Sure enough, there was an older version of my code, and that was the version that had been running each time. The code shown in the editor was not what was getting executed. After each run attempt and return to the editor, I would see my changes in the editor, but none of it would affect program behavior.

Sign In or Register to comment.