Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[configuration] UNC/folder path #184

Open
lsiepel opened this issue Dec 29, 2019 · 7 comments
Open

[configuration] UNC/folder path #184

lsiepel opened this issue Dec 29, 2019 · 7 comments

Comments

@lsiepel
Copy link

lsiepel commented Dec 29, 2019

The extension detects some errors in my example.rules files, but when i double click the problem it shows an error that file does not exist "\etc\openhab2\rules\example.rules"

The error has to do with a wrong UNC path. The documenation states it should be one of the two:
Samba share (e.g. \OPENHABIANPI\openHAB-conf) Local folder (e.g. c:\openhab\configuration)

My setup has a different UNC path, so i get errors when using the extension. And i would like to keep my hostnames / UNC shares and all thta the way it is. So i would like to request a feature where the extension has a configuration option to specify the UNC path.

@Confectrician
Copy link
Collaborator

Hi @lsiepel and thanks for your input.
Changing this behavior by a simple setting, is not that easy.

If your are using remote LSP Server, the error messages get delivered from you openHAB environment and from my current knowledge we have no real influence in the message generation.

The extension just starts a lsp connection and the rest is done in background via the involved node packages.

We could maybe do something for the local lsp server, but i doubt that the local one would even generate the described problems, since it would check the code based on the opened folder.
This way the path should already be the one you have choosen.

And a short disclaimer:
I am really no expert in this lsp stuff, so i am maybe completely wrong with my assumptions.

@lsiepel
Copy link
Author

lsiepel commented Jan 3, 2020

I f i understand it right: The errors are generated from the remote LSP and shown in vs code. If you double click the error, vs code tries to open this UNC path that is provided by the LSP.

I think there are 2 possible solutions (but i'm no expert)

  1. Not sure of it is a elegant solution or a dirty hack, but what if you provide the vs code extension with a path override configuration setting. When the vs code extension receives a problem message from the LSP, it could inject / overwrite the UNC path. Pro: every client can have it's own UNC / path set.

  2. Somehow set the path at the openhab installation / wihtin the LSP host. Con: all client machines should have the same UNC path / samba share. (the same as it is now, but configurable)

@Confectrician
Copy link
Collaborator

  1. Doesn't work unfortunately. (At least not that easy, or i am to unexperienced here)

This is the complete (extension side) code for the remote lsp server:
https://github.com/openhab/openhab-vscode/blob/master/client/src/LanguageClient/RemoteLanguageClientProvider.ts

We are just starting an instance of the vscode-languageclient package, with our predefined configuration values.
All feedback (including errors) and handling is then done via the package itself.
Maybe we can use the package in a more advanced way, but i have not looked into this.
So i can't say much about the capabilities currently.

But generally yes:
It would be the smoothes way to get some info about an error that is going to be displayed and then map and modify the corresponding file paths.
Or configure the vscode package to dont offer the file opening option, if possible.

@lsiepel
Copy link
Author

lsiepel commented May 13, 2020

Is this helpfull? file acces is done at implementation level. So if i understand this, there should be some place to temper the url.
https://stackoverflow.com/questions/49670048/how-does-vscode-handle-file-path-when-executing-a-language-server-remotely

I haven't read everything, but couldn't find anything related @ https://code.visualstudio.com/api/language-extensions/overview

@LeeC77
Copy link

LeeC77 commented Jul 19, 2020

Hi I have this error too.

Unable to open 'Astro.items': Unable to read file '\etc\openhab2\items\Astro.items' (Error: Unable to resolve non-existing file '\etc\openhab2\items\Astro.items').

It can be forced on any file (*.rules , *.items etc ) by right clicking on a command word and requesting 'Goto Definition' in the VS Code editor.

I have a very recent RasPi 4 openhabian install; openhab version 2.5.6 Release.

At first I just thought it was a problem with the host name being set to 'openhab' by the openhabian install on my RasPi . So I changed it to 'openhabianpi' as indicated at https://github.com/openhab/openhab-vscode/blob/master/docs/USAGE.md

Samba share (e.g. \OPENHABIANPI\openHAB-conf) Local folder (e.g. c:\openhab\configuration)

but that didn't help.

So I also shared the root (path=/) via samba from the RasPi so that the whole path was exposed just as in the error message. I then mapped a drive to this on my window 10 machine where I have VS Code version 1.47.2 installed and pointed at this mapped drive.
I have the openHAB extension enable in VS Code with the following in the settings file

{
    "openhab.host": "openhabianpi"
}

I have tried serveral things, uninstalling reinstalling the VS Code and the extension also but no change.

Think this should be a dug as there is no Language Server validation without it, as far as I can tell.
The Rest API works just fine populating an Items and Things Tree in VS Code.

Thanks for any help you are able to give.

@im0nKeY84
Copy link

Any updates on this issue? Because I'm experiencing the same.

@Confectrician
Copy link
Collaborator

No.

Same status as stated here: #184 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants