VSC openHAB Alignment Tool

Tags: #<Tag:0x00007f74557264d0> #<Tag:0x00007f74557263e0> #<Tag:0x00007f7455726318>

Hey guys,

i just released the first version of my openHAB Alignment Tool extension for Visual Studio Code.
You can find it in the Visual Studio Code Marketplace or directly in VSC. Here is the link:

Link to openHAB Alignment Tool Extension

The tool can only format *.item-files at the moment. But the other file-types will follow. You can choose between two formatting styles. Column or Multiline formatting. You can call the formatter via the command-palette. Just enter openHAB Alignment Tool there.

I am thrilled to hear some feedback from you. If you find any bugs please report them on github.

Thank you and kind regards,
Max

11 Likes

So we have two formatters for visual Studio Code. One for column lovers an one for row lovers.

Great.

1 Like

Just gave it a test. I actually was looking for a tool last night and came across the other one that formats as multi-line. So quite happy there is this column based one.

Unfortunately, I did run into some issues with your tool.

Firstly, it’s named exactly the same as the one from MarkHilbush. This caused the Command-Palette to not offer your one up for use. After disabling Mark’s one, it appeared in the Command-Palette, but the results weren’t what was expected.

Here is one of my item files before:

String                      JiPhone_BatteryStatus
                            "Battery Status [%s]"
                            <battery>
                            (iCloud_GroupJ)
                            {channel="icloud:device:myaccount:JiPhone7:batteryStatus"}

And here is what it looks like after using your tool:

StringJiPhone_BatteryStatus
                            "Battery Status [%s]"
                            <battery>
                            (iCloud_GroupJ)
                            {channel="icloud:device:myaccount:JiPhone7:batteryStatus"}
1 Like

Hey Juan,

thank you for the feedback. I will have a look for the double-naming issue and the multi-line conversion.
My tool was expecting to have the item already in a line. But of course, there can be multi-line users which want wo convert to columns. I will implement that.

Can you maybe open an issue on github? Thank you!

Before:


After:

What am I doing wrong?

2 Likes

Thank you for the feedback.

Can you please send me the before-img as a text? So i can try it on my machine? Thanks!

Switch FibWPlug1_SW <poweroutlet> (gRestore) { channel="zwave:device:uzb:node41:switch_binary" }

Number FibWPlug1_LED_Color_ON { channel="zwave:device:uzb:node41:config_decimal_param61" } //LED Color if device is ON

Number FibWPlug1_LED_Color_OFF { channel="zwave:device:uzb:node41:config_decimal_param62" } //LED Color if device is OFF

Switch EVER_Smoke_2_Smoke <fire> (gRestore) { channel="zwave:device:uzb:node26:alarm_smoke" }

Switch POPP_Smoke_1_A <fire> { channel="zwave:device:uzb:node10:sensor_binary" }

Switch POPP_Smoke_1_Sw <siren> (gRestore) { channel="zwave:device:uzb:node10:switch_binary" }

Switch POPP_Smoke_1_AG <siren> (gRestore) { channel="zwave:device:uzb:node10:alarm_general" }

Switch Neo_Water_1_Sw <siren> (gRestore) { channel="zwave:device:uzb:node42:alarm_flood" }

Switch Neo_Water_2_Sw <siren> (gRestore) { channel="zwave:device:uzb:node43:alarm_flood" }

Contact Neo_DW_1_C <door> (gRestore,gLastUpdateSwCt) { channel="zwave:device:uzb:node46:sensor_door" }

String Neo_DW_1_C_Update <motion> (gRestore)

Btw, this is the output of notepad++

Found the problem. You are indenting with spaces. I will implement that.
Please open an issue on github. Thank you! :slight_smile:

Done:

Thanks for your work :+1:

1 Like

BTW, it does not work with tabs either:

Added the support for space indentation. New Version 1.0.4 should be online in a couple of seconds.

1 Like

Great job, thanks, works now:

1 Like

hello, unfortunately a few problems …

1 Like

Thank you for the info. Can you pls open an issue on github? Thank you! :slight_smile:

1 Like

The tool is now available under the name “openHAB Alignment Tool”. There was a confusion with the tool of Mark Hilbush. Sorry for that.

Here is the new link:
https://marketplace.visualstudio.com/items?itemName=maximilian-beckenbauer.oh-alignment-tool

The bug with the MAX funciton is fixed in version 1.0.5.

1 Like

Hey @Max_Bec,

This looks really promising. Kudos. :slight_smile:
Any chance that we may join forces and add this to the openHAB VsCode extension in the future?

3 Likes

Hey Jerome,

thank you very much and i am glad to hear that. I am always open to solutions for making things easier for the other users. I’ll just write you an pm.

1 Like

Hey Juan,

the new version (1.0.6) now even supports multiline files. :slight_smile:
Thank you for reporting.