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

@description attribute to document params, outputs, resources & vars and show description hovers #1665

Closed
anthony-c-martin opened this issue Mar 1, 2021 · 10 comments · Fixed by #4091 or #4446
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@anthony-c-martin
Copy link
Member

anthony-c-martin commented Mar 1, 2021

We should provide a mechanism to enhance declarations with documentation that can show up in hovers.

This would be especially useful when mousing over module parameters or outputs which are defined in a separate file, or references to variables defined elsewhere in the document. We could also potentially consider using it to generate ARM JSON metadata fields.

Example:

@description('The geo location of the resources to deploy')
param string location

@description('The name of the storage account')
param string stgAccName

@description('Some human-readable text about this resource')
resource stg 'Microsoft.Storage/storageAccounts@2019-06-01' = {
  name: stgAccName
  location: location
  kind: 'StorageV2'
  sku: {
    name: 'Standard_LRS'
  }
}

@description('The blob storage endpoint URI')
output storageUri string = stg.properties.primaryEndpoints.blob

Originally discussed here: #64 (comment)

EDIT 2021-08-09 - changed @doc() to @description() in this proposal, as it has already been implemented for param.

@majastrz
Copy link
Member

majastrz commented Mar 1, 2021

For parameters we already do support @description('...'), but it's not possible to apply it to all types of declarations we have. We definitely should show this information in hovers.

@alex-frankel alex-frankel added this to the v0.4 milestone Mar 4, 2021
@alex-frankel alex-frankel added the discussion This is a discussion issue and not a change proposal. label Mar 4, 2021
@rahalan
Copy link

rahalan commented Mar 11, 2021

I also miss the @description property for outputs, as ARM is supporting that.

@alex-frankel
Copy link
Collaborator

cc @bmoore-msft

Where are these descriptions consumed and displayed? I didn't realize ARM Template outputs supported a description property

@rahalan
Copy link

rahalan commented Mar 15, 2021 via email

@alex-frankel
Copy link
Collaborator

Got it - I see you are parsing out the descriptions in the README, so the use case definitely makes sense.

@bmoore-msft
Copy link
Contributor

the metadata property is a generic language construct - we (ARM) only use it on params afaiki but some RPs (and I'm sure customers @rahalan) use it in other places in the template (outputs, resources).

@alex-frankel alex-frankel removed the discussion This is a discussion issue and not a change proposal. label May 12, 2021
@alex-frankel alex-frankel modified the milestones: v0.4, v0.5 Jun 3, 2021
@BernieWhite
Copy link

BernieWhite commented Jul 23, 2021

@alex-frankel @metadata already works great for properties and decompiles nicely too. Top level metadata would be great.

https://azure.github.io/PSDocs.Azure/using-metadata/

Azure/PSDocs.Azure#106

@anthony-c-martin
Copy link
Member Author

Note - renaming from @description() to @doc() would be a fairly annoying breaking change, so I'm proposing we keep it as @description() at this point.

The main thing I'm after here is to allow annotating any declaration (var/output/resource), and to have this information show up in symbol hovers both in the file, and across modules for param/output.

@bmoore-msft
Copy link
Contributor

so thinking of adding @doc to vars (for example)? or adding @description to vars?

I would lean toward the latter since optimizing for client consumption of it rather than the tools...

@TSunny007 TSunny007 self-assigned this Aug 6, 2021
@anthony-c-martin
Copy link
Member Author

so thinking of adding @doc to vars (for example)? or adding @description to vars?

I would lean toward the latter since optimizing for client consumption of it rather than the tools...

The latter. I'll update the title & description of this issue to clarify that.

@anthony-c-martin anthony-c-martin changed the title @doc attribute to add documentation for params, outputs, resources & vars @description attribute to document params, outputs, resources & vars and show description hovers Aug 9, 2021
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
7 participants