SCRIPT JS-transformation shows errors in Visual Studio Code

I am currently using the Javascript transformation and would like to switch to the SCRIPT transformation.
So far the transformation works fine with SCRIPT transformation as .script files.

But, I have problems in that the .script files in Visual Studio Code are marked as having various errors. When I save the same file as .js, I don’t see any errors.

Is there some configuration in Visual Studio Code or the OpenHAB extension for Visual Studio Code that I need to change so that the .script doesn’t display incorrectly.

Thanks for the support.
Regards Ulf

I haven’t use VSCode for OH stuff but it looks like it’s treating this as if it were some other type of file that’s not JS. It’s probably guessing that it’s a shell script based on the file extension.

Unfortunately there is no universal way to solve this. You can either tell VS Code that .script files are in fact JS (in the settings somewhere) but then all your .script transformations must be written in JS, or live with the errors.

Thanks for your answer.
As an alternative to your suggestion, I will also see if I can find an option for VS Code to exclude the conf/transform folder.

Please don’t. First, there is no option for that, second, there are other files in the directory which are handled by the plugin as well.

In question of the .script: this is to be expected, as there is already a a file extension .script (used in the directory scripts)
In good old days :slight_smile: these files were used for the DSL action callScript(scriptname), which then started the DSL script stored in scripts/scriptname.script. This is also true for the current version of openHAB.

As there is no option to differentiate between the used language in the files (Go to the corner of shame :wink: ), I guess it will be hard to integrate this in the plugin.
Maybe some developer may introduce some comment at start of the file (like !# /bin/bash in shell scripts), this would also help to get rid of the explicit call for the specific language.

At the moment all solutions seem to be rather bad. I would hate to do without the Javascript transformation. I will therefore turn back the wheel and not use the SCRIPT transformation until OH4.0.
Maybe there will be a solution by then that will make bending the .script extension unnecessary. I suspect there will be a lot of users unhappy with the SCRIPT solution as it stands.
May be a new point for the wishlist :smiling_face:

The script extension was chosen for technical reasons. It wasn’t feasible to use a different extension for the different languages, partially because the SCRIPT needs to be able to identify the files that belong to it regardless of what automation languages are installed.

I doubt this is something that can be surmounted.

You don’t have to do without it. You can turn off the error highlighting for those files, or turn off the syntax checks.

It’s not the case that JS doesn’t work. It’s just that VS Code can’t properly identify syntax errors.