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

Support special escape sequences in Terraform #2073

Merged

Conversation

tancnle
Copy link
Collaborator

@tancnle tancnle commented Sep 17, 2024

This MR adds support for special escape sequences $${ and %%{ in Terraform lexer.

https://developer.hashicorp.com/terraform/language/expressions/strings#string-templates

Before After
Screenshot 2024-09-18 at 11 10 53 AM Screenshot 2024-09-18 at 11 28 47 PM

Fixes #2061

@tancnle
Copy link
Collaborator Author

tancnle commented Sep 18, 2024

👋🏼 @Sayrus could you kindly help to confirm if this addresses #2061?

@Sayrus
Copy link

Sayrus commented Sep 18, 2024

👋🏼 @Sayrus could you kindly help to confirm if this addresses #2061?

Hey @tancnle , thanks for taking time to look into this issue !

While not having an error is a huge improvement, I think the entire string should be colored as a string. Since $${ is a string literal, local.demo is not interpolated so the entire thing is a normal string.

I'm not sure we want to highlight $${ in any special way, maybe we'd like to match other escape sequences such as \n.

@tancnle
Copy link
Collaborator Author

tancnle commented Sep 18, 2024

Thanks, @Sayrus. That makes sense. Would something like the attached screenshot look better?

Screenshot 2024-09-18 at 11 07 53 PM

@Sayrus
Copy link

Sayrus commented Sep 18, 2024

Thanks, @Sayrus. That makes sense. Would something like the attached screenshot look better?

Screenshot 2024-09-18 at 11 07 53 PM

Looks good to me!

@tancnle tancnle force-pushed the fix-escape-literal-sequence-terraform branch from eebba7c to bb9bd49 Compare September 18, 2024 13:24
@tancnle tancnle added this pull request to the merge queue Sep 18, 2024
Merged via the queue into rouge-ruby:master with commit 67f3244 Sep 18, 2024
8 checks passed
@tancnle tancnle deleted the fix-escape-literal-sequence-terraform branch September 18, 2024 13:30
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

Successfully merging this pull request may close these issues.

Terraform: $${ are highlighted as error
2 participants