TypeFox / yang-lsp

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

Submodule's belongs-to reference finds wrong main module #195

Closed andreasjakobik closed 3 years ago

andreasjakobik commented 3 years ago

Hi,

If you have a module and its sub module in the same directory, then the sub module's belongs-to reference should first try to find the main module in the same current directory, before trying other more distant places. However this is not the case resulting in the following error on the main module's include statement:

The imported submodule 'subx' belongs to the different module 'simple1'.(included-submodule-belongs-to-different-module)

To reproduce place the following two modules in 2 separate directories (not inheriting one another):

module simple1 {
    yang-version 1.1;
    namespace urn:rdns:simple1;
    prefix simple1e;
    include subx;

    revision 2021-02-22;

    container simple1 {
    }
}

submodule subx {
    yang-version 1.1;
    belongs-to simple1 {
        prefix simple1e;
    }
    revision 2021-02-22;

    container subc {
        leaf x {
            type string;
        }
    }
}

It should be possible to have same set of modules in distinct directories like this without the yang-lsp reference lookup getting lost.

Is this related to fixed issue https://github.com/theia-ide/yang-lsp/issues/190 ?

Thanks, Andreas

dhuebner commented 3 years ago

Fixed