maxbec / openHAB-Alignment-Tool

This extension adds support for formatting and indenting openHAB files. At the moment only the item-files are supported.
https://marketplace.visualstudio.com/items?itemName=max-beckenbauer.oh-alignment-tool
Eclipse Public License 2.0
21 stars 4 forks source link

custom define using tabs or spaces #48

Closed CWempe closed 4 years ago

CWempe commented 4 years ago

Maybe this is already possible.

But I think I would like to have the option to use spaces between the items parts instead of tabs.

This is how it looks at the moment.

image

Right now there is at least one tab after each part wich can be as big as 1 (between "B" and <cc>) or up to 4 spaces (between <cc> and (D)).

I think it would look better and more organized if the minimum distance between two parts could be defined by the user, if he wants to use spaces instead of tabs.

Like "minimum 2 spaces": image

Or "minimum 1 space):

image

"minimum 3 spaces:

image

My vscod settings are set to use spaces.

image

But I understand if this would be difficult to implement. And I do not NEED this. It would be nice to have, though. 😉

btw: The openHAB documentation uses a single space between the elements in the examples. But I would prefer two spaces.

maxbec commented 4 years ago

Just set "Leerzeichen: 2". Than i get this result:

Switch  A   "B" <c> (D) {channel="e", alexa="Speaker.muted"}
Switch  A   "B" <c> (D) {channel="e", alexa="Speaker.muted"}
Switch  A   "B" <c> (D) {channel="e", alexa="Speaker.muted"}

_Extension_Development_Host__-_test_2_items_—_tests

Is that what you meant with your question?

CWempe commented 4 years ago

Not exactly.

  1. In your result there is only one character between the parts. I would prefer a minimum of two characters.
  2. The plugin still generates tabs. They are just interpreted as "2 spaces" instead of "4 spaces" with this setting. Another editor could interpret the tabsize differently. I would like to have real space characters.

image (first line uses tabs, second line uses spaces)

But like I said. This feature has low priority.

maxbec commented 4 years ago

Hey @CWempe,

i just pushed a new commit facing the spaces issue. Would be great if you could test it.

CWempe commented 4 years ago

Hey @CWempe,

i just pushed a new commit facing the spaces issue. Would be great if you could test it.

I see the commit 93cbfae007e726b68dcd2399e3eb17d44ed5f625, but is there a compiled download I can test?

maxbec commented 4 years ago

Hey @CWempe Sorry I was interrupted yesterday. Will upload a new Beta release today!

maxbec commented 4 years ago

So. I just released a new beta version. You can find it here: https://github.com/MaxBec/openHAB-Alignment-Tool/releases/tag/v2.0.8-beta.1

CWempe commented 4 years ago

Looks good. 👍

When I set Spaces: 2, I get what I want.

image

image

But I don't know what oh-alignment-tool.minimumIndentAmount is for. Changing the value does not effect the result at all.

maxbec commented 4 years ago

You're right. In the beginning i wanted to use this settings to define the minimum distance. But i think it is ok to use the vscode indenting setting.