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

ask for init if current folder is empty root module #257

Merged
merged 3 commits into from
Nov 20, 2020

Conversation

njuCZ
Copy link
Contributor

@njuCZ njuCZ commented Aug 11, 2020

fix #106.

there are some points that have not been considered. such as if current dir is in IncludeRootModule or ExcludeRootModule

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Sorry it took me so long to review this PR.

I appreciate the PR as a form of starting a discussion.

A few high-level comments/questions which came up as I was reading the code:

  1. I'm not fully convinced about the value of tracking "potential root modules" specifically in this context. I'd say that the root module is no different from the (existing initialized) tracked ones after the user confirms the initialization. Relatedly that recently initialized module also needs to be watched for changes.
  2. I understand we need to track these "candidates" somewhere until they're actually initialized and added for tracking, but I'm not sure whether expanding the responsibility of RootModuleManager to do this is the right approach. 🤔 It would also mean we'd need to integrate the watcher there somehow. So maybe it's better to keep this logic apart in some form of RootModuleInitializer?
  3. We're in the process of integrating hashicorp/terraform-exec which may change how we call Terraform a little bit internally.
  4. As part of Validate configuration and publish diagnostics #27 we'll need to enable clients also to run certain commands, and that would likely include terraform init. I'm not saying that it should be a blocker for fixing Ask to terraform init an uninitialized workspace #106 or that we need to call init the exact same way as clients would, but it's something to keep in mind.

@njuCZ njuCZ changed the title basic draft to fix #106 ask for init if current folder is empty root module Nov 5, 2020
@njuCZ
Copy link
Contributor Author

njuCZ commented Nov 5, 2020

@radeksimko @appilon I have updated this PR, could you have a look when free?
1: have added watch for recently initialized module
3 & 4: have used terraform-exec to execute terraform init

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

I'm sorry it took me a while to get to this PR, but a colleague of mine is working on a similar feature on VS Code side and we needed to sync up and make sure that we don't introduce something conflicting.

The PR looks good in general - Frankly I think the UX around modules will go through many changes in the near future as we get it more accurate and relevant, but since your PR just makes the existing message more actionable and still leaves user the choice I think there is no harm in merging it, once we address the in-line comments.

langserver/handlers/did_open.go Outdated Show resolved Hide resolved
langserver/handlers/did_open.go Outdated Show resolved Hide resolved
langserver/handlers/did_open.go Outdated Show resolved Hide resolved
@njuCZ
Copy link
Contributor Author

njuCZ commented Nov 20, 2020

@radeksimko thanks for your suggestions. I have updated this PR.

@ghost
Copy link

ghost commented Dec 20, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ask to terraform init an uninitialized workspace
2 participants