This PR adds support for throwing named errors with associated error explanations. In particular, it adds elaborators for the syntax defined in #8649, which use the error-explanation infrastructure added in #8651. This includes completions, hovers, and jump-to-definition for error names. Note that another stage0 rebuild will be required to define explanations using `register_error_explanation`. --------- Co-authored-by: Joachim Breitner <mail@joachim-breitner.de> Co-authored-by: Marc Huisinga <mhuisi@protonmail.com>
196 lines
6.6 KiB
Text
196 lines
6.6 KiB
Text
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 28, "character": 33}}
|
|
{"items":
|
|
[{"textEdit":
|
|
{"replace":
|
|
{"start": {"line": 28, "character": 23},
|
|
"end": {"line": 28, "character": 33}},
|
|
"newText": "TestDomain.Foo1",
|
|
"insert":
|
|
{"start": {"line": 28, "character": 23},
|
|
"end": {"line": 28, "character": 33}}},
|
|
"label": "TestDomain.Foo1",
|
|
"kind": 10,
|
|
"documentation": {"value": "(error) Error 1", "kind": "markdown"},
|
|
"detail": "error name",
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 28, "character": 33}},
|
|
"cPos": 0}},
|
|
{"textEdit":
|
|
{"replace":
|
|
{"start": {"line": 28, "character": 23},
|
|
"end": {"line": 28, "character": 33}},
|
|
"newText": "TestDomain.Foo2",
|
|
"insert":
|
|
{"start": {"line": 28, "character": 23},
|
|
"end": {"line": 28, "character": 33}}},
|
|
"label": "TestDomain.Foo2",
|
|
"kind": 10,
|
|
"documentation": {"value": "(error) Error 2", "kind": "markdown"},
|
|
"detail": "error name",
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 28, "character": 33}},
|
|
"cPos": 0}},
|
|
{"textEdit":
|
|
{"replace":
|
|
{"start": {"line": 28, "character": 23},
|
|
"end": {"line": 28, "character": 33}},
|
|
"newText": "TestDomain.Bar",
|
|
"insert":
|
|
{"start": {"line": 28, "character": 23},
|
|
"end": {"line": 28, "character": 33}}},
|
|
"label": "TestDomain.Bar",
|
|
"kind": 10,
|
|
"documentation": {"value": "(error) Error 0", "kind": "markdown"},
|
|
"detail": "error name",
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 28, "character": 33}},
|
|
"cPos": 0}}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 30, "character": 34}}
|
|
{"items":
|
|
[{"textEdit":
|
|
{"replace":
|
|
{"start": {"line": 30, "character": 23},
|
|
"end": {"line": 30, "character": 34}},
|
|
"newText": "TestDomain.Bar",
|
|
"insert":
|
|
{"start": {"line": 30, "character": 23},
|
|
"end": {"line": 30, "character": 34}}},
|
|
"label": "TestDomain.Bar",
|
|
"kind": 10,
|
|
"documentation": {"value": "(error) Error 0", "kind": "markdown"},
|
|
"detail": "error name",
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 30, "character": 34}},
|
|
"cPos": 0}},
|
|
{"textEdit":
|
|
{"replace":
|
|
{"start": {"line": 30, "character": 23},
|
|
"end": {"line": 30, "character": 34}},
|
|
"newText": "TestDomain.Foo1",
|
|
"insert":
|
|
{"start": {"line": 30, "character": 23},
|
|
"end": {"line": 30, "character": 34}}},
|
|
"label": "TestDomain.Foo1",
|
|
"kind": 10,
|
|
"documentation": {"value": "(error) Error 1", "kind": "markdown"},
|
|
"detail": "error name",
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 30, "character": 34}},
|
|
"cPos": 0}},
|
|
{"textEdit":
|
|
{"replace":
|
|
{"start": {"line": 30, "character": 23},
|
|
"end": {"line": 30, "character": 34}},
|
|
"newText": "TestDomain.Foo2",
|
|
"insert":
|
|
{"start": {"line": 30, "character": 23},
|
|
"end": {"line": 30, "character": 34}}},
|
|
"label": "TestDomain.Foo2",
|
|
"kind": 10,
|
|
"documentation": {"value": "(error) Error 2", "kind": "markdown"},
|
|
"detail": "error name",
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 30, "character": 34}},
|
|
"cPos": 0}}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 32, "character": 35}}
|
|
{"items":
|
|
[{"textEdit":
|
|
{"replace":
|
|
{"start": {"line": 32, "character": 23},
|
|
"end": {"line": 32, "character": 35}},
|
|
"newText": "TestDomain.Foo1",
|
|
"insert":
|
|
{"start": {"line": 32, "character": 23},
|
|
"end": {"line": 32, "character": 35}}},
|
|
"label": "TestDomain.Foo1",
|
|
"kind": 10,
|
|
"documentation": {"value": "(error) Error 1", "kind": "markdown"},
|
|
"detail": "error name",
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 32, "character": 35}},
|
|
"cPos": 0}},
|
|
{"textEdit":
|
|
{"replace":
|
|
{"start": {"line": 32, "character": 23},
|
|
"end": {"line": 32, "character": 35}},
|
|
"newText": "TestDomain.Foo2",
|
|
"insert":
|
|
{"start": {"line": 32, "character": 23},
|
|
"end": {"line": 32, "character": 35}}},
|
|
"label": "TestDomain.Foo2",
|
|
"kind": 10,
|
|
"documentation": {"value": "(error) Error 2", "kind": "markdown"},
|
|
"detail": "error name",
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 32, "character": 35}},
|
|
"cPos": 0}}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 34, "character": 35}}
|
|
{"items":
|
|
[{"textEdit":
|
|
{"replace":
|
|
{"start": {"line": 34, "character": 23},
|
|
"end": {"line": 34, "character": 35}},
|
|
"newText": "TestDomain.Foo1",
|
|
"insert":
|
|
{"start": {"line": 34, "character": 23},
|
|
"end": {"line": 34, "character": 35}}},
|
|
"label": "TestDomain.Foo1",
|
|
"kind": 10,
|
|
"documentation": {"value": "(error) Error 1", "kind": "markdown"},
|
|
"detail": "error name",
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 34, "character": 35}},
|
|
"cPos": 0}},
|
|
{"textEdit":
|
|
{"replace":
|
|
{"start": {"line": 34, "character": 23},
|
|
"end": {"line": 34, "character": 35}},
|
|
"newText": "TestDomain.Foo2",
|
|
"insert":
|
|
{"start": {"line": 34, "character": 23},
|
|
"end": {"line": 34, "character": 35}}},
|
|
"label": "TestDomain.Foo2",
|
|
"kind": 10,
|
|
"documentation": {"value": "(error) Error 2", "kind": "markdown"},
|
|
"detail": "error name",
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 34, "character": 35}},
|
|
"cPos": 0}}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 37, "character": 34}}
|
|
{"range":
|
|
{"start": {"line": 37, "character": 23}, "end": {"line": 37, "character": 38}},
|
|
"contents": {"value": "(error) Error 2", "kind": "markdown"}}
|
|
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
|
"position": {"line": 39, "character": 34}}
|
|
{"range":
|
|
{"start": {"line": 39, "character": 23}, "end": {"line": 39, "character": 38}},
|
|
"contents": {"value": "(error) Error 2", "kind": "markdown"}}
|