# VS Code openHAB Extension!

**URL:** <https://community.openhab.org/t/vs-code-openhab-extension/30205>\
**Category:** Misc\
**Tags:** syntax, ide, vscode\
**Created:** [June 19, 2017, 8:27am UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205 "2017-06-19T08:27:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![kubawolanin](https://community.openhab.org/user_avatar/community.openhab.org/kubawolanin/32/71363_2.png) [@kubawolanin](https://community.openhab.org/u/kubawolanin)\
**Post date:** [June 19, 2017, 8:27am UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/1 "2017-06-19T08:27:24Z")

</div>

I’m pleased to announce that openHAB has now an official [Visual Studio Code](https://code.visualstudio.com/) extension. 🎺 🎺 🎺

**[GitHub - openhab/openhab-vscode: VS Code extension for openHAB configuration files](https://github.com/openhab/openhab-vscode)**

## Features

- Code snippets for openHAB including [Design Patterns](https://community.openhab.org/tags/designpattern) by @rlkoshak
- Syntax highlighting for openHAB DSL (rules, items, scripts and sitemaps).
- Integrated quick search of openHAB docs page (`Alt + Shift + O`)
- Integrated Basic UI preview window (`Ctrl + Alt + O` or editor title icon)

## Screenshots

### openHAB2 code snippets:

![openHAB2 code snippets](https://github.com/openhab/openhab-vscode/raw/master/images/openhab-demo.gif)

### Integrated search engine:

![openHAB2 code snippets](https://github.com/openhab/openhab-vscode/raw/master/images/openhab-demo2.gif)

### Intelligent sitemap preview:

![openHAB2 code snippets](https://github.com/openhab/openhab-vscode/raw/master/images/openhab-sitemap.gif)

## Installation

#### This extension is available on the Visual Studio Marketplace → [openHAB - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=openhab.openhab)

You can also install it manually:

1. Download [`openhab-0.1.0.vsix` from this release page](https://github.com/openhab/openhab-vscode/releases/tag/0.1.0) on your hard drive
2. Open command line in the same folder you downloaded the extension
3. Type the following command:

```auto
code --install-extension openhab-0.1.0.vsix

```

1. Open Visual Studio Code
2. Open openhab configuration (`openHAB-conf`) folder
3. Enjoy! 😉

## Further development

There are a number of ideas that we’d like to implement in the extension (like [incorporating LSP](https://github.com/openhab/openhab-vscode/issues/3) for better Xtend syntax validation).  
I truly believe this will become a solid alternative for Eclipse SmartHome Designer.  
In the meantime we’ll be working with @Kai to publish the extension in the VS Marketplace, so you won’t need to install it manually.

---

<div class="post-metadata">

**Author:** ![MHerbst](https://community.openhab.org/user_avatar/community.openhab.org/mherbst/32/90834_2.png) [@MHerbst](https://community.openhab.org/u/MHerbst)\
**Post date:** [June 19, 2017, 9:19am UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/2 "2017-06-19T09:19:08Z")

</div>

This is really great. I like especially the idea of using the LSP. Would be great to have a language server implementation of the sitemap and rule syntax. This could then be uses for VS.Code, brower-based editors and Java-based tooling.

---

<div class="post-metadata">

**Author:** ![lomdar67](https://community.openhab.org/letter_avatar_proxy/v4/letter/l/ee7513/32.png) [@lomdar67](https://community.openhab.org/u/lomdar67)\
**Post date:** [June 19, 2017, 11:18am UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/3 "2017-06-19T11:18:04Z")

</div>

Wow, so much better then ESHD! I love it!!!

---

<div class="post-metadata">

**Author:** ![sheppard](https://community.openhab.org/letter_avatar_proxy/v4/letter/s/5fc32e/32.png) [@sheppard](https://community.openhab.org/u/sheppard)\
**Post date:** [June 19, 2017, 11:49am UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/4 "2017-06-19T11:49:21Z")

</div>

Cool, I will try that one out as soon as possible. Looks really promising.

---

<div class="post-metadata">

**Author:** ![dennisausbremen](https://community.openhab.org/user_avatar/community.openhab.org/dennisausbremen/32/5734_2.png) [@dennisausbremen](https://community.openhab.org/u/dennisausbremen)\
**Post date:** [June 19, 2017, 12:03pm UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/5 "2017-06-19T12:03:16Z")

</div>

Thanks, Kuba! Totally awesomesauce! \<3

---

<div class="post-metadata">

**Author:** ![sheppard](https://community.openhab.org/letter_avatar_proxy/v4/letter/s/5fc32e/32.png) [@sheppard](https://community.openhab.org/u/sheppard)\
**Post date:** [June 19, 2017, 12:06pm UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/6 "2017-06-19T12:06:16Z")

</div>

the first questions arise. 🙂  
How does the preview work? Do I need to have some services running or is it just parsing the sitemap and has the default styles applied internally? Currently it shows nothing for my sitemaps (or a newly created one).

---

<div class="post-metadata">

**Author:** ![kubawolanin](https://community.openhab.org/user_avatar/community.openhab.org/kubawolanin/32/71363_2.png) [@kubawolanin](https://community.openhab.org/u/kubawolanin)\
**Post date:** [June 19, 2017, 1:24pm UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/7 "2017-06-19T13:24:08Z")

</div>

See [this section in README](https://github.com/openhab/openhab-vscode#configuration) although I admit it’s not written in most clear way possible 🙂

You need to have openHAB running in order to preview changes. The sitemap is the actual [http://YOUROPENHABHOST:8080/basic/](http://YOUROPENHABHOST:8080/basic/)… running from your server.

Generally, it assumes that you access your openHAB config files from either:

- Samba share (e.g. `\\OPENHABIANPI\openHAB-conf\`)
- Local folder (e.g. `c:\openhab\configuration`) - didn’t test it on Unix based machines, though. Windows only 😮

There [might be a bug](https://github.com/openhab/openhab-vscode/blob/master/src/extension.ts#L47) in a place that checks the hostname based on file path. I’ll take a look at it later today. **EDIT: Already resolved**

Cheers!  
Glad you guys like it 🙂 More stuff is about to come.

---

<div class="post-metadata">

**Author:** ![sheppard](https://community.openhab.org/letter_avatar_proxy/v4/letter/s/5fc32e/32.png) [@sheppard](https://community.openhab.org/u/sheppard)\
**Post date:** [June 19, 2017, 1:40pm UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/8 "2017-06-19T13:40:54Z")

</div>

I thought so, but was hoping that maybe the sitemap is just parsed with the help of static/internal openHAB stylesheets or scripts (just UI and non-functional). So basically it is just a browser window within vsCode. 🙂

---

<div class="post-metadata">

**Author:** ![UglyKidJoe](https://community.openhab.org/user_avatar/community.openhab.org/uglykidjoe/32/26432_2.png) [@UglyKidJoe](https://community.openhab.org/u/UglyKidJoe)\
**Post date:** [June 19, 2017, 3:56pm UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/9 "2017-06-19T15:56:32Z")

</div>

Respect

---

<div class="post-metadata">

**Author:** ![Dim](https://community.openhab.org/user_avatar/community.openhab.org/dim/32/4568_2.png) [@Dim](https://community.openhab.org/u/Dim)\
**Post date:** [June 19, 2017, 4:01pm UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/10 "2017-06-19T16:01:43Z")

</div>

> [@UglyKidJoe](#):
>
> Respect

ditto !

---

<div class="post-metadata">

**Author:** ![greg](https://community.openhab.org/user_avatar/community.openhab.org/greg/32/1754_2.png) [@greg](https://community.openhab.org/u/greg)\
**Post date:** [June 19, 2017, 9:47pm UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/11 "2017-06-19T21:47:43Z")

</div>

Fantastic work!!!

---

<div class="post-metadata">

**Author:** ![dennisausbremen](https://community.openhab.org/user_avatar/community.openhab.org/dennisausbremen/32/5734_2.png) [@dennisausbremen](https://community.openhab.org/u/dennisausbremen)\
**Post date:** [June 20, 2017, 10:06pm UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/12 "2017-06-20T22:06:15Z")

</div>

I’ve already made a PR to make it work under macOS.  
Should be no problem to make it work under \*NIX, albeit the mounting scheme is not the same on every distro.

---

<div class="post-metadata">

**Author:** ![KidSquid](https://community.openhab.org/user_avatar/community.openhab.org/kidsquid/32/3985_2.png) [@KidSquid](https://community.openhab.org/u/KidSquid)\
**Post date:** [June 20, 2017, 10:22pm UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/13 "2017-06-20T22:22:05Z")

</div>

Friggin Awesome!!! 👏

---

<div class="post-metadata">

**Author:** ![Confectrician](https://community.openhab.org/user_avatar/community.openhab.org/confectrician/32/105046_2.png) [@Confectrician](https://community.openhab.org/u/Confectrician)\
**Post date:** [June 20, 2017, 10:25pm UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/14 "2017-06-20T22:25:50Z")

</div>

Beste News today. 😃  
This looks awesome.

Great Work.

---

<div class="post-metadata">

**Author:** ![KidSquid](https://community.openhab.org/user_avatar/community.openhab.org/kidsquid/32/3985_2.png) [@KidSquid](https://community.openhab.org/u/KidSquid)\
**Post date:** [June 20, 2017, 10:50pm UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/15 "2017-06-20T22:50:13Z")

</div>

Will this eventually support quick suggestions in code?

---

<div class="post-metadata">

**Author:** ![trodfoot](https://community.openhab.org/user_avatar/community.openhab.org/trodfoot/32/2719_2.png) [@trodfoot](https://community.openhab.org/u/trodfoot)\
**Post date:** [June 21, 2017, 3:09am UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/16 "2017-06-21T03:09:33Z")

</div>

Have to say I like it more than Eclipse already. Great work.

---

<div class="post-metadata">

**Author:** ![Confectrician](https://community.openhab.org/user_avatar/community.openhab.org/confectrician/32/105046_2.png) [@Confectrician](https://community.openhab.org/u/Confectrician)\
**Post date:** [June 21, 2017, 5:27am UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/17 "2017-06-21T05:27:35Z")

</div>

Technically this should be possible.

> **[IntelliSense](https://code.visualstudio.com/docs/editing/intellisense)**
>
> Learn about Visual Studio Code IntelliSense (intelligent code completion).

---

<div class="post-metadata">

**Author:** ![KidSquid](https://community.openhab.org/user_avatar/community.openhab.org/kidsquid/32/3985_2.png) [@KidSquid](https://community.openhab.org/u/KidSquid)\
**Post date:** [June 21, 2017, 5:32am UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/18 "2017-06-21T05:32:07Z")

</div>

Thank you - the branding “IntelliSense” was escaping me. Having code completion would be great.

---

<div class="post-metadata">

**Author:** ![kubawolanin](https://community.openhab.org/user_avatar/community.openhab.org/kubawolanin/32/71363_2.png) [@kubawolanin](https://community.openhab.org/u/kubawolanin)\
**Post date:** [June 21, 2017, 5:46am UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/19 "2017-06-21T05:46:55Z")

</div>

@KidSquid @Confectrician It’s certainly possible! There’s [an issue in the pipeline](https://github.com/openhab/openhab-vscode/issues/3) to utilize LSP for Xtend language. This way we would get all the goodness that’s seen in ESHD - code formatting, quick suggesting, validation and so on.  
Prerequisite of that feature is to upgrade Xtend to a newer version.

@dennisausbremen Thank you for the PR! I’ll take a look at it today. 🙂

---

<div class="post-metadata">

**Author:** ![Confectrician](https://community.openhab.org/user_avatar/community.openhab.org/confectrician/32/105046_2.png) [@Confectrician](https://community.openhab.org/u/Confectrician)\
**Post date:** [June 21, 2017, 6:37am UTC](https://community.openhab.org/t/vs-code-openhab-extension/30205/20 "2017-06-21T06:37:57Z")

</div>

> [@kubawolanin](#):
>
> Prerequisite of that feature is to upgrade Xtend to a newer version.

So its more a question of “when” it is possible and not “if” it is possible. .)

[Next page](https://community.openhab.org/t/vs-code-openhab-extension/30205.md?page=2)
