openhab / openhab-vscode

VS Code extension for openHAB configuration files
https://marketplace.visualstudio.com/items?itemName=openhab.openhab
Eclipse Public License 2.0
159 stars 47 forks source link

LSP Autocompletion / Syntaxcheck not working #199

Closed thackel closed 3 years ago

thackel commented 4 years ago

Expected Behavior

Autocompletion for item/group names in rules. Syntax check in rules files.

Current Behavior

No autocompletion or syntax checks. Just syntax highlighting is working (which is probably a local function).

Context

Mount the workspace with the SSHFS plugin https://github.com/SchoofsKelvin/vscode-sshfs to get a workspace with the openhab configuration directory. File creation, modification and deletion is no problem and all gets recognized by openhab.

The LSP Server and its port is accessible from the workstation. Openhab host/port is defined and the HTTP-API access from within code is working. RemoteLsp is enabled.

There is not a single entry in the output regarding the usage of the LSP server except openHAB vscode extension has been activated.

Your Environment

Version: 1.42.0-insider Commit: c4b6a6b537de49a734d0eedea06152ea37dfdb6a Date: 2020-01-28T06:36:30.779Z Electron: 6.1.6 Chrome: 76.0.3809.146 Node.js: 12.4.0 V8: 7.6.303.31-electron.0 OS: Linux x64 5.3.0-26-generic

Confectrician commented 4 years ago

Did you verify this with a "op purpose wrong" configuration?

The output you are referring to, is the one directly generated by the extension. image

Remote LSP Server would generate an own output channel and show possible problems, if errors would occur on the server while checking your config files.

thackel commented 4 years ago

I've made a wrong configuration (non existing hostname) and expected error messages occur:

openhab lang server:
Error: getaddrinfo EAI_AGAIN wronghostname
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) {
  errno: 'EAI_AGAIN',
  code: 'EAI_AGAIN',
  syscall: 'getaddrinfo',
  hostname: 'wronghostname'
}

openhab server:
[Error - 18:57:28] Connection to server is erroring. Shutting down server.

After changing the hostname back to the valid one no error occured. Completion just shows "ABC" type and snippets/templates.

I traced the network traffic and can see that there is communication on port 5007 {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///openhab/conf/items/mobilephones.items","diagnostics":[]}}Content-Length: 134 There is no response to this calls.

There is a bigger initialization request which results in {"jsonrpc":"2.0","method":"initialized","params":{}}Content-Length: 337

I suspect its some problem with folders/URIs. Snippets from the bigger init part:

..."rootPath":"/home/thomas/smarthome","rootUri":"file:///home/thomas/smarthome"...

... "workspaceFolders":[{"uri":"file:///home/thomas/smarthome","name":"smarthome"},{"uri":"ssh://openhab/","name":"SSH FS - openhab"}] ...

Of course locally not a single file exist. They are mapped with the SSHFS plugin.

Wikibear commented 4 years ago

LSP doesn't work for me under Windows 10. Extension Version: 0.7.0 VSC Version: 1.45.1

My config:

{
    "openhab.host": "smarthome",
    "openhab.port": 8090,
    "openhab.karafCommand": "ssh pi@smarthome -p 8101",
    "openhab.remoteLspPort": 5007,
    "openhab.remoteLspEnabled": true,
    "workbench.iconTheme": "openhab"
}

Via Linux Mint i don't have any problem. There is all working perfect.

udo1toni commented 4 years ago

Please use a Network Drive Letter for the Samba network share

Wikibear commented 4 years ago

Network drive letter is set. At first installation some month ago, everything working. After updates it doesn't work any more. I've reinstalled openhab plugin and this issue stay. All other things working. Only LSP doesn't work. I can set rules or items. I get all data, but no LSP.

ZackEndboss commented 3 years ago

I do have the same Issue. Clean Installation but no Autocompletion - only "Loading..."

thackel commented 3 years ago

To avoid the capturing of this ticket to maybe not directly related things.

My original problem was to use a SSHFS mount with the SSHFS plugin of VSCode. I wanted to avoid the exposure of the configuration and liked the SSH approach. This did not work as intended so I opened this ticket.

But this does not work at all and will probably never work:

It does work only with properly mounted (outside of vscode, OS/FS layer) configuration paths.

So I am closing this issue now.