Visual Studio Updated now, I'm getting a Rules Error

This might be a consequence, but my Visual Studio just updated and now the first line in my rules file always shows as an Error.

Just as experimentation, I commented out
/* import java.util.Random */
then the error moves to the second line.

If I comment out the 1st and 2nd lines then the Error moves to the 3rd line.

Is there a new opening Syntax line I am not aware of?

Thx
Bill

bump for importance
please post entire rules file

import java.util.Random

var Timer timer = null
val resList = newArrayList("640/480", "320/240", "480/360")
val urlList = newArrayList("https://www.fillmurray.com", "https://www.fillmurray.com/g",
                 "https://www.placecage.com", "https://www.placecage.com/c", "https://www.placecage.com/g")
val Random random = new Random()


rule "Trigger Garage Door"
when
   Item VIR_IN_GarageDoorSwitch changed to ON
then
   if(VIR_IN_GarageDoorSwitch.state == ON) 
     { 
        sendCommand(Switch_GarageS2, ON)
        createTimer(now.plusSeconds(5)) [|Switch_GarageS2.sendCommand(OFF)]
        logInfo("Trigger Garage Door.rules", "Garage Door rule has triggered")
     }
   VIR_IN_GarageDoorSwitch.postUpdate(OFF)
end


rule "Garage Door Open"
when
 Item Switch_GarageOC changed from OFF to ON
then 
   sendCommand(Switch_GarageL, ON) 
   sendCommand(Switch_TableL, ON)
   logInfo("Trigger Garage Door.rules", "Garage Door Open rule has triggered") 
end

rule "Garage Door Closed"
when
  Item Switch_GarageOC changed from ON to OFF
then 
   sendCommand(Switch_GarageL, OFF) 
   sendCommand(Switch_TableL, OFF)
   logInfo("Trigger Garage Door.rules", "Garage Door Closed rule has triggered") 
end


rule "Evening Lighthouse On"
when
	Channel 'astro:sun:local:set#event' triggered START
then
	sendCommand(Switch_Lighthouse, ON)
	sendCommand(Switch_China, ON)
	logInfo("Evening ", "Lighthouse & China Cabinet on at Civil Dusk")
end


rule "Evening Lighthouse Off"
when
	Time cron "0 30 22 ? * * *"
then
	sendCommand(Switch_Lighthouse, OFF)
	sendCommand(Switch_China, OFF)
    logInfo("Evening ", "Lighthouse & China Cabinet off at 10:30PM")
end


rule "Monday-Thurday Morning WakeUp"
when 
    Time cron "0 44 4 ? * MON,TUE,WED,THU *"
then
    /*Monday - Thursday Wakeup*/
    sendCommand(Switch_Overhead, ON)
    sendCommand(Switch_TableL, ON)
    logInfo("Morning", "Monday - Thursday Morning Wakeup on at 4:44AM")
end


rule "Friday Morning WakeUp"
when 
    Time cron "0 30 5 ? * FRI *"
then
    /*Friday Wakeup*/
    sendCommand(Switch_Overhead, ON)
    sendCommand(Switch_TableL, ON)
    logInfo("Morning", "Friday Morning Wakeup on at 5:30AM")
end


rule "Morning WakeUp Lights Off"
when 
    Time cron "0 15 6 ? * MON,TUE,WED,THU,FRI *"
then
    /*WakeUp Lights Off*/
    sendCommand(Switch_Overhead, OFF)
    sendCommand(Switch_TableL, OFF)
    logInfo("Morning", "Monday - Friday Morning Wakeup Lights Off at 6:15AM")
end


rule "Everyday Morning Lighthouse On"
when 
    Time cron "0 50 4 ? * * *"
then
    /*Everyday Morning Lighthouse On*/
    sendCommand(Switch_Lighthouse, ON)
    logInfo("Morning", "Everyday 4:50AM Lighthouse On")
end


rule "Everyday Morning Lighthouse Off"
when 
    Time cron "0 30 5 ? * * *"
then
    /*Everyday Morning Lighthouse Off*/
    sendCommand(Switch_Lighthouse, OFF)
    logInfo("Morning", "Everyday 5:30AM Lighthouse Off")
end


// vim: syntax=Xtend

1 Like

What is the error?

You are saying the same thing as I.
All I can say, is since I upgraded to the latest version of Visual studio, the first line of my rules file always has the double underlined, indicating an error on the line. Its only my Rules file and you can see the content of the entire file above.

I honestly cannot see an error. So, I thought I would ask before rebooting the Raspberry PI.

Another strange thing is,
If I comment out the first line, the double underline error indicator drops to the second line.
If I comment out the first and second lines, the double underline error indicator drops to the third line.

Can anyone see something I am missing?
I’d appreciate it.
Bill

You’re missing telling us what the error is.

Meantime, based on behaviour described, see this recent post

Here is the error
Demo.Rules 1 of 1 problem

Top of screen

Rules	demo.rules	(Wrench graphic)DemoRules.astro_sun_local_zodiac_sign

The type DemoRules is already defined in demo.rules.(org.eclipse.xtext.xbase.validation.IssueCodes.duplicate_type)

Quick Fix button responds;
No code action available

Thoughts??
Where is this duplication coming from?

It makes that up from the filename demo.rules

As per the referred to thread,

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

1 Like

THANK YOU, Thank You, thank you Rossko57!

I found the problem. The other day, I created a ‘Backup’ directory in the root of OH. At the time, I did not think making a ‘Backup’ directory here would be a problem. Just by coincidence Visual Studio updated at the same time.

When I moved the Backup directory off the RaspberryPI to another drive on my PC. Low-and-behold my problem disappeared.

Thanks Folks.

Lesson Learned; Do NOT play with the OH root directory.

1 Like

Good job Bill!
please mark the post which helped you solve the problem and the thread as solved by adding [SOLVED] to beginning of thread title to help others who might encounter a similar problem

Ah, that makes a lot of sense as the real root of the problem. Never thought about why, just used the fix. But VSCode tells the truth.