VS Code openHAB Extension!

syntax
ide
vscode
Tags: #<Tag:0x00007f6ce99bc398> #<Tag:0x00007f6ce99bc078> #<Tag:0x00007f6ce99b3e00>

(Kuba Wolanin) #41

Thank you Gentlemen! :blush:

I'll be honored! :slight_smile:

Great idea!
There's more things to come with this extension, so I'm sure there will be something to discuss.

I spent my weekend polishing separate Items view in the sidebar. You'll be able to see a tree view of your grouped items, find references to them in the code, copy name and more :smiley:
Oh, and it utilizes REST API!

I hope I'll be able to deliver working 0.1.0 next week.


(Kai Kreuzer) #42

Oh, and it utilizes REST API!

Sounds excellent :slight_smile:

Here we go: https://community.openhab.org/c/apps-services/vs-code
Keep up the good work!


(Paul Hansen) #43

I've noticed a small bug.

I have a few items which use an icon called switch. This highlights pink, even though its within < >. All other icons are highlighted white.

Eg

Otherwise the whole experience of using VS has been extremely good. Very nice work!


(Kuba Wolanin) #44

Hey Paul, thanks for reporting!
Could you raise an issue on projects GitHub?
Cheers


(Jerome) #45

Done.

I added it there to keep the repo issues up to date. :slight_smile:


(Paul Hansen) #46

Thanks very much.


(Kuba Wolanin) #47

Head's up! There's a new version of the extension - 0.1.0:

Feel free to continue discussion on the new thread :slight_smile:


(Patrick Fink) #48

This is just great. Even though it's a pre-release, it's way more suitable to be the official editor than openHAB Designer. It just has the ultimate feature that designer doesn't have: Creating new files :joy:


(SiHui) #49

CTRL-N would have solved that problem :grin:


(Patrick Fink) #50

OK, in this case I go for customizability, Git support and an acceptable startup time :grinning: The only thing I miss is autocompletion for the rules API.


(George Erhan) #51

Hi @kubawolanin,

When trying to access suggestions via 'Ctrl+Space', I get the following error:
Error while connecting: Error: getaddrinfo ENOTFOUND openhabianpi openhabianpi:8080
Is this a bug?

Thanks,

George


(Kuba Wolanin) #52

The completions service is tightly coupled with the REST API of the openHAB, so in order to get them, you need to edit your user settings in VS Code ( Ctrl + ,) and add the following parameters - openhab.host and openhab.port (optionally).

Your settings.json might look like this:

{
    "files.associations": {
        "*.log": "properties"
    },
    "window.zoomLevel": 0,
    "powermode.enabled": false,
    "workbench.iconTheme": "openhab",
    "openhab.host": "home",
    "openhab.port": "8080"
}

(Ben Clark) #53

Do you think that error checking for sitemaps and things/items files would be a possibility in the future? I think this is the only feature that the smarthome designer has over the VS code extension.


(Kuba Wolanin) #54

Absolutely! This is something that Language Server Protocol would take care of. I'm looking forward to work with volunteers willing to implement that! :wink:


(Ben Clark) #55

Awesome, I did see that issue but it's marked for Xtend. I'd guess that it's a little more difficult to do it with the unique formatting of Items etc which would probably need it's own LSP right?

Either way, exciting times!


(George Erhan) #56

Thanks,

I missed that!

It works now!
If it's not a big effort for yourself, could you add in the readme that the url for the hostname can also be an ip address (i just tried it and it works!)?

George


(Jerome) #57

I have requested the readme change, since this is a useful information :slight_smile:


(Dominic Bonneau) #58

I'm sorry I did not get how did you install the extension on MacOs

Thanks


(Paul Hansen) #59

@Dominic_Bonneau I believe it is the same for osx as it is for windows.

Open the extensions pane on the left, then open the options menu (three dot) link at the top. Choose to install from VSIX and then navigate to where you saved the vsix file.


(Mike Bagdanoff) #60

Thanks for this, I use a text editor for writing my rules because the SmartHome designer is not good. This is a welcome change and I am willing to download VSCode, but I was wondering what would be required to make this compatible with other Visual Studio editions, I'm currently using VS2015 Pro.