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 docs links to document and hover #402

Merged
merged 2 commits into from
Feb 15, 2021
Merged

Add docs links to document and hover #402

merged 2 commits into from
Feb 15, 2021

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Feb 9, 2021

Depends on hashicorp/hcl-lang#8
Depends on hashicorp/terraform-schema#10


This adds links to relevant documentation for providers via hover data and documentLink method, which then results in the following UX in VS Code:

Screenshot 2021-02-09 at 16 19 47

Maybe this is not the best UX, but we don't have any control over how clients (such as VS Code) use the documentLink and if at all. Sublime Text for example doesn't implement it at all, so we are left with just hover:

Screenshot 2021-02-09 at 16 54 20

I don't have strong opinion on how we link to docs UX-wise, but I think we could just roll it out and see how people (dis)like it.

Relatedly the UTM parameters will help us identify any click-throughs to the Registry using any of these two features. All URLs have these parameters appended:

  • utm_source=terraform-ls
  • utm_content - e.g.documentLink or documentHover
  • utm_media - e.g. vscode or Sublime Text LSP

Copy link
Contributor

@aeschright aeschright left a comment

Choose a reason for hiding this comment

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

👍

@nfx
Copy link

nfx commented Feb 27, 2021

this PR does not allow going to resource documentation, only provider.

@mercuriete
Copy link

mercuriete commented Mar 12, 2021

this only works on provider block
but not in required_providers block:

example:

versions.tf

terraform {
  required_version = ">= 0.14.5, <= 0.14.7"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "3.29.1"
    }
  }
}

in this example hover is not working.
I think this example is important because lot of users don't declare provider instead they use default parameters and do
required_providers + .terraform.lock.hcl

@radeksimko
Copy link
Member Author

Correct, this is the current limitation we plan to address. I'm sorry for not being clear about it in the PR description.

Feel free to follow #190 for resources, data sources and modules, or #440 for required_providers block.

@ghost
Copy link

ghost commented Mar 17, 2021

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 Mar 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants