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

Support for JSR223 Scripting #40

Open ThomDietrich opened 6 years ago

ThomDietrich commented 6 years ago

Hey!

At the Smart Home Day the question came up if/when the vscode extension will support JSR223. Just wanted to leave the question here for later discussion. See http://docs.openhab.org/configuration/jsr223.html

For help and/or guidance @steve-bate might be the right guy to trigger 😃

kubawolanin commented 6 years ago

Hey Thomas!

Never used it, will need to take a closer look at it first. However, if anyone's willing to implement it now, hers's some guidance:

Confectrician commented 4 years ago

Hey @openhab-5iver,

Pinging you, because i want to go on with this in the nearer future. I think we need to adapt some things, to get openHAB support into jsr223 files, since they have no special openHAB file endings.

vscode has the concept of so called "embedded languages", which was designed to get js/css support in opened html files. I think that's exactly our usecase for JSR223. We have some kind of file (groovy/js/py) and want to get some openHAB language features inside.

I will take care of the extension part, but it would be nice if you and other helper liebraries contributors join forces with me and the extension and get some progress, especially for the language definition. I have some rough ideas of how that could look, but this is all early state. Maybe you could ping some names in here, who should discuss together with both of us about how it should be done and what should be included for supporting JSR223. :)

5iver commented 4 years ago

@Confectrician, I'm honestly not sure what all would be required for this, but since the helper libraries will eventually be going away with the introduction of a Scripting API, I'm not so sure this effort would be worthwhile. Do you have some links describing what you are looking to do, or just some usecases? Is it something like autocompletion and hover for the HLs and scripted automation?

Confectrician commented 4 years ago

For now we only have the things/items browser available in jsr223 files. I enabled the sidebar on a permanent basis, when one has restApi enabled.

Embedded language: https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide#embedded-languages

will eventually be going away with the introduction of a Scripting API

There is much could be in here. 😄 So i would not care about what may be in some kind of future. We have jsr223 now and there are helper libraries now.

I have no roadmap available now, since i know only my personal needs. But this is not the confectrician extension, so i need input from others. Who should we ping for more input? I would guess @rkoshak could give some input too. Do you know others? What basically would be interesting (from my point of view):

But i would guess there is more that could be done.

rkoshak commented 4 years ago

Having spent some time with Python rules at least, some of the things that would have been nice:

Confectrician commented 4 years ago

I will catch up on your post later, but want to add one thing already regarding snippets:

Snippets are easy to integrate like described shortly here: https://community.openhab.org/t/reusable-sitemap-sections/83955/19?u=confectrician

Basically those are just json objects, so it sould be no big deal to include some of them here very quick.

The only tricky part is, to make them available in jsr file types, but this is one effort to be done. If that's solved once, we can add tons of snippets by just merging some json.