razor icon indicating copy to clipboard operation
razor copied to clipboard

MapCode returns incorrect edit for full document

Open ryzngard opened this issue 2 years ago • 0 comments

Given the following json message for the mapcode call from the client (not the replaced URI since that will be project/machine dependent).

{
  "traceparent": "00-a00a2f15e22cad4bb5fadc1101371c5f-ab3a54102dc2954d-01",
  "jsonrpc": "2.0",
  "id": 487,
  "method": "workspace/_vs_mapCode",
  "params": {
    "_vs_mappings": [
      {
        "TextDocument": {
          "uri": "file:///<uri>.razor"
        },
        "Contents": [
          "@page \"/counter\"\n\n<PageTitle>Counter</PageTitle>\n\n<h1>Counter</h1>\n\n<p role=\"status\">Current count: @currentCount</p>\n\n<button class=\"btn btn-primary\" @onclick=\"IncrementCount\">Click me</button>\n"
        ],
        "FocusLocations": [
          [
            {
              "uri": "file:///<uri>.razor",
              "range": {
                "start": {
                  "line": 16,
                  "character": 5
                },
                "end": {
                  "line": 16,
                  "character": 5
                }
              }
            },
            {
              "uri": "file:///<uri>.razor",
              "range": {
                "start": {
                  "line": 16,
                  "character": 5
                },
                "end": {
                  "line": 16,
                  "character": 5
                }
              }
            }
          ]
        ]
      }
    ],
    "_vs_updates": null
  }
}

We would expect that no mapping edits are returned. This will let the fallback mapper handle the edits directly, which should replace the Counter.razor file with the contents provided.

ryzngard avatar Mar 06 '24 23:03 ryzngard