TypeFox / yang-vscode

A VS Code Extension for YANG
Apache License 2.0
26 stars 10 forks source link

Unable to import "well-known" modules #29

Open ibarrere opened 3 years ago

ibarrere commented 3 years ago

Hi there, first of all great tool, it helps me a lot!

I use it with Cisco NSO primarily, and most of my modules have a set of imports for things like ietf-yang-types, tailf-ncs, etc at the beginning, but yangster doesn't seem to be able to resolve those. They are underlined and hovering over them prints up "Couldn't resolve reference to AbstractModule 'ietf-yang-types'.(org.eclipse.xtext.diagnostics.Diagnostic.Linking)".

Is there any way to fix this or at least ignore these errors?

Thanks!

jnyany commented 3 years ago

Hi there, I have the same problem too. Anybody knows the solution.

nckbgov commented 3 years ago

To manage such situations with the actual state of the extension, I specify external modules in the settings files:

~/.yang/yang.settings

{ "yangPath": "/my/home/yang/libs/rift.zip" }

For those who use NSO, here are some path examples:

{ "yangPath": "/home/vagrant/ncs-5.5/src/ncs/yang" }

or even:

{ "yangPath": "/home/vagrant/ncs-5.5/src/ncs/yang:/home/vagrant/ncs-run/packages" }

More about this:

https://github.com/theia-ide/yang-lsp/blob/master/docs/Settings.md

ibarrere commented 3 years ago

@nckbgov cool, thank you for the feedback. I will give this a try.

ibakard commented 3 years ago

@nckbgov Your advice works.

However, the $HOME or ~/ in "yangPath" path are not resolved. In result, yang.settings in project folder cannot be put in a git repo used by different people. Similarly, yang.settings in ~/.yang folder will not be set by a project git repo. Not quite convenient.

akaevgen commented 1 year ago

Has anyone solved the problem?

My Setup is Win10 + WSL VS Code + WSL Extension + Yangster

There are no problem when module name typed completly, but Yangster cant't resole modules while typing =(

image