Giter VIP home page Giter VIP logo

openhab-vscode's Introduction

openHAB 1 Add-ons

Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows.

This repository contains add-ons that are using openHAB 1.x APIs. Earlier branches of this repo also contain the 1.x runtime and designer, which are no longer maintained.

Note that all information about openHAB itself, the IDE setup and the contribution processes can be found in the openhab-distro project, so please go there for any further details!

openhab-vscode's People

Contributors

batje avatar claudiospizzi avatar confectrician avatar cwempe avatar dennisausbremen avatar dependabot[bot] avatar gabbe avatar glebster-d avatar kaikreuzer avatar kubamiszcz avatar kubawolanin avatar samuelbrucksch avatar sjsf avatar stefan-muc avatar sumnerboy12 avatar thewilli avatar thomdietrich avatar wborn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openhab-vscode's Issues

Add support for content assist via LSP

It wasn't yet clear to me that so far the LSP support only addresses syntax verification, but none of the other useful features, such as tooltips or content assist.

To not lose track on this, I open this issue. I don't know where the work actually has to be done - whether the ESH LSP bundle needs to be extended or the editor extention or both. But I bet @kubawolanin and @SJKA can tell :-)

Style guide and Linting

Hey @kubawolanin,
this might be a bit early in the process but will be important soon. Which style guide are you following while implementing snippets, code completion and so on? There are currently no defined style guides for openHAB config files or naming schemes for variables/Items/Groups/... Any opinion?

LSP and REST via https not working together

When using https, i can't use LSP. Even when LSP port 5007 is reachable (local network)

With this workspace config i got REST to work, but LSP isn’t
{
"openhab.host": "https://my.domain.tld",
"openhab.port": 443,
}

When the config is changed to a fixed IP, the LSP is working but REST isn't. (nginx is set only to allow https on port 443)
{
"openhab.host": "192.168.1.255",
"openhab.port": 443,
}

Not sure how the host string is handled within the VS Code extension, but i guess https:// is not stripped when used for LSP server connection. Edit: Just checked https://github.com/openhab/openhab-vscode/blob/master/src/LanguageClient/LanguageClientProvider.ts and it's not stripped.

I would recommend an extra setting: openhab.usehttps {false|true} that defaults to false. And disallow any other string in openhab.host then DNS or IP.
{
"openhab.host": "my.domain.tld",
"openhab.usehttps": true,
"openhab.port": 443,
}

That way it's more clear how https can be configured and you can use this new setting to support both LSP and REST at the same time when using https.

Sorting options for the items list pane

Hey @kubawolanin,
yet another idea which might be interesting. Hopefully I'll contribute something myself soon...
The OPENHAB ITEMS pane is a great idea but with the sheer amount of nested groups I've got in my system it's hard to actually find an item quickly.

