Wrong duplicate type error in VS Code extension

I have a rule file that starts with some comment lines and than a timer variable declaration. This declaration is flagged with an error The type DsmrRules is already defined in dsmr.rules.(org.eclipse.xtext.xbase.validation.IssueCodes.duplicate_type). For the record, there is no definition of “DsmrRules” anywhere in that file.
The first lines of the dsmr.rules file:

////////////////////////////////////////////////////////////////////////////////
// Rules handling the data read from the Smart Meter (DSMR) for Gas and Power usage.
// The data is published to an MQTT topic and received and stored in Items via the MQTT
// binding.
//
// Some more comment lines...
////////////////////////////////////////////////////////////////////////////////

// Define global variables.
var Timer tmMidnight = null

I have not noticed this before installing the new 0.5.1 version.

It makes that up from the filename dsmr.rules

I had this problem and resolved it, the cause was that when I selected ‘Add Folder to Workspace’ I selected the root OH folder. When I removed this folder from the Workspace and then added the ‘conf’ sub-folder only the problem went away

from

Ah, that will do it. Still, I like to access the log files along with the configuration files when editing something. :grin:

Old thread. Identical problem, work around: renamed the rules-files, introducing an initial underscore:

“rules_file_name.rules” → syntax remark (everything red-marked)…
“_rules_file_name.rules” → OK.

For me this works only until restart of openHAB, then everything is red again…