1 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
2 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{"textDocument": {"rename": {"dynamicRegistration": true, "prepareSupport": true}}},"trace":"off"}}
3 # CHECK: "renameProvider": {
4 # CHECK-NEXT: "prepareProvider": true
7 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.cpp","languageId":"cpp","version":1,"text":"int foo;"}}}
9 {"jsonrpc":"2.0","id":1,"method":"textDocument/prepareRename","params":{"textDocument":{"uri":"test:///foo.cpp"},"position":{"line":0,"character":5}}}
11 # CHECK-NEXT: "jsonrpc": "2.0",
12 # CHECK-NEXT: "result": {
13 # CHECK-NEXT: "end": {
14 # CHECK-NEXT: "character": 7,
15 # CHECK-NEXT: "line": 0
17 # CHECK-NEXT: "start": {
18 # CHECK-NEXT: "character": 4,
19 # CHECK-NEXT: "line": 0
23 {"jsonrpc":"2.0","id":2,"method":"textDocument/prepareRename","params":{"textDocument":{"uri":"test:///foo.cpp"},"position":{"line":0,"character":2}}}
25 # CHECK-NEXT: "code": -32001,
26 # CHECK-NEXT: "message": "Cannot rename symbol: there is no symbol at the given location"
28 # CHECK-NEXT: "id": 2,
29 # CHECK-NEXT: "jsonrpc": "2.0"
31 {"jsonrpc":"2.0","id":4,"method":"textDocument/rename","params":{"textDocument":{"uri":"test:///foo.cpp"},"position":{"line":0,"character":2},"newName":"bar"}}
33 # CHECK-NEXT: "code": -32001,
34 # CHECK-NEXT: "message": "Cannot rename symbol: there is no symbol at the given location"
36 # CHECK-NEXT: "id": 4,
37 # CHECK-NEXT: "jsonrpc": "2.0"
39 {"jsonrpc":"2.0","id":3,"method":"textDocument/rename","params":{"textDocument":{"uri":"test:///foo.cpp"},"position":{"line":0,"character":5},"newName":"bar"}}
41 # CHECK-NEXT: "jsonrpc": "2.0",
42 # CHECK-NEXT: "result": {
43 # CHECK-NEXT: "changes": {
44 # CHECK-NEXT: "file://{{.*}}/foo.cpp": [
46 # CHECK-NEXT: "newText": "bar",
47 # CHECK-NEXT: "range": {
48 # CHECK-NEXT: "end": {
49 # CHECK-NEXT: "character": 7
50 # CHECK-NEXT: "line": 0
52 # CHECK-NEXT: "start": {
53 # CHECK-NEXT: "character": 4
54 # CHECK-NEXT: "line": 0
62 {"jsonrpc":"2.0","id":5,"method":"shutdown"}
64 {"jsonrpc":"2.0","method":"exit"}