CompileErrors after Restore #1372
Replies: 5 comments
-
Posted at 2020-03-26 by @gfwilliams Can you just load or copy the file into the right hand side and upload from there? It seems like you may have hit https://www.espruino.com/Troubleshooting#i-ve-pasted-code-into-the-left-hand-side-of-the-web-ide-and-it-doesn-t-work |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-03-26 by TheAkki I "only" use the tight hand side. It does not work. So i think i'am not affected by the problem with the left hand side problem. Right? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-03-26 by Robin Thr 2020.03.26
Not true as, @TheAkki, I agree your code file as is, causes ther error(s) you see. I stripped out some detail, and found the solution.
As you have indicated new to JS and from your coding style, I believe your background is in C/C++ as I adopted the K&R style back in the 80's, and use many of the conventions, such as same column curly braces shown in your code. The WebIDE needs a minor change to that thinking in order to enter a line of code, or delimit a code block.
Do not follow the suggestion 'The easiest way to fix this is to write code in the K&R style:' that was provided in the post #2 link, as it is clearly an error, and even documented as such, when one follows the embedded link to the wiki destination. Anyone that actually read K&R would immediately recognize that statement error.
(which the code snippet example does not follow) I, self taught 'C' reading the original [K&R book](https://hikage.freeshell.org/books/theCprogrammingLanguage.pdf) back in the late seventies, before the schools even taught here locally, and was introduced to the opening curly brace on the same line Java variant in Steve McConnell (2004) Code Complete, and dismissed it as inconvenient. It wasn't until using the WebIDE forces this convention in order to make the distinction between the end/begin of a function and a code line, that using it became necessary. Still prefer K&R style BTW. > 'So i had copy it in an editor notepad++ and saved it.' During the copy-n-paste step into notepad++, there is a setting (which I haven't found yet) that auto completes code blocks, based on style. It appears that a new-line was added before each curly brace, thereby violating the WebIDE requirement in order for Espruino to recognize the difference. Simple fix, painful as re-editing it will be. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-03-26 by TheAkki @robin Thx for the help. So i will avoid to copy it in notepad. ;) I will try if it works. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-03-27 by Robin Thr 2020.03.26
Try the second snippet from post #4. It does work/compile.
There is an option within notepad++ just haven't found it yet. Ohhhh, @TheAkki no need to avoid notepad++ as I use it as my primary Espruino development. I use it daily and with 1000+ lines of code, such as your code file. Edit the file which will reside in the \Projects folder of the WebIDE save location, using the nice color hilighting, bookmarks and indentation etc. within notepad++. Save the file. Go to the WebIDE and click the lower folder on the middle bar. Select that file and it will appear on the right hand editor side. Click the upload icon. While editing on the right side, be careful using the save icon. It is easy to get/lose file edits when using the WebIDE and notepad++ together. Got burned a few times with lost edits and took a bit of patient learning to maintain and get the hang of it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2020-03-26 by TheAkki
Hello,
i'm new at using js and the web ide.
Yesterday, i wrote lot of lines in the web ide and it was running. I can not save files in the ide on disk: the IT rules of my company do not allow js files... :(
So i had copy it in an editor notepad++ and saved it.
Now, i want to continue my work. So i had open the file from the web IDE. I get a lot of errors which i don't understand.
Whats wrong? How can i fix this?
Why i can't copy from left hand side of IDE?
Greetz
TheAkki
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions