Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

haml files + RuboCop #145

Closed
jufemaiz opened this issue Jul 21, 2016 · 10 comments
Closed

haml files + RuboCop #145

jufemaiz opened this issue Jul 21, 2016 · 10 comments
Labels

Comments

@jufemaiz
Copy link

Currently seeing RuboCop errors when in HAML files.

screen shot 2016-07-21 at 4 28 05 pm

Scopes at cursor:
- text.haml
- meta.tag.haml
- entity.name.tag.haml

RuboCop error:

%ul: unknown type of percent-literal
@Arcanemagus
Copy link
Member

Arcanemagus commented Jul 21, 2016

Well now I'm just confused... none of those scopes are in the list of scopes this package should trigger on...

Can you click around and run that command and see if any of the source.ruby.* scopes become active? Maybe at the very start of the file?

@Arcanemagus
Copy link
Member

For reference, this was originally filed and discussed over in AtomLinter/linter-haml#99.

@jufemaiz
Copy link
Author

@Arcanemagus me too ><

It's only periodic, so I'm really confused to the trigger. That I haven't determined yet. Once it happens, I need to close the project and reopen.

@quolpr
Copy link

quolpr commented Jul 23, 2016

+1, having this problem too. After file closing all become fine. I am not sure, but it appeared after last update.

@Arcanemagus
Copy link
Member

The only way I can think of for this to happen is if part of the file is marked as one of the allowed scopes.

Do you have a file you consistently see this on that you can share? What do you get when you run Editor: Log Cursor Scopes immediately after you start seeing RuboCop messages in your Haml file?

@12eh
Copy link

12eh commented Jul 27, 2016

I can reliably reproduce this by doing string interpolation in an attribute hash. Create a new haml file:

%a{ href: "asdfasdf" }

All good so far. Now,

%a{ href: "asdfasdf#{}" }

...and the rubocop linter kicks in. Save the file, close and reopen, rubocop errors are gone and I can continue editing. Until I do another string interpolation, anyway.

Edit: doesn't need to be in an attribute hash. = "asdf#{}" does the same thing.

@Arcanemagus
Copy link
Member

Ah ha!

In this block:

%a{ href: "asdfasdf#{}" }

If you place the cursor in between the {} in the string interpolation part, one of the scopes is source.ruby!

Can somebody who knows HAML better file an issue on language-haml to get that marked as source.embedded.ruby (or just remove source.ruby as it already has meta.embedded.line.ruby)?

@maschwenk
Copy link
Contributor

Looks like this was resolved upstream

@joelmichael
Copy link

Seems to still be happening to me.

@vzamanillo
Copy link
Contributor

Seems to still be happening to me.

#48

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

No branches or pull requests

7 participants