cmur2 / language-terraform

Terraform.io support for Atom
MIT License
49 stars 32 forks source link

"resource" not correctly recognised as a keyword? #7

Closed jedineeper closed 8 years ago

jedineeper commented 9 years ago

On this line https://github.com/GiantToast/language-terraform/blob/master/grammars/terraform.cson#L177 you reference a number of items as keywords.

However the pattern for matching those keywords appears to be

keyword "name-of-object" {
 *snip*
}

However, for "resource" there is both a type and a name so the format is

resource "type-of-resource" "name-of-object" {
 *snip*
}

As a result, resource isn't correctly being highlighted as a keyword.

Otherwise, awesome new release :D thanks.

jedineeper commented 8 years ago

Found the actual issue is that I can't have underscores in name-of-object if that is any help debugging.

GiantToast commented 8 years ago

Thanks, it looks like this is causing some other problems too, I'll be taking a look within the next couple of days and will hopefully have a fix.

GiantToast commented 8 years ago

I think this is fixed in the new release as I can't reproduce anymore. Let me know if it's fixed and I'll close this out.

jedineeper commented 8 years ago

I can still reproduce this with this object after upgrading to language-terraform 0.7.0 and Atom 1.4.0

https://gist.github.com/jedineeper/2a1c603bbf032d2f99fd

tranberg commented 8 years ago

I have made a fix for this in my pull request #11. The regex has been generalized so that you can have as many "str" as you want, separated by as many whitespaces as you want. Below are three examples that are all getting highlighted:

test "" {}
test "" "" {}
test ""  ""   ""  {}

Do you like it or is it too general?

GiantToast commented 8 years ago

Ah, I see. Resource was getting highlighted, just not as a keyword. At least thats how it was looking for me. I'm fine with the changes made in @tranberg's PR, I'll just merge that it and cut a new release.

jedineeper commented 8 years ago

I can confirm this issue is resolved for me in 0.7.1

Thanks @tranberg @GiantToast !