I guess, it is extremly difficult. It's relatively easy for a browser to hide lines because the file is only viewed by the user and not edited. It's also relatively easy to hide extra information in documents/files which are designed to contain many hidden data like Word docs or pdf. But it is extremly difficult to hide lines from a text file where no hidden data information can be stored in the file itself. Problems while editing will also occur with line numbering, cursor movements, search functions, copy, cut and paste large areas with not displayed text data, ...
A simple solution for hiding the text itself, but not the lines, is to specify the lines starting with # as line comment in the wordfile and select as text color the color of the background. This will not look beautiful because many "empty" lines could exist, but it's maybe helpful for you.
I think the main reason why it is not possible to hide single lines in a text editor is because nobody (except you of course) seems to need this. Users which use text files use text files because nothing is hidden in a text file.
Best regards from Austria