-
Notifications
You must be signed in to change notification settings - Fork 137
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
Enable opening a single Terraform file #843
Conversation
58df632
to
05e1242
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it a try and it works pretty well! 👍🏻
I left some naming suggestions in-line and there are now some conflicts to resolve after merging #839
Enqueueing a new directory was
walker.EnqueuePath(modPath)
and is now
stateStore.WalkerPaths.EnqueueDir(dirUri)
i.e. the enqueueing happens on the state store (memdb) as opposed to the walker itself.
Secondly there are now two walkers (svc.closedDirWalker & svc.openDirWalker) so some setup methods previously called on svc.walker
now need to be called on both instead.
I am happy to assist with the rebasing and resolution of conflicts, if you like - feel free to ping me and I can jump on Zoom with you!
05e1242
to
0dbfaa1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One remaining error handling + commented out code, otherwise LGTM
Co-authored-by: Radek Simko <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just proposed a small change to the warning message, but LGTM otherwise 🚀
Tested in combination with hashicorp/vscode-terraform#1031 and it works great!
Co-authored-by: Radek Simko <[email protected]>
Adds the terraform-ls setting that controls whether warnings are shown when editing single Terraform files. Works with hashicorp/terraform-ls#843
This functionality has been released in v0.27.0 of the language server. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
This PR enables single file support by skipping configuring the file watcher with information about what folders to watch. This leaves the watcher with little environment information, but still provides enough functionality to edit a single file. This suits the common transitory workflows for single files. For example, opening a file just to review contents or to make a few line changes without needing the context from an entire Terraform project.
A warning is shown to the user when a single file is opened, explaining that some capabilities may be reduced when editing a single file, and to open a directory to regain full editor functionality. This is to warn the user that while we enable this workflow, we don't encourage it because of the tradeoffs we currently have to do. This warning can be disabled by setting
ignoreSingleFileWarning
totrue
.