Skip to content

Add IPs and CIDR in strings #89

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

michaelblyons
Copy link
Contributor

@michaelblyons michaelblyons commented May 5, 2025

As suggested at #67 (comment)

Conveying IP/CIDR in strings makes sense

And directly opposed to 01eba12

We don't need or want to interpret string literals as their content is
none of our business and has no explicit or implicit meaning.

🤷‍♂️

Copy link
Member

@FichteFoll FichteFoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not going to merge this for 2.0.0 since I want to think about and discuss this more.

@@ -319,6 +344,43 @@ contexts:
- meta_content_scope: source.terraform
- include: string-interpolation-body

ipv4-at-start:
- match: \G{{ipv4}}\b
Copy link
Member

@FichteFoll FichteFoll May 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\G means it matches after any previously consumed token, i.e. you could have multiple IPs within a single string or have an IP after an escape sequence. A more consistent approach would be to have two different string body contexts where the IP patterns are only applied for the very first character and any other following character switches to the other string context.

image

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.

2 participants