smithy-lang / smithy-language-server

A Language Server Protocol implementation for the Smithy IDL
https://smithy.io
Apache License 2.0
33 stars 18 forks source link

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

Open kubukoz opened 1 year ago

kubukoz commented 1 year ago

To reproduce:

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

namespace test

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

@error("client") structure TestErr {}


2. Go to `errors: [Test<cursor>Err]`
3. Trigger "go to definition"
4. 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 commented 11 months ago

Guess who just tried to report it again 😅