Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixin indentation issue #108

Closed
richmilns opened this issue May 4, 2018 · 3 comments
Closed

Mixin indentation issue #108

richmilns opened this issue May 4, 2018 · 3 comments
Assignees

Comments

@richmilns
Copy link

richmilns commented May 4, 2018

I am using release 2.1.0 of this package.

I'm not too sure whether this is down to the syntax highlighting provided by this package or something else but I figured it was a good place to start!

What I've noticed is that the indentation of closing braces and brackets for certain less mixins seems to be incorrect.

Here's an example of an affected mixin:

.lg-up(@rules) {
    @media screen and (min-width: 990px) {
        @rules();
    }
}

What I have noticed when using the mixin is that if I run the command Indentation: Reindent Lines, I get this:

.lg-up({
    height:25vh;
    });

See the final brace and bracket? I would expect it to do this:

.lg-up({
    height:25vh;
});

Another example mixin:

.width-min-mq(@from, @rules) when (@support-media-queries = true) {
    @media screen and (min-width: @from) {
        @rules();
    }
}

Turns into this when the command Indentation: Reindent Lines is run:

.width-min-mq(800px, {
    color:red;
    });

Apologies is this nothing to do with the syntax highlighting this package provides but it only seems to happen in LESS so I thought I'd try to report it here first.

@richmilns
Copy link
Author

I've spotted an issue that's closed similar to mine: #91

@braver
Copy link
Collaborator

braver commented May 4, 2018

#91 solves the highlighting issue, for this I may need to tweak the indentation rules. I'll look into it!

@braver braver self-assigned this May 5, 2018
@braver braver closed this as completed in 5d35d72 Jun 15, 2018
@braver
Copy link
Collaborator

braver commented Jun 15, 2018

@richmilns the regexes that handle this are a bit complicated, but it seems that JavaScript has a ruleset that also works for LESS so I borrowed those. Seem to work better that the default. I will be testing it next week, and will release if it works well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants