-
Notifications
You must be signed in to change notification settings - Fork 130
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
internal: expose tf related options via init opts #588
Conversation
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.
Looks like the tests are failing - can you take a look at the results and make these pass again?
You can also run tests locally via go test ./...
.
Thanks.
e7997d2
to
08ab9aa
Compare
Sure. It looks like new contributors can't rerun tests on subsequent pushes, can you help out here? Thanks |
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.
@radeksimko does it make sense to abstract out this validation for paths to a separate package? something like fileutil
or maybe rename the existing pathcmp
package to path
and have such utilities moved there?
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.
This looks decent, thank you for the PR. Aside from my inline comments:
Do you mind also adding a note to the CLI option, so that users are aware that we are deprecating it in favour of terraformExecPath
LSP config option?
I would add a brief note to the flag help itself here
fs.StringVar(&c.tfExecPath, "tf-exec", "", "path to Terraform binary") |
and then also log a warning (just a message prepended with
[WARN]
) after here terraform-ls/internal/cmd/serve_command.go
Line 142 in 9acdc67
logger.Printf("Terraform exec path set to %q", path) |
Down the line, after this is released and clients had some chance to reflect this we can also start sending a warning message but I wouldn't do that yet. I'd just create a separate issue to revisit later.
* add note for users about deprecation of cli options
08ab9aa
to
927915e
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.
LGTM. I will remove that redundant error check as mentioned in-line and make some minor adjustments of the comment phrasing before merging - I hope you don't mind.
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.
Actually on a second look I'm afraid this won't work because all the methods (formatting
, didSave
, executeCommand
) which are supposed to consume the LSP-configured exec path receive execOpts
in their own context, but the initialize
handler never writes into it. Instead they will just all always fall back to auto-discovered Terraform exec path - that is not desirable.
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'm afraid this is going to be much more involved than expected - we need the exec path pretty early in the lifecycle for walker and module manager, which are both currently created before the initialize
handler is ever executed.
I will take this over.
This is to allow "later" configuration of walker, watcher, module manager and other things which depend on InitializationOptions we receive as part of the initialize request.
Thanks for the PR 👍🏻 I wish I realized the complexity earlier, I did some refactoring to address the mentioned problem and also added some docs, so this is now ready to be merged. |
Thanks for reviewing this PR, will go through the refactoring that you've done before making other changes. |
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. |
Closes #240