-
Notifications
You must be signed in to change notification settings - Fork 135
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 folding ranges #105
Comments
Apologies as I'm not too familiar with the LSP spec. Would this allow collapsing/expanding blocks, e.g., resource blocks, etc? If so, pretty cool! |
@amasover yep, exactly. I'd imagine the simplistic initial implementation will just be folding of root level blocks (resource, provider, data, variable, output, module, local, terraform, etc.). |
@paultyng I have try with this, But not working. #region test
variable "test" {
type = bool
default = true
}
#endregion |
@PePoDev we haven't implemented region folding yet. When we do you'll see a PR and a line item in our changelog |
Hi, I'm also interested in region folding, any news in regards of this? 🙂🤞 |
Hi @aleqsss, Sorry, but there hasn't been any progress on this. We are currently planning our roadmap for the first quarter, and it's already full of other issues we need to address. So at this point, it's tough for me to say when we can work on folding ranges. |
Understood, and thank you for the information! |
Hello, is this feature implemented? |
@garsiv1932 Sorry, but we haven't implemented region folding yet |
Is it too difficult? |
Hey @garsiv1932 , just to clarify region folding support was implemented in the Terraform VS Code extension in hashicorp/vscode-terraform#924, so if you do want to use them now we do support them. If you use another editor, that has not been planned yet. |
And how is the syntax, because i tried to put # regiion and #endRegion and didnt work. Can You post the link of the vscode plugin too, only yo clarify if i AM using the dame one. |
You can find our extension in the VS Code Marketplace or in the VS Code Extensions bar by typing 'hashicorp'. The syntax is Screen.Recording.2024-03-26.at.9.44.59.AM.mov |
I had a conflict on my extensions, is working right now. |
@artemudovyk Is this still a problem for you? It seems to be working for me |
Yeah, it's still the same for me. |
I see the difference now. I was using v0.2.5 of 4ops.terraform. Indeed, if I use v2.32.3 of HashiCorp.terraform then it doesn't work. 👍 |
https://microsoft.github.io/language-server-protocol/specification#textDocument_foldingRange
There are generally three "kinds" of foldable ranges that LSP supports natively:
In order to support folding of comments we'd need the upstream HCL parser to return comments in the first place, these are currently ignored.
Imports could either be interpreted as
required_providers
block, or just not reported at all.We can also report any additional kinds as the
kind
in the protocol spec is technically juststring
. For example gopls chooses to report all kinds of foldable ranges, such as function calls, struct declarations, switch case statements etc.:https://github.com/golang/tools/blob/8c34cc9cafff8f13c3f3ed95a11de309752c1c60/internal/lsp/source/folding_range.go#L68-L128
It is unclear however how any custom kinds would be surfaced to the user and whether a custom kind (as opposed to just empty string, like gopls uses) is even useful in practice.
The text was updated successfully, but these errors were encountered: