Trouble with AbstractNativeFileWriter in Native FileType Plugin – SegmentEnd vs. ParagraphUnitEnd != Line end

I am developing a custom FileType plugin for certain text files.

Although I've stumbled several times, I made it pretty far. Files are properly recognized and parsed, all great. My trouble now is with generating the target files.

To be precise: The problem arises with lines that span several segments in Studio. They should be written in one line.

I have tried to accomplish this by replacing the override SegmentEnd() method in the sample with ParagraphUnitEnd():

public override void ParagraphUnitEnd()
    {
        _targetFile.WriteLine();
    }

This does indeed write the paragraphs as one line. Unfortunately it also adds a hard return after each structure tag, which is not intended.

 

So to recap, my problem. Intended outcome:

key1=value1, bla yadda. More yadda.
key2=value2, foo. Bar...

 

Outcome using override SegmentEnd():

key1=value1, bla yadda.
More yadda.
key2=value2, foo.
Bar...

 

Outcome using override ParagraphUnitEnd():

key1=
value1, bla yadda. More yadda.
key2=
value2, foo. Bar...

 

How can I achieve my intended output?

Thanks!