It would be interesting to be able to switch between sorting modes (nested groups, condensed groups, items only, sorted by item type and so on.

If you gave me a few hints I'd be happy to look into this feature myself.

Thanks!

Beginners documentation requested

After reading the openHAB 2.2.0 release post by Kai Kreuzer, I was curious about the Visual Studio config file extension so I installed Visual Studio Code and the openHAB 0.3.5 extension.
Having read through the readme file, I find the documentation is not supportive enough for beginners.
I set up the "openhab.host" and the "openhab.karafCommand" settings, but it is not clear to me if things are working properly or not.
Some questions

  • Do I still need to set up the Samba on my openHAB server like with the Eclipse RCP "openHAB Designer" ? Or is the file access handled through the REST protocol ?
  • I do see "OPENHAB ITEMS" and "OPENHAB THINGS" in the tree on the left. Does this mean my setup is OK ?
  • How can I quickly open a Karaf window likes shown in the video ? Is there a magic key combination ? I only have the option "I:powershell" in the Terminal Window.

Issue with Hue things -- Missing name, showing Description instead

Hue Things are not handled proper, item creation and thing usage is not possible.

I have several Hue items, and have tham named proper in my Hue.things file.

0220 BadFenster [ lightId = "4" ]
0220 BadMitte [ lightId = "5" ]
0220 BadTuer [ lightId = "16" ]

but in VS it is shown like
vs

and item creation is not really possible via automation:

Dimmer DimmbareLampeWei_Brightness "Helligkeit" {channel="hue:0100:0017882b8525:Schuhstrahler:brightness"}
String DimmbareLampeWei_Alert "Alarm" {channel="hue:0100:0017882b8525:Schuhstrahler:alert"}

Dimmer DimmbareLampeWei_Brightness "Helligkeit" {channel="hue:0100:0017882b8525:Schlafzimmer3:brightness"}
String DimmbareLampeWei_Alert "Alarm" {channel="hue:0100:0017882b8525:Schlafzimmer3:alert"}

any chance, this might be fixed?

regards

Autocompletion issue

Hi 😄

Current Behavior

I try to create a new rule:

screen shot 2017-11-04 at 23 22 22

At this point of my rule, I hit enter to go to next row and continue writing my rule.

But when I do this, my "then" vanishes and gets replaced by the first hit in autocompletion suggestions:

screen shot 2017-11-04 at 23 28 57

I have to correct it manually every time, what's kind of irritating...

Perhaps you'll have an idea how to solve this? I'm sorry I haven't one :)

Expected Behavior

It should go to next row and then propose an Item...

Cheers,
Marianne

Your Environment

  • Version used: (e.g., openhab, vscode and extension versions) oppenhab-2.2.0~20171028111659-1, openhab-0.2.0.vsix, vscode 1.17.2 on macOS 10.12.6
  • Environment name and version (e.g. Chrome 39, node.js 5.4, Java 8, ...): Java 8
  • Operating System and version (desktop or mobile, Windows 10, Raspbian Jessie, ...): Raspbian Jessie

VS Code says: Please open .sitemap file in the editor to add new snippet.

Hi,

When I right-click an item and choose "Insert into sitemap", I get the following error:
Please open .sitemap file in the editor to add new snippet.
I can say that the .sitemap file is opened and had focus right before I right-click on the item.

The same happens when I select "create a rule" from that context menu. This results in:
Please open .rules file in the editor to add a new rule.

I installed VS Code 1.18.1 together with version 0.3.0 of the OH extension on my Windows 10 computer. The conf-folders are available trough samba-shared folders. I also did the user-config (specifying the IP of my OH). My OH is a 2.2 snapshot (build #1096), and is an apt-get install. I'm a new VS Code user, so I can't say when this issue was introduced.

This issue was also logged in the community.

Not sure what other information I need to provide, just let me know. Thanks!

Internal Debugging - Event injection for development and testing

With a connection to the REST API as mentioned in #7 we could next also inject events from within the IDE. This way we could for example simulate the update of an item to e.g. test/debug a rule or sitemap.

I did not yet read up on the extension interfaces of VS Code. Maybe hover actions or a dynamic extension of the context menu is possible for certain elements.

If there's only one sitemap, open it in Basic UI

Currently if we open Basic UI from within VSCode (Ctrl + Alt + O) and sitemap file is not active, the list of available sitemaps displays in the side view.
It would be good to display the default sitemap or the only one if length of /rest/sitemaps is equal to 1.

OH lockup due to VS?

Not sure where the root of the problem ultimately is located,
Using VS code extension for the first time. openhabianpi runs latest snapshot.
I've opened the rules folder and a file and hit the 'save all' button. This resulted in change of a single .rules file only (the one I edited) but apparently in a validation run of all rules files ?
Worse even, this seems to trigger a partial OH lockup (java 1 thread @100% CPU).
Not sure but I don't think that's coincidence as I now encountered this twice.

Not sure how to debug and if this is related,
but then again I don't know how it's all supposed to work in the background (I don't understand what is triggering OH to (re)validate the rules files although those hadn't been changed).

2017-12-19 19:03:32.018 [INFO ] [r$InternalStatefulIncrementalBuilder] - Starting validation for input: 'Garten.rules'
2017-12-19 19:04:17.117 [INFO ] [r$InternalStatefulIncrementalBuilder] - Starting validation for input: 'Dachboden.rules'
2017-12-19 19:04:36.608 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber 'org.eclipse.smarthome.io.monitor.internal.EventLogger@65fb4' takes more than 5000ms.
2017-12-19 19:07:17.263 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber 'org.eclipse.smarthome.io.monitor.internal.EventLogger@65fb4' takes more than 5000ms.

Add code formatting

May be related to #12

TODO:

  • Auto-formatting in *.items files (incorporate Ascii-Table?)
  • Auto-formatting in *.rules files
  • Auto-formatting in *.sitemap files

Feedback regarding connection error

Hey @kubawolanin,
I've just installed the latest version of the extension. The first issue I encountered was that the connection status isn't clearly indicated. The reason for that is that my openHAB(ian) system does not have the name "openhabianpi".
After installation of the extension there was no indication if the extension is doing something or if there was an error. The OPENHAB ITEMS pane was empty, pressing the reload button didn't do anything. Somewhere along this path of first usage I'd expect a warning if there is no connection (REST), the same warning could be shown if the connection is interrupted at a later point.

Thanks!

Log presentation

Present logging data inside the IDE.

  • Access via openhab.log/events.log, Karaf Remote Console or via a dedicated connection (I've got experience with openHAB logging via log4j over TCP sent to elasticsearch)?
  • Presentation as raw text or as interactive panel?
  • Integration of e.g. #8

"Show in PaperUI" URL hard coded

using openhab-vscode in Visual Studio Code on Mac works like a charme. Many thanks for this very usefull enhancement to configure openhab config.

Using the extension I ran into an issue using the "Show in PaperUI" function; an HTTP error was displayed. Checking the source I found out, that the wrong URL was called. The following patch fixed the problem for me:

Possible Solution

`diff --git a/src/extension.ts b/src/extension.ts
index 4874fda..ca6fbb8 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -72,7 +72,7 @@ async function init(context: ExtensionContext, disposables: Disposable[]): Promi
disposables.push(commands.registerCommand('openhab.command.items.showInPaperUI', (query?) => {
let param: string = query.name ? query.name : query
return openUI({

  •        route: '/paperui/index.html%23/configuration/item/edit/' + param
    
  •        route: '/ui/index.html%23/configuration/item/edit/' + param
       }, param + ' - Paper UI')
    
    }))
    `

My Environment

openhab2 v2.0 RC1 - on Ubuntu 17.10

Cheers,

Klaus

Support type hierarchy

Since openhab-vscode, Designer is clearly dead in the water. However, there is one Designer feature, that I miss: Live type hierarchies. I found them useful when working with Lambdas or anywhere where I needed to know the lowest common denominator to pass around values or items.

bildschirmfoto 2017-11-24 um 21 01 19

I know that there are the JavaDocs. But if VS Code in principle supports this feature and if it would be possible to implement it, that would be great.

I realize this is a bit of a first world problem. But I wanted to report it.

Auto-reloading side-view of the Basic UI

Background:

Currently when you have the Basic UI side-view open and work on your *.sitemap \ *.items file, there's no way to preview the changes you've applied.
A workaround is to close and reopen the Basic UI browser.

Implementation:

Attach an action to onDidSaveTextDocument and refresh Basic UI view if it's open.

Details:

https://code.visualstudio.com/docs/extensionAPI/vscode-api

https://github.com/Microsoft/vscode-extension-samples/blob/master/previewhtml-sample/src/extension.ts

https://github.com/openhab/openhab-vscode/blob/master/src/ContentProvider/openHAB.ts#L56

Use openHAB preview on macOS

The logic for building the address for the preview in VSCode is semi static and only works on windows.

I made a quick fix in a PR. #14

Expected Behavior

openHAB preview works on macOS

Current Behavior

The extension tries to parse the files path under macOS and fails. No output.

Env

macOS

Add same name when creating items for things

For exemple with "ThisThing" and a channel "TestChannel", when you right click on this_thing to create all items, item name will be ThisThing_TestChannel. But if you already have some channels and right click on TestChannel, item name will be TestChannel without "ThisThing_" for prefix.

Code completion for Items, Things etc.

Looking at the gifs it seems like Items are not yet known by the IDE. That's probably a feature intended. Are you going to add them by scanning the items files? A connection to the REST API would be an interesting approach (to also cover PaperUI generated Items). The connection to the REST API would also be needed for #8

Connect to REST API via HTTPS

My openhab instance is running on a raspberry pi and shares its config files via samba. On another windows pc in the network I have installed VS Code with openhab addon. I am getting a "Error while connecting to openHAB REST API." error though.

I think my problem is that openhab is only reachable over https on a special port.
https://192.168.2.xxx:8444/rest is working and returning some text. So I added

{
"openhab.host": "https://192.168.2.xxx",
"openhab.port": 8444
}

to my config but the error remains. I also tried it with https://dns-name but no luck either.
Expected behavior for this would be to either just connect with the https in the host string or another setting to enable https

Plugin does... nothing?

I installed plugin version 0.3.5 from plugins panel on vscode 1.19.0. I restarted vscode. Openhab configuration options show up in settings, I set my openhab host properly. I open my config folder mounted via smb and.... nothing. No items panel, no error messages, simply nothing. My rest api is working fine, http://my-openhab-ip:8080/rest/items lists the correct information.

Am I missing something obvious or is there potentially a bug in the plugin?

openhab errors when editing rules and items files

I'm running OH2.2 snapshot on Ubuntu 14.04. I usually use SublimeText as an editor, editing locally. When I use Visual Studio and the OH extension (also locally) I get errors when editing items and rules.

The rules errors look like this:

2017-08-30 14:04:43.325 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'sonos.rules'
2017-08-30 14:04:43.326 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'sonos.rules' is either empty or cannot be parsed correctly!
2017-08-30 14:04:43.969 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'sonos.rules'

The items errors like this:

2017-08-30 14:58:22.347 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'sensors.items'
2017-08-30 14:58:22.353 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.library.items.NumberItem with key 'CoffeePower' already exists! Failed to add a second with the same UID!
[and so on for each item]

then:

2017-08-30 14:58:22.571 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'sensors.items'

I appreciate errors like this are not uncommon with Samba shares - but here I am editing locally.

I logged an issue with eclipse/smarthome - Kai suggested I also log it here.

thank you!

Dan

Quick search in Community forum

Consider adding an action (with or without shortkey) that would allow to search selected text in the Community forum:

https://community.openhab.org/search?q=%s

This will likely open in the external browser (like current implementation of quick Docs search)

Visual Studio 2017

I get problems on 2017. I doubleclick and then I get:
10.7.17 16:41:30 - Found installed product - Visual Studio Enterprise 2017
10.7.17 16:41:30 - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
at VSIXInstaller.App.GetInstallableData(String vsixPath, Boolean isRepairSupported, IEnumerable1& skuData) at VSIXInstaller.App.Initialize(Boolean isRepairSupported) at VSIXInstaller.App.Initialize() at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Disable connection to openhab server

This is a Feature Request.

I would like to see an option to disable the connection to openhab server. I only use the plugin for syntax highlighting. So everytime I save a rule I got some errors and the little blue indicator in the upper right is moving and moving and moving. That's driving me nuts.

De communicatie tussen apparaten ,o

Expected Behavior

Current Behavior

Possible Solution

Steps to Reproduce (for Bugs)

Context

Your Environment

  • Version used: (e.g., openhab, vscode and extension versions)
  • Environment name and version (e.g. Chrome 39, node.js 5.4, Java 8, ...):
  • Operating System and version (desktop or mobile, Windows 10, Raspbian Jessie, ...):

can't access REST API if authentication is enabled on openHAB

I have security enabled for both INTERNAL/EXTERNAL connections (openHAB v1.8.3) so vscode is unable to access the REST API to retrieve the item list.

would it be possible to add optional username/password to settings to allow authentication?

Error while connecting to openHAB REST API

VS code extension given an error "Error while connecting to openHAB REST API". File editing works fine (via samba share).

Versions:

Visual Studio code: 1.18.1
openHAB VS Code Extension: 0.3.0
OS: macOS 10.13 High Sierra

openHAB: 2.2.0~20171018133740-1
OS: Linux version 4.4.0-96-generic

settings.json

{
    "files.associations": {
        "*.log": "properties"
    },
    "workbench.iconTheme": "openhab",
    "openhab.host": "192.168.10.7",
    "openhab.port": 8080
}

Wireshark:
192.168.10.22 = Visual Studio
192.168.10.7 = openHAB
screen shot 2017-11-18 at 11 51 54

Explorer not working

Expected Behavior

Configuring the extension should show items in the explorer.

Current Behavior

Only "OPEN EDITORS" are shown, no "OPENHAB THINGS" or "OPENHAB ITEMS".

Steps to Reproduce (for Bugs)

  1. Install extension in VSC.
  2. Configure:

{ "git.ignoreMissingGitWarning": true, "files.autoSave": "onFocusChange", "extensions.autoUpdate": true, "openhab.paperInBrowser": true, "openhab.useRestApi": true, "openhab.port": 8080, "openhab.host": "10.0.1.2", "openhab.lspPort": 5007, "openhab.lspEnabled": true, }

Notes

I have tested the REST API using curl from another machine (not Openhab) and verified i am able to fetch items without authentication. The extension is installed and enable because i get code completion for example when typing "rule" in VSC.

Example curl response:

curl -X GET --header "Accept: application/json" "http://10.0.1.2:8080/re> [{"name":"spizowa","label":"Spiżowa","link":"http://10.0.1.2:8080/rest/sitemaps/spizowa","homepage":{"link":"http://10.0.1.2:8080/rest/sitemaps/spizowa/spizowa","leaf":false,"timeout":false,"widgets":[]}},{"name":"_default","label":"Home","link":"http://10.0.1.2:8080/rest/sitemaps/_default","homepage":{"link":"http://10.0.1.2:8080/rest/sitemaps/_default/_default","leaf":false,"timeout":false,"widgets":[]}}]

Your Environment

  • Version used: Openhab 2.2.0-release on Ubuntu 16.04 LTS
  • Operating System and version: Windows 10

Dynamic creation of Items from Things's channels doesn't work

When trying to create items from Things, the info message appears: "Please open "*.items" file in the editor to add a new snippet." and nothing is converted.
A file home.items was open in the explorer.

Expected Behavior

I should get the items in my items file.

Current Behavior

I only get an info message and nothing is generated

Possible Solution

ItemsProvider class should be debugged.

Steps to Reproduce (for Bugs)

  1. VS code freshly installed on Windows (Dependencies missing?)
  2. Openhab running on Pi 3 Model B
  3. openhab conf shared via samba as described in tutorials
  4. In .vsconfig (openhab.host and openhab.port give) (should one create a project or open as folder)

Your Environment

  • Operating System and version (Windows 10 <-> Raspbian Jessie)

Remote connections don't work when opening the "root" of a (network?) drive

I think I at least could track down the problem on my side a little of what I first thought was related to #57:

Whenever I open the "root" of the samba share directly as a folder (no matter whether it's as file://10.20.0.15/smarthome or mapped to a network drive like file://o:, then it simply does nothing. As soon as I open a subfolder as the "workspace" in VSCode (i.e. 'file://10.20.0.15/smarthome/conf' or 'file://o:/conf'), then everything works nicely - rest calls go out, items/things are displayed and it starts the LSP connection.

(Windows 10, VSCode 1.18.1, openHAB extension linked from the comment in #57).

Show item values in the code editor

Expected Behavior

Clicking on an item inside of the code editor (i.e. while editing a *.rule file) should more easily show it’s value?
Maybe by letting the item browser window automatically jump the the related entry, by showing a small hint or having it in the context menu somehow?

Current Behavior

Right now the item browser is nice, but as there seems to be no search function it is partially very time consuming finding the related item.

Possible Solution

letting the item browser window automatically jump the the related entry
or
showing a small hint while hovering above it
or
having it in the context menu

Steps to Reproduce (for Bugs)

N/A

Code Validation not working using LSP

Current Behaviour

Code Validation in VS Code does not work (errors are not marked or explained), when clicking on other code lines, I get the following error message in the "Output" ("Ausgabe") area in VS Code:

[Error - 23:25:47] Request textDocument/documentHighlight failed.
  Message: Internal error, please look at the server's logs.
  Code: -32603 
[Error - 23:25:48] Request textDocument/hover failed.
  Message: Internal error, please look at the server's logs.
  Code: -32603 

This happens even when creating e.g. a new rules file.

This is a follow-up to this discussion, in which another user reported the same problem.

My environment

VS Studio Code (running on Win7 PC):
Version 1.19.1
Commit 0759f77bb8d86658bc935a10a64f6182c5a1eeba
Datum 2017-12-19T09:46:23.884Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architektur x64

using openHAB VS Code Extension 0.3.5

connecting to a openhab-2.2.0 distribution running on Raspian Stretch on a Raspberry Pi 3

Log Details

When opening a file in VS Code

(there is nothing logged in the "Output" Section or so in VS Code )

By default, there is no output in the openhab.log related to the Language Server probably due to this change: filter out known exceptions from the log #606
After setting log4j2.logger.lsp4j.level = INFO in userdata/etc/org.ops4j.pax.logging.cfg there is the following output:

 2017-12-28 23:05:07.667 [WARN ] [eclipse.lsp4j.jsonrpc.RemoteEndpoint] - Notification threw an exception: {
  "jsonrpc": "2.0",
  "method": "textDocument/didOpen",
  "params": {
    "textDocument": {
      "uri": "file:///d%3A/openHAB/openhab-2.2.0-rpi2/conf/rules/new.rules",
      "languageId": "openhab",
      "version": 1,
      "text": "rule \"rule name\"\r\nwhen\r\n    Item BL_AZ changed\r\nthen\r\n    logDebug(\"openhab\", \"message\")\r\nend\r\n"
    }
  }
}
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:53) ~[102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:126) [102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
        at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:165) [102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
        at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:136) [102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
        at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:149) [102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
        at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:77) [102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
        at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:84) [102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:51) ~[?:?]
        ... 11 more
Caused by: java.lang.NullPointerException
        at org.eclipse.xtext.ide.server.WorkspaceManager.getProjectManager(WorkspaceManager.java:173) ~[?:?]
        at org.eclipse.xtext.ide.server.BuildManager.internalBuild(BuildManager.java:150) ~[?:?]
        at org.eclipse.xtext.ide.server.BuildManager.doBuild(BuildManager.java:125) ~[?:?]
        at org.eclipse.xtext.ide.server.WorkspaceManager.doBuild(WorkspaceManager.java:153) ~[?:?]
        at org.eclipse.xtext.ide.server.WorkspaceManager.didOpen(WorkspaceManager.java:202) ~[?:?]
        at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$didOpen$4(LanguageServerImpl.java:263) ~[?:?]
        at org.eclipse.xtext.ide.server.concurrent.RequestManager.runWrite(RequestManager.java:71) ~[?:?]
        at org.eclipse.xtext.ide.server.LanguageServerImpl.didOpen(LanguageServerImpl.java:266) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:51) ~[?:?]
        ... 11 more

Here is the payload sniffed on port 5007 using Wireshark:

Content-Length: 1275
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":8888,"rootPath":"d:\\openHAB\\openhab-2.2.0-rpi2","rootUri":"file:///d%3A/openHAB/openhab-2.2.0-rpi2","capabilities":{"workspace":{"applyEdit":true,"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true},"executeCommand":{"dynamicRegistration":true}},"textDocument":{"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true}},"hover":{"dynamicRegistration":true},"signatureHelp":{"dynamicRegistration":true},"definition":{"dynamicRegistration":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true},"codeAction":{"dynamicRegistration":true},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true},"documentLink":{"dynamicRegistration":true}}},"trace":"off"}}

Content-Length: 444
{"jsonrpc":"2.0","id":"0","result":{"capabilities":{"textDocumentSync":2,"hoverProvider":true,"completionProvider":{"resolveProvider":false,"triggerCharacters":["."]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true}}}

Content-Length: 52
{"jsonrpc":"2.0","method":"initialized","params":{}}

Content-Length: 101
{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"openhabLSP":{}}}}

Content-Length: 330
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///d%3A/openHAB/openhab-2.2.0-rpi2/conf/rules/new.rules","languageId":"openhab","version":1,"text":"rule \"rule name\"\r\nwhen\r\n    Item BL_AZ changed\r\nthen\r\n    logDebug(\"openhab\", \"message\")\r\nend\r\n"}}}

When clicking on code lines in VS Code:

(there is no log output in openhab.log)

VS Code shows:

[Error - 23:25:47] Request textDocument/documentHighlight failed.
  Message: Internal error, please look at the server's logs.
  Code: -32603 
[Error - 23:25:48] Request textDocument/hover failed.
  Message: Internal error, please look at the server's logs.
  Code: -32603 

network payload:

Content-Length: 216
{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///d%3A/openHAB/openhab-2.2.0-rpi2/conf/rules/test.rules"},"position":{"line":157,"character":3}}}

Content-Length: 117
{"jsonrpc":"2.0","id":"1","error":{"code":-32603,"message":"Internal error, please look at the server\u0027s logs."}}

Content-Length: 228
{"jsonrpc":"2.0","id":2,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///d%3A/openHAB/openhab-2.2.0-rpi2/conf/rules/test.rules"},"position":{"line":157,"character":3}}}

Content-Length: 117
{"jsonrpc":"2.0","id":"2","error":{"code":-32603,"message":"Internal error, please look at the server\u0027s logs."}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.