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

Curly brace matching broken, often mistakenly includes next block #52

Open
jasonlav opened this issue Oct 8, 2014 · 8 comments
Open
Labels

Comments

@jasonlav
Copy link

jasonlav commented Oct 8, 2014

When adding handlebars indented with HTML below, the close curly braces are not added to the appropriate place.

example

@daaain
Copy link
Owner

daaain commented Oct 8, 2014

Just tried to reproduce but this doesn't happen to me. Might be a combination with some other package? Could you please try temporarily disabling other packages and see if it still happens?

@jasonlav
Copy link
Author

jasonlav commented Oct 8, 2014

Reproduced it with a clean installation of Sublime Text 3. I tried text and tab indentation and both had the same issue.

@jasonlav
Copy link
Author

jasonlav commented Oct 9, 2014

It appears to ONLY be an issue if there is a single tag in the body. For example, if I have a 2nd P tag below the "Example copy" it doesn't do it.

@daaain
Copy link
Owner

daaain commented Oct 21, 2014

I finally managed to reproduce it, although it doesn't always happen.

Still not really sure what's going on, but I do have a clue. When looking at the scope, this is what ST says: Scope: text.html.handlebars source.smarty.embedded.html.

There's not a single mention of Smarty in this Handlebars package, so this seems to be something inherited from the built in HTML definitions. The HTML5 package has it too: https://github.com/mrmartineau/HTML5/blob/master/Syntaxes/HTML%205.YAML-tmLanguage#L224

The only solution I can think of right now is to redefine a big chunk of the HTML package to override this behaviour, but that's a bit of a pain to maintain :(

@jasonlav
Copy link
Author

No worries. Thanks for taking a look. It is a very narrow niche case bug; I doubt many will run into it.

@jas
Copy link

jas commented Oct 25, 2014

I don't think this issue is limited to when body contains only a single tag. I actually run into this quite frequently, even in larger Handlebars files. The problem also sometimes occurs for me when typing above a Handlebars expression. For example:

{{
{{someValue}}
}

@daaain daaain added the bug label Nov 30, 2014
@GeoffreyBooth
Copy link

I run into this issue a lot. For example, if I want to wrap the p tag below inside a new {{#if}} block:

<div>
    <p></p>
</div>

When I start to type the {{#if on a new line inside the div but above the p, I get:

<div>
    {
    <p></p>
    }
</div>

Just like the original poster’s screen recording. I have lots of other HTML on this page, so it’s not confined to a single tag in a body.

@daaain daaain changed the title Indentation confuses handlebars Curly brace matching broken, often mistakenly includes next block Feb 27, 2015
@victorwpbastos
Copy link

👍

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

No branches or pull requests

5 participants