The rules are working, but I have a usability issue:
When I write a rule with rules.JSRule({..., then I get nice code completion features from VSCode:
But when I try to use the rule builder, not even the when() method is known and there is no guidance from the IDE:
(second screenshot omitted because as a new user I can only provide one.)
Is this a missing feature of openhab-js or can I improve my configuration?
RuleBuilder is definitely available in openhab-js. You can find the code under rules/rule_builder.js.
The code completion built into VSCode here has nothing to do with openHAB. It’s standard JavaScript support.
Given that JavaScript is not strongly typed, I suspect that VSCode just can’t figure out the type of rules or because of the way when is defined and exposed as a part of rules. I’m not sure what can be done about that. In general I’ve found VSCode’s ability to do code completion with JavaScript to be limited in general.
Hello, I am one of the openHAB JavaScript library maintainers.
Your autocompletion works as supposed, we are missing type definitions for RuleBuilder because they currently don’t work properly and due to the complexity of RuleBuilder we weren’t able (yet) to provide type definitions for it.