microsoft / sarif-vscode-extension

SARIF Microsoft Visual Studio Code extension
MIT License
107 stars 48 forks source link

Double clicking to navigate to results no longer works #531

Open d-alonso opened 9 months ago

d-alonso commented 9 months ago

Double clicking on the results in the LOCATIONS or RULES panel used to take you exactly to the file, line and column that the result specified. Also by clicking on the Locations row of the Info/Details panel. This has stopped working, nothing happens at all now. Image of the places where the clicking navigation used to work

Version it last worked on: 3.3.7

Version it stopped working: 3.3.8 - latest

Which most likely would point to some commit in #508 as the culprit, as it's the only relevant PR between those versions

Testcase

<test_absolute_path>/file.c

void zero(double **A, int n) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      A[j][i] = 0.0;
    }
  }
}

and a SARIF file, generated by our tool (Codee) for which the plugin does not open the file pointed by the positions in our rules

{
  "version": "2.1.0",
  "$schema": "https://docs.oasis-open.org/sarif/sarif/v2.1.0/cs01/schemas/sarif-schema-2.1.0.json",
  "runs": [
    {
      "tool": {
        "driver": {
          "name": "codee",
          "fullName": "codee-2023.1.7-33-ge581a6f4694a-Debug-linux-x86_64",
          "informationUri": "https://www.codee.com",
          "version": "2023.1.7-33",
          "semanticVersion": "2023.1.7-33",
          "rules": [
            {
              "id": "PWR039",
              "name": "Consider loop interchange to improve the locality of reference and enable vectorization",
              "defaultConfiguration": {
                "level": "warning"
              },
              "fullDescription": {
                "text": "Inefficient matrix access pattern detected that can be improved through loop interchange."
              },
              "helpUri": "https://www.codee.com/knowledge/pwr039"
            }
          ]
        }
      },
      "invocations": [
        {
          "commandLine": "pwreport --checks --sarif file.c --only-tags memory",
          "startTimeUtc": "2023-10-16T16:25:16Z",
          "endTimeUtc": "2023-10-16T16:25:16Z",
          "executionSuccessful": true,
          "machine": "redacted",
          "account": "redacted"
        }
      ],
      "originalUriBaseIds": {
        "SRCROOT0": {
          "uri": "<test_absolute_path>"
        }
      },
      "results": [
        {
          "ruleId": "PWR039",
          "message": {
            "text": "Consider loop interchange to improve the locality of reference and enable vectorization\n  Suggestion: Interchange inner and outer loops in the loop nest to improve performance\n  AutoFix:\n    pwdirectives --memory loop-interchange --in-place file.c:2:3\n"
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "file.c",
                  "uriBaseId": "SRCROOT0"
                },
                "region": {
                  "startLine": 2,
                  "startColumn": 3
                }
              }
            }
          ],
          "relatedLocations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "file.c",
                  "uriBaseId": "SRCROOT0"
                },
                "region": {
                  "startLine": 2,
                  "startColumn": 3
                }
              },
              "message": {
                "text": "Outer loop to incherchange"
              }
            },
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "file.c",
                  "uriBaseId": "SRCROOT0"
                },
                "region": {
                  "startLine": 3,
                  "startColumn": 5
                }
              },
              "message": {
                "text": "Inner loop to incherchange"
              }
            }
          ]
        }
      ]
    }
  ]
}

Where you replace <test_absolute_path> for the absolute filepath to the folder where file.c is.