This implements a request handler for the `textDocument/rename` LSP request, enabling renames via F2. It handles both local renames (e.g. `let x := 1; x` to `let y := 1; y`) as well as global renames (definitions). Unfortunately it does not work for "orphan" files outside a project, as it uses ilean data for the current file and this does not seem to be saved for orphan files. As a result, the test file does not work, although one can manually test the implementation against a project such as mathlib. (This issue already exists for the "references" request, e.g. ctrl click on the first `x` in `let x := 1; x` takes you to the second one only if you are not in an orphan file.) * Fixes leanprover-community/mathlib4#7124
20 lines
622 B
Text
20 lines
622 B
Text
{"title": "hello world",
|
|
"kind": "quickfix",
|
|
"edit":
|
|
{"documentChanges":
|
|
[{"textDocument": {"version": 1, "uri": "file://codeaction.lean"},
|
|
"edits":
|
|
[{"range":
|
|
{"start": {"line": 30, "character": 4},
|
|
"end": {"line": 30, "character": 4}},
|
|
"newText": "hello!!!"}]}]}}
|
|
{"title": "a long-running action",
|
|
"kind": "refactor",
|
|
"data":
|
|
{"providerResultIndex": 1,
|
|
"providerName": "helloProvider",
|
|
"params":
|
|
{"textDocument": {"uri": "file://codeaction.lean"},
|
|
"range":
|
|
{"start": {"line": 30, "character": 4}, "end": {"line": 30, "character": 4}},
|
|
"context": {"diagnostics": []}}}}
|