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

Add Terraform version info #1190

Closed
wants to merge 6 commits into from
Closed

Add Terraform version info #1190

wants to merge 6 commits into from

Conversation

jpogran
Copy link
Contributor

@jpogran jpogran commented Jul 26, 2022

This commit adds a LanguageStatusItem that shows the discovered Terraform version in the current workspace. This utilizes the LSP request mechanism to automatically show the version when it is discovered for the currently open document.

This requires an open document and does not attempt to query for a folder because LanguageStatusItems only show for open documents.

Requires hashicorp/terraform-ls#1016

@jpogran jpogran added the enhancement New feature or request label Jul 26, 2022
@jpogran jpogran self-assigned this Jul 26, 2022
@jpogran jpogran force-pushed the terraform_version_command branch 5 times, most recently from f9a1cdc to 763cdcd Compare July 27, 2022 14:56
jpogran added 2 commits August 1, 2022 10:53
This commit adds a LanguageStatusItem that shows the discovered Terraform version in the current workspace.
@jpogran jpogran force-pushed the terraform_version_command branch from 763cdcd to 8b62630 Compare August 1, 2022 14:54
@jpogran jpogran marked this pull request as ready for review August 2, 2022 13:44
@jpogran jpogran requested a review from a team as a code owner August 2, 2022 13:44
@jpogran jpogran linked an issue Aug 2, 2022 that may be closed by this pull request
2 tasks
Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

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

Nice work! 👍

I've a few questions and minor suggestions.

terraformStatus.command = {
command: 'terraform.commands',
title: 'Terraform Commands',
tooltip: 'foo',
Copy link
Member

Choose a reason for hiding this comment

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

foo?

ExecuteCommandParams,
ExecuteCommandRequest,
LanguageClient,
WorkDoneProgress,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
WorkDoneProgress,

}

public dispose(): void {
this.disposables.forEach((d: vscode.Disposable) => d.dispose());
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to remove the disposable after disposing it?

terraformStatus.name = 'Terraform';
terraformStatus.detail = 'Terraform';
terraformStatus.command = {
command: 'terraform.commands',
Copy link
Member

Choose a reason for hiding this comment

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

What does this command do? Do we need to register it?

const moduleDir = Utils.dirname(moduleUri);

const response = await terraformVersion(moduleDir.toString(), client, reporter);
tfStatus.setTerraformVersion(response.discovered_version);
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if this is the place where I would expect the modification of the status bar item. Most of the other functions in this file make an API call and return the result.

Maybe this line belongs in the TerraformVersionFeature?

@radeksimko
Copy link
Member

This was implemented as part of #1325

@radeksimko radeksimko closed this Feb 17, 2023
@radeksimko radeksimko deleted the terraform_version_command branch February 17, 2023 19:06
@github-actions
Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display Terraform path, version and constraint in the status bar
3 participants