Error checking etc


(TechnoVol) #1

Just started using VS Code with the OH2 plugin and I was working on my first sitemap file. OH2 kept ignoring it due to errors every time I saved it. How do I ensure that VS Code is set up properly to help me check for errors in syntax etc?

I’m a beginner so I’m trying to learn. Thanks!


(Moxified) #2

I don’t mean to be rude but you are asking a lot of questions that can easily be answered with searching. Please try doing a little footwork. It’s not fair for us to have to feed this info to you.

This is clearly answered in the docs:

https://docs.openhab.org/configuration/editors.html


(TechnoVol) #3

Thanks @Moxified… I did read that documentation and the section regarding Rule Validation said the Language Server is active by default. I wasn’t seeing it flag anything. Perhaps I’m missing something but I did read first. Apologies as I’m not trying to be spoon fed without spending the effort.

This is what I read…
This extension comes with Language Server Protocol support. Language servers allow you to add your own validation logic to files open in VS Code. openHAB from version openHAB 2.2.0 Build #1065 (SNAPSHOT) has the Language Server exposed on 5007 port. openHAB 2.2 since build #1084 has LSP feature enabled in the runtime, so there are no additional steps for you to make it work.


(Moxified) #4

Ok. NP. Well, I think in this case you might be right that the doc is a little incomplete on this… idk. It does say that openhab.host is mandatory but it is under the sitemap preview section.

Anyways. Add a setting for openhab.host to the ip of your OH server. That’s probably what you are missing.


(TechnoVol) #5

Thanks… here’s what my settings are currently. Is this all I need assuming the IP and password are correct?

{
“openhab.host”: “10.0.X.XXX”,
“openhab.port”: 8080,
“openhab.password”: “XXXXXXXXX”
}


(Moxified) #6

I believe for the LSP, you just need the { “openhab.host”:“10.0.x.xyz” }

The other bits would be needed for other functions if you care.