1 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
2 # This test verifies that we can negotiate UTF-8 offsets via protocol extension.
3 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{"offsetEncoding":["utf-8","utf-16"]},"trace":"off"}}
4 # CHECK: "offsetEncoding": "utf-8"
6 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"/*ö*/int x;\nint y=x;"}}}
8 {"jsonrpc":"2.0","id":1,"method":"textDocument/definition","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":1,"character":6}}}
11 # x is character (and utf-16) range [9,10) but byte range [10,11).
13 # CHECK-NEXT: "jsonrpc": "2.0",
14 # CHECK-NEXT: "result": [
16 # CHECK-NEXT: "range": {
17 # CHECK-NEXT: "end": {
18 # CHECK-NEXT: "character": 11,
19 # CHECK-NEXT: "line": 0
21 # CHECK-NEXT: "start": {
22 # CHECK-NEXT: "character": 10,
23 # CHECK-NEXT: "line": 0
26 # CHECK-NEXT: "uri": "file://{{.*}}/main.cpp"
30 {"jsonrpc":"2.0","id":10000,"method":"shutdown"}
32 {"jsonrpc":"2.0","method":"exit"}