openhab / openhab-vscode

VS Code extension for openHAB configuration files
https://marketplace.visualstudio.com/items?itemName=openhab.openhab
Eclipse Public License 2.0
159 stars 47 forks source link

rules file: inconsistent color markings on double click. #317

Closed s0170071 closed 1 year ago

s0170071 commented 1 year ago

Expected Behavior

When I double click a word/expression, I expect that this word gets selected and all other occurrences are marked with a different background color. Like that when I click on the term tVito_Betriebsmodus :

image

Current Behavior

At the moment it is unpredictable what happens. Depending on the expression the whole line or everything is marked. Example 1: double click on "receivedCommand" marks the rule name image

Example2: Double clicking on "Vito_Betriebsmodus" marks all text image

Example3: Double click on Vito_Betriebsmodus (3rd line) marks the whole line image

Steps to Reproduce (for Bugs)

set up VSC, install plugin (Linux Mint) and edit a rules file. Use this code:

var Timer tVito_Betriebsmodus = null
var strVito_Betriebsmodus = "none"

rule "set heater Vito_Betriebsmodus"
when
    Item Vito_Betriebsmodus received command
then
    tVito_Betriebsmodus?.cancel
    strVito_Betriebsmodus = receivedCommand.toString
    tVito_Betriebsmodus = createTimer(now.plusSeconds(10),[|
        if(Vito_Betriebsmodus.state.toString != strVito_Betriebsmodus)
            Vito_Betriebsmodus.sendCommand(strVito_Betriebsmodus)
    ])
end

Context

The issue is extremely annoying when editing rules. You never know what is the actual selection and what is just a marking.

Your Environment

OH3.4 on RPI4, mounted via sshfs on a Linux mint 21 host System. On that Linux host I run VSC 1.74.2 and openHab v1.0.0 extension and the openHAB Alignment tool 2.1.6

Edit: Just realized that the issue is caused by the Alignment tool. Closing.