Skip to content

[Bug] "View source" links to Azure DevOps do not highlight line in source code #10447

@vbluhme

Description

@vbluhme

Describe the bug
When clicking a "View source" link to an Azure DevOps remote repository, there is no line highlighting in the Azure DevOps source code viewer.

The links currently append &line={source.Line} to the URL which does not achieve anything in the Azure DevOps source code viewer. To highlight a line of code, Azure DevOps requires:

&line={source.Line}&lineEnd={source.Line+1}&lineStartColumn=1&lineEndColumn=1&lineStyle=plain

This is the pattern generated when copying the link to a line within Azure DevOps and is also described here. Result with source.Line = 7:

Image

The link seems to be generated here: https://github.com/dotnet/docfx/blob/main/src/Docfx.Common/Git/GitUtility.cs#L77

To Reproduce

  1. Set up a DocFX project linked to an Azure DevOps remote repo.
  2. Build the project and click "View source" on a member in the API documentation.
  3. No lines are highlighted.

Expected behavior
I expect startLine in the API YAML file to be highlighted within Azure DevOps.

Context (please complete the following information):

  • OS: Windows 10
  • Docfx version: 2.78.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions