Editor config new line at start of file - code-formatting

Editor config has an option to insert blank lines at the end of the file. Is there something similar which allows for blank lines at the start of the file, ignoring shebang lines?

Related

How can I configure Spacemacs to always add a newline at the end of files when saving?

I would like text files that I edit in Spacemacs to always end with a newline (\n) when I save them, even if I don't explicitly add it. How can I configure Spacemacs to do this?
I noticed this issue when created a file called .clangd with the contents
CompileFlags:
Add: [-Isrc, -Isrc/effect]
When I wrote this file with :w, it did not have a newline at the end of the file.
(setq require-final-newline t)

How to paste multiline text in pycharm?

Everytime i try to copy and paste something on my Pycharm editor it all paste it in single line. How to automatically paste in multiline?[1]
This is what i copied.....
[{"DateObserved":"2020-06-12 ","HourObserved":23,"LocalTimeZone":"EST","ReportingArea":"Central New York Region","StateCode":"NY","Latitude":42.8049,"Longitude":-76.3589,"ParameterName":"O3","AQI":35,"Category":{"Number":1,"Name":"Good"}},{"DateObserved":"2020-06-12 ","HourObserved":23,"LocalTimeZone":"EST","ReportingArea":"Central New York Region","StateCode":"NY","Latitude":42.8049,"Longitude":-76.3589,"ParameterName":"PM2.5","AQI":0,"Category":{"Number":1,"Name":"Good"}}]
and this all got pasted in a single line on my Pycharm editor. can anybody help with that, its pretty hard to read all this info on a single line?
It seems like you didn't copy anything containing newlines as you can see better after my edit (See the side-by-side-markdown diff so you can see that I didn't remove any line breaks).
If you just copy everything as a single line, PyCharm won't be able to split it into multiple lines (except with auto-format maybe).
As you haven't said how you copied the input, I can't say what exactly is wrong.
However, it seems like you copied something from a program that didn't display the text correctly so that you couldn't copy it correctly.
Another possibility is that the IDE interprets line breaks differently.
For example, windows uses CRLF(carriage return+line feed) as a line seperator while linux uses LF only.
If your file contains only LF line breaks and PyCharm is configured to use CRLF like breaks, it is possible that it ignores them because of that.
You can change that behaviour at the bottom of your file in PyCharm (button with CR/CRLF/LF).

How to append one text file to another text file

I need to append 1 text file to another text file.
I've done several keyword searches, and keep coming up with instructions on adding text to an existing file ... which is not the same as appending one text file to another text file.
In a well-designed language, it might look something like the line below, with the contents of source2 added to source1.
Append(path/source1, path/source2, ResultCode)

VB.NET Append text to the end of a line in an exiting CSV file

How can I append text to the end a line in a text file with lines already there in VB.NET?
For example my text file looks like this:
header1,header2,header3
value1,value2,value3
stuff1,stuff2,stuff3
and I want to add new text to the end of each line so it looks like this:
header1,header2,header3,newheader
value1,value2,value3,newvalue
stuff1,stuff2,stuff3,newstuff
I know that in Perl you can point to the line and then act on it, is there some VB.net way to do this?
If the file isn't too big, the simplest is, probably, to use the IO.File.ReadAllLines method to read the file into memory and modify the data and write it back with the WriteAllLines method.
For very large files you're probably looking at reading each line modifying it and writing it to a different file.

Not completed file reading

I'm trying to print the number of rows in my file training.txt but found out that my code does not read the whole file. Code goes like this:
row = 1
for line in io.lines 'training.txt' do
row = row + 1
end
print(row)
I tried changing the file with test.txt that has the same format with training.txt and file reading worked fine, reads until the end of file. So maybe the problem is with my text file? But how? It has the same format.
Text files are uploaded here for testing.
The file you uploaded training.txt is not the same format as test.txt, it does not have newline characters that indicate the EOL (End of Line). Try opening it in notepad to see the difference.