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

Terraform: new parser #3684

Merged
merged 9 commits into from
Apr 1, 2023
Merged

Conversation

masatake
Copy link
Member

@masatake masatake commented Mar 29, 2023

Close #2952.
Close #3683.

optlib/terraform.ctags Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Mar 29, 2023

Codecov Report

Patch coverage: 47.65% and project coverage change: -0.09 ⚠️

Comparison is base (8a4f1ae) 82.88% compared to head (9a23f87) 82.80%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3684      +/-   ##
==========================================
- Coverage   82.88%   82.80%   -0.09%     
==========================================
  Files         224      226       +2     
  Lines       54684    54791     +107     
==========================================
+ Hits        45327    45367      +40     
- Misses       9357     9424      +67     
Impacted Files Coverage Δ
optlib/terraform.c 0.00% <0.00%> (ø)
optlib/terraformvariables.c 0.00% <0.00%> (ø)
main/parse.c 95.07% <65.95%> (-0.55%) ⬇️
main/dependency.c 95.50% <66.66%> (-1.01%) ⬇️
main/lregex.c 82.86% <81.25%> (-0.09%) ⬇️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@masatake masatake force-pushed the terraform-parser branch 3 times, most recently from 41840e0 to c27b6ec Compare March 30, 2023 08:28
@Haggus
Copy link
Contributor

Haggus commented Mar 30, 2023

I'm trying out your branch on a project I'm building for work, and I can't get this build of ctags to pick up my .tfvars files. I can see in tags that Terraform parser shows up:

!_TAG_ROLE_DESCRIPTION!Terraform!variable	assigned	/assigned in Variable Definitions (.tfvars) files/

However, tags file does not contain any other references to tfvars. I wonder if it has to do with .tfvars being nested in multiple folders. Although I am running ctags -R .

Also "assigned" for variables in tfvars sounds good to me.

@Haggus
Copy link
Contributor

Haggus commented Mar 30, 2023

Nevermind, I just had to run ctags with the same arguments as the test. My bad.

@masatake
Copy link
Member Author

masatake commented Mar 30, 2023

As you might find, you have to add --extras=+r to let the TerraformVariables parser emit "variable" kind tags with the "assigned" role.

In addition, use --fields=+r to print the role ("assigned") for the tags.

See also https://docs.ctags.io/en/latest/output-tags.html?highlight=reference#reference-tags .

I'm working on TODO items in

c27b6ec

@Haggus
Copy link
Contributor

Haggus commented Mar 30, 2023

Interesting. Thank you for the explanation. I'm slowly discovering all the available options.

Regarding this pull request, I've tested your changes with multiple terraform projects and it seems to work correctly.

@masatake
Copy link
Member Author

The man page has been added.

@masatake masatake force-pushed the terraform-parser branch 2 times, most recently from 23270ed to b9a804c Compare April 1, 2023 08:30
masatake and others added 9 commits April 1, 2023 17:32
… --_mtable-regex-<LANG> options

Signed-off-by: Masatake YAMATO <[email protected]>
Close universal-ctags#757.

Derrived from
https://github.com/juliosueiras/vim-terraform-completion/blob/master/ctags/terraform.ctags,

@Haggus reactivated the pull request and polished the original commits.
@masatake wrote this commit message.

Co-authored-by: Matt Mrowiec <[email protected]> (@Haggus)
Co-authored-by: Masatake YAMATO <[email protected]> (@masatake)
This parser doesn't have its own kinds.
Instead, this parser emits Terraform parser's "variable"
kind tags with "assigned" role.

ref. https://developer.hashicorp.com/terraform/language/values/variables#variable-definitions-tfvars-files

Signed-off-by: Masatake YAMATO <[email protected]>
@masatake masatake merged commit 1231ebe into universal-ctags:master Apr 1, 2023
@masatake
Copy link
Member Author

masatake commented Apr 1, 2023

@Haggus, thank you for boosting this.

@Haggus
Copy link
Contributor

Haggus commented Apr 1, 2023

@masatake Thank you for your help and finishing it!

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.

3 participants