Why does smarthings IDE show an extra line at the end from github?

(Don Caruana) #1

I’m noticing that when I pull in some device handlers, the IDE immediately shows them as being updated in the IDE but not in Github (colored blue). When I use the magnifying glass to show the differences, the only difference is that the IDE thinks there’s an extra line at the end coming from github, but it does’t have that - see below. This is a simple file that’s just enough to be valid just for testing.

In github, there’s only 12 lines, not 13, yet the IDE has added an extra line and said their out of sync. I’ve even tried this with another repo (not mine) and I get the same thing with files I created in the 2nd repo (although it’s not tied to my IDE - separate account).

Any idea what causes this and what I can do differently to keep this from happening?

(Don Caruana) #2

@erocm1231 - I don’t get this when grabbing any of your stuff. Can you share your magic or fix my stupidity? :slight_smile:

(jkp) #3

I’ll bet you are hitting the return key after the } on the last line of code which would add the blank line. :slight_smile:

(Don Caruana) #4

Nope…here it is in Github:

The odd thing is that when I go to edit the file, it does put an extra line at the bottom. But when I commit, there is no extra line, just like in the pic

(Jason "The Enabler" as deemed so by @Smart) #5

Actually, click on the RAW button in the top right of the screen, then copy and paste.

(Don Caruana) #6

I don’t see an extra line there, but there is an extra character at the end of the last line. I can’t exactly tell what it is.

When I go to edit the file, the first thing I see is this:

Now, if I do nothing more than back space so my cursor is at the end of the end of file line and I preview changes, I see this:

The red icon is “No newline at end of file”. The problem is that no matter what I do, I can’t get the IDE to match. If I add a line, the IDE just strips it. It’s like the IDE knows that git is telling it there should be a line at the end, but when it brings it over, it gets rid of it. If I go in to the IDE and then add a line at the very end, which is what it thinks is in git, it then says it’s synced up (black). After that, changes from the repository work fine.

(Allan) #7

Noticed the exact same thing with multiple DTH’s including some pulled form my own GitHub repo. They are in black but have the “Edited” tag with the magnifying glass under Status. Have to go into them and do a publish -> for me even though that was done when I downloaded them.

I swear this is something new that started happening in the last couple weeks.


The IDE code expects that you will have a blank line at the end of the file. When it doesn’t see it, it will insert the line and then show that it differs from the code in Github

(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #9

I approve :slight_smile:.

I’m sure this is a coding “religious issue” (like tabs vs spaces); but I am in the camp that believes every text file must end with a newline character. (Not a blank line exactly… But a newline.).

(Don Caruana) #10

@workmonk - That’s the problem - the IDE doesn’t insert the blank line. In the IDE, there is no blank line at the end. If I put one at the end in git, the IDE strips it off. So no matter what I do, the IDE doesn’t match git. The difference is that the IDE always has less blank lines than the code in git - it strips everything past the last character for itself, yet what it pulls from git (in the compare) always shows the extra line(s).

(Eric M) #11

Honestly I have no idea. I can’t think of anything special that I do that would be fixing it.

(Don Caruana) #12

They like to keep us on our toes, eh? LOL

Actually, I did a repull of one of yours and had the same issue. Some weirdness with the IDE I think. Who knows…it’s a simple workaround at least. Hopefully @workmonk looks at this again and had some more insight…