smithy-language-server icon indicating copy to clipboard operation
smithy-language-server copied to clipboard

Go-to-definition broken on error shapes in operations with inline I/O

Open kubukoz opened this issue 2 years ago • 1 comments

To reproduce:

  1. Create a file, a.smithy:
$version: "2"

namespace test

operation HelloWorld {
    input := {}
    errors: [TestErr]
}

@error("client")
structure TestErr {}
  1. Go to errors: [Test<cursor>Err]
  2. Trigger "go to definition"
  3. See "No references found for 'TestErr'" (in vscode)

LSP request/response:

[Trace - 15:28:27] Sending request 'textDocument/definition - (237)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/kubukoz/projects/demos/a.smithy"
    },
    "position": {
        "line": 6,
        "character": 17
    }
}


[Trace - 15:28:27] Received response 'textDocument/definition - (237)' in 3ms.
Result: [
    {
        "uri": "file:/Users/kubukoz/projects/demos/a.smithy",
        "range": {
            "start": {
                "line": 5,
                "character": 13
            },
            "end": {
                "line": 6,
                "character": 21
            }
        }
    }
]

The response is present, but incorrect: the range [5, 13] - [6, 21] (0-indexed) translates to this text:

{}
    errors: [TestErr]

and interestingly, vscode decides to ignore that rather than navigate to the incorrect range.

kubukoz avatar May 30 '23 13:05 kubukoz

Guess who just tried to report it again 😅

kubukoz avatar Aug 23 '23 23:08 kubukoz

This is fixed by #146

milesziemer avatar Jul 29 '24 16:07 milesziemer

Indeed!

kubukoz avatar Jul 29 '24 23:07 kubukoz