WarWithinMe / better-align

A vscode extension to provide better vertical alignment
Other
75 stars 39 forks source link

Comments not aligning in Python #36

Open eykamp opened 5 years ago

eykamp commented 5 years ago

When writing Python code (indentation set at 4 spaces)...

Aligning this:

var1 = 123  # first var
var999 = 99981    # bigger var

Produces this:

var1   = 123  # first var
var999 = 99981    # bigger var

But I'd like this:

var1   = 123      # first var
var999 = 99981    # bigger var
eykamp commented 5 years ago

Maybe instead of hardcoding comment characters, you can grab them from here?

https://code.visualstudio.com/docs/extensionAPI/vscode-api#CommentRule

nhardy01 commented 4 years ago

Aligning comments seems to work when there are trailing commas:

# unaligned, no training comma
v1 = 1 # short
v22222222 = 'abcdd'        # longer

# aligned, no training comma
v1        = 1 # short
v22222222 = 'abcdd'        # longer

# unaligned, with comma
v1 = 1, # short
v22222222 = 'abcdd',        # longer

# aligned, with comma
v1        = 1,       # short
v22222222 = 'abcdd', # longer

unfortunately it doesn't respect the space settings

"alignment.surroundSpace": {
        "comment": 4,
    },
GuokaiLiu commented 3 years ago

same issue!