TypeFox / yang-lsp

A Language Server for YANG
http://www.yang-central.org
Apache License 2.0
51 stars 13 forks source link

Serialization fails of description text ending with semicolon + newline + text #197

Closed andreasjakobik closed 3 years ago

andreasjakobik commented 3 years ago

Hello,

When serializing a yang module containing the following...

        leaf user-label {
            type string;
            description "Here is a list;
                x
                y
                z";
        }

... the following incorrect syntax is produced:

        leaf user-label {
            type string;
            description "'Here is a list";
                x
                y
                z';
        }

Notice the badly places single quote characters! It seems that the semicolon following by a newline followed by text triggers this behavior. Replacing the semicolon with a colon works just fine.

Thanks, Andreas

dhuebner commented 3 years ago

@andreasjakobik Hello Andreas,

I tried your example in an editor and also tried to serialize it programmatically (with and without NodeModel) but I can't reproduce it.

Do you have a hint how to reproduce it?

andreasjakobik commented 3 years ago

Hello Dennis,

Turns out it is not a yang-lsp problem. I was about to explain exactly how we reproduce the fault, and in that process discovered it is in fact our own code that cause the crazy serialization, my bad.

Sincere apologies. Case can be closed.

Thanks, Andreas

dhuebner commented 3 years ago

Closing as not yang-lsp

andreasjakobik commented 3 years ago

Hello Dennis,

There does seem to be a few legit yang-lsp serialization issues remaining though. One such case is where multiple keys have been defined for a list. They come out without being enclosed in quotes, which cause both Pyang and confdc validation errors.

key a b c;

Our code fixes those cases currently (but went wrong for the current reported case), but it would be best if the serializer takes care of them.

I will open new yang-lsp issues after careful analysis.

Thanks! /Andreas