# Code completion for rules not working (or is it?)

That looks a whole lot better on your side. I now just get the same list of item or thing names in both places. Perhaps it is some subtle difference between Windows and Synology.

Other people mentioned they had mapped a drive letter to the OpenHAB files and I was like “so what, how would that be relevant”. But I did open the folder in VS Code directly using a UNC name. The plugin may have an issue with UNC names so I will try and map a drive letter too and work with that, see how that works.

There is definitely a big difference between using UNC and Drive letter, UNC is //path/to/file and Drive letter is X:\path\to\file so it’s / vs. \

I know how it is different, the question is whether the OpenHAB plugin can handle perfectly valid network paths or not.

Does the LSP only work for RulesDSL and not Jython?

Well… Yo (Yes and No) There are some (known) Issues with unc.

In fact, if looking into the settings, there is a warning about unc paths:

Oh, well, that is promising. And a little embarrassing since apparently it is documented (somewhere). I am not at a PC now, will try soon and report back.

I mapped a drive letter. The first thing I noticed was I now had code validation (squigglies under code fragments that had some issue). Still no code completion though. But, after a couple of minutes, look-y-look:

right after typing the dot. And, after waiting a couple of minutes more:

it is also working for items! But then again, it drops out just as sudden as it appeared to work. It is also a bit bare compared to what a grown-ups IDE offers (I do not see member types) but if it works, the options are helpful.

It looks like the parser is just stupid. If I type an item name as the first word on a line followed by a dot, I do get members. If the item is however in a condition of an if statement… that’s waaaay too complicated for our poor little plug-in. Strangely enough, it did work once in an if statement as the screenshot shows before it just stopped working, in the same edit session.

Anyway, though poor, once you know this it is perfectly workable and beats a search for documentation. I can just paste the object I want to see members for on an empty line and see what my options are. So, success after all.

Thank you all very much.

[Edit 2, one day later]

Aaaand it broke down again. Didn’t change anything, it just stopped working altogether. Must be something with the moon phase or the stars that need to be lined op right. I think we wasted enough time on this piece of #\$%^&*!.

As already stated you (and everyone else interested) are welcome to improve the situation and dig into LSP development to provide a useful code completion.

I can provide some introduction and information on the trypescript extension development side.
Maybe you can connect up to @wborn who has fixed some issues on the java side of this implementation in the openhab-core.

The extension just provides a remote connection to the lsp server implemented in openhab-core.
When we improve the handling over there, better answers will come back from it maybe.

Thanks for taking my latest less then positive response so positively. I could be interested in contributing although the platform is totally out of my comfort zone (I am a seasoned Windows developer). Let me get my head around the OpenHAB basics first, once I have everything I can think of automated in my home I may be ready for a new challenge.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.