forked from OSchip/llvm-project
33 lines
1.3 KiB
Plaintext
33 lines
1.3 KiB
Plaintext
# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
|
|
# This test verifies that we can negotiate UTF-8 offsets via protocol extension.
|
|
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{"offsetEncoding":["utf-8","utf-16"]},"trace":"off"}}
|
|
# CHECK: "offsetEncoding": "utf-8"
|
|
---
|
|
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"/*ö*/int x;\nint y=x;"}}}
|
|
---
|
|
{"jsonrpc":"2.0","id":1,"method":"textDocument/definition","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":1,"character":6}}}
|
|
# /*ö*/int x;
|
|
# 01234567890
|
|
# x is character (and utf-16) range [9,10) but byte range [10,11).
|
|
# CHECK: "id": 1,
|
|
# CHECK-NEXT: "jsonrpc": "2.0",
|
|
# CHECK-NEXT: "result": [
|
|
# CHECK-NEXT: {
|
|
# CHECK-NEXT: "range": {
|
|
# CHECK-NEXT: "end": {
|
|
# CHECK-NEXT: "character": 11,
|
|
# CHECK-NEXT: "line": 0
|
|
# CHECK-NEXT: },
|
|
# CHECK-NEXT: "start": {
|
|
# CHECK-NEXT: "character": 10,
|
|
# CHECK-NEXT: "line": 0
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: },
|
|
# CHECK-NEXT: "uri": "file://{{.*}}/main.cpp"
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: ]
|
|
---
|
|
{"jsonrpc":"2.0","id":10000,"method":"shutdown"}
|
|
---
|
|
{"jsonrpc":"2.0","method":"exit"}
|