TypeFox / yang-lsp

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

Yang Outline Issue #149

Closed huyuwen closed 5 years ago

huyuwen commented 5 years ago

We have some yang modules which has a few revisions with different dates. For instance,

module abc {
    revision 2018-10-10 {
          ext:version 4;
          ext:release 5;
          ext:correction 6;
    }
    revision 2018-09-10 {
          ext:version 1;
          ext:release 2;
          ext:correction 3;
    }
}

But in the yangster outline view, module a's outline looks like,

abc.4
abc.5
abc.6
abc.1
abc.2
abc.3

Actually, the outline should looks like,

2018-10-10
  --version 4
  --release 5
  --correction 6
2018-09-10
  --version 1
  --release 2
  --correction 3

So basiclly, I think, is this bug related to GH-144: Switched to the hierarchical document symbols in the outline?

kittaakos commented 5 years ago

@huyuwen, your example produces errors. Correct me if I am wrong, but a revision statement can have one description and one reference sub-statement. Most likely I am missing something. Can you please provide me an example I can transform into test cases? Thank you!

huyuwen commented 5 years ago

Hi Kittaakos, Sorry, I miss your reply last week. This is the complete test case.

module abc {
    yang-version 1.1;
    namespace abc;
    prefix a;
    revision 2018-10-10 {
          a:version 4;
          a:release 5;
          a:correction 6;
    }
    revision 2018-09-10 {
          a:version 1;
          a:release 2;
          a:correction 3;
    }
    extension version {
        argument value;
    }
    extension release {
        argument value;
    }
    extension correction {
        argument value;
    }
}
kittaakos commented 5 years ago

Thank you, @huyuwen!

kittaakos commented 5 years ago

@huyuwen, for the model you have specified above we show the current outline (as of the master)

screen shot 2018-11-12 at 10 51 17

With my changes it looks like this:

screen shot 2018-11-12 at 11 22 23

Q: Do you want to get rid of the extension statements from the outline as you have described initially or is it OK to have them as individual extension nodes (version, release, and correction) in the outline. Thank you!

huyuwen commented 5 years ago

@kittaakos, There is no need to get rid of extension from outline. The new outline looks much better. The only thing need to be improved is the unknow statement in revision.

2018-10-10
  abc.version.4
  abc.release.5
  abc.correction.6
2018-09-10
  abc.version.1
  abc.release.2
  abc.correction.3
version
  abc.version.value
release
  abc.release.value
correction
  abc.correction.value

The extension name should also be shown in outline, but not only the prefix.

kittaakos commented 5 years ago

Thanks for the feedback, I adjust the PR.

kittaakos commented 5 years ago

After the adjustment, the outline is this:

screen shot 2018-11-12 at 13 50 58