Ah that’s tricky! In JavaScript rules, the state of an item is a string; if you need the value as number type, you have to use numericState. This is the same for real number items and for number group items.
You’d need the openhab npm package with some kind of “Intellisense” like in VS Code/Codium to easily see this. Unfortunately I don’t know how to do this in Eclipse IDE.
For me it was enough to npm init and npm install the openhab npm package in my “working folder”. I have the js files in a separate folder and copy them to automation/js when they are finished.
You can see this in the docs and in the UI code editor as well, though I find it doesn’t always work in the UI code editor. It depends on how you retrieve the Item Oject I think (e.g. items.vWeather_Temp doesn’t work but items.getItem('vWeather_Temp') does. ctrl-space will show the list of potential completions same as in most IDEs.
Not quite sure what you’re asking here, but editing JavaScript in Eclipse is no good, so that shouldn’t be attempted. If what you wanted to do is to get OH core in Eclipse, that’s “easy”, that already works with the existing Eclipse setup you have for add-ons. All you need to do is to clone openhab-core somewhere, and then from Eclipse go to File → Import → Existing Maven Project → select the root folder of the repo you cloned. It will chew a bit, and then list all the core bundles already checked for import. You can unselect some if you want to, but I prefer to import them all.
However, this will take a long time, because it will immediately start to try to install dependencies and build all the bundles. We’re probably talking hours and hours, and it might not ever finish, because some of the org.openhab.core.model bundles have a tendency to enter an endless build loop. So, what you want to do is to go to Project → Build Automatically and uncheck that before starting the import. The import will still take time, but won’t go on for eternity. Once all the bundles have been imported, mass select and close all/most of them, only open the bundles you’re interested in debugging. Make sure that none of the org.openhab.core.model bundles are open at the very least, and then reenable Build Automatically. It will chew for a while, but should eventually get there.
Once that’s in place, you can resolve the “demo app” and run it as usual, using the debugger where you want to.
I can explain why this doesn’t always work, it’s because it’s something of a nightmare to make. “Intellisense” is an MS trademark, so it’s not called that outside VS. But, the functionality is the same, in code mirror (that is used in MainUI) it’s simply called “hinting”. I’ve written some “hinting” for YAML rules when doing the work on YAML rules, and to be frank, you pretty much have to code every situation where you want a lookup to work. I was shocked at how primitive this system is, you have to handle indentation level, looking up parent elements, cursor position, what and where to fill in etc. yourself from JavaScript. I think making the hinting do all you’d want it to is pretty much a “forever project”.