microsoft / azure-pipelines-vscode

VS Code extension for working with Azure Pipelines YAML files
MIT License
162 stars 104 forks source link

Feature Request: Navigate to task reference online documentation #430

Open hymccord opened 2 years ago

hymccord commented 2 years ago

This feature request comes from here: https://stackoverflow.com/questions/70038332/how-can-i-ctrlclick-goto-defintion-of-a-yml-azure-devops-pipeline-task

I have a Azure Devops .yml pipeline with some tasks

- stage: firstStage
  jobs:
  - job: doThing
    steps:
    - task: AzurePowerShell@5    # <--- how to ctrl_click and see docs at 
                                 # https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-powershell?view=azure-devops
      inputs:
        ScriptPath: 'path/script.ps1'
        pwsh: true
    - task: AzureCli@2         #<------ how to ctrl-click and see docs at
                               # https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-cli?view=azure-devops
      inputs:
        ScriptPath: 'scriptAzCli.ps1'
        scriptType: 'pscore'

Everytime i need to check the inputs and keyword definitions, I have to open up a new browser tab and navigate to the documentation. Is there a way to simply ctrl+click and 'goto' the definition of the task like in a regular programming language?

Would there be any way to update the service schema to include the documentation url and the language server to then support a goto definition for the tasks?

winstliu commented 2 years ago

Hmm...this is most likely out of scope because I'd prefer that we don't modify the service schema after ingesting it, but I'll take a look anyway and see if there's a trivial mapping we can perform.

hymccord commented 2 years ago

Appreciate it.

For curiosity's sake, how is the schema generated? I originally found it by looking at the azure-pipelines lang server and seeing that it pulls the schema from http://schemastore.org/api/json/catalog.json which lead me to this repo naturally.

winstliu commented 2 years ago

and seeing that it pulls the schema from http://schemastore.org/api/json/catalog.json which lead me to this repo naturally.

This isn't correct, what you're likely seeing is the generic "find the schema" code that we got when we forked Red Hat's YAML language server. For Azure Pipelines specifically, the schema is found using an API endpoint: https://github.com/microsoft/azure-pipelines-vscode#specific-schema. For releases, we copy the schema from an organization with no custom pipeline tasks installed, then update the root service-schema.json.

As for how that endpoint generates the schema, it's a complete black box to me that I would love to know more about because half the issues we get are incorrect schema generation 😓.