1 // RUN: mlir-lsp-server -lit-test < %s | FileCheck -strict-whitespace %s
2 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"mlir","capabilities":{},"trace":"off"}}
4 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{
5 "uri":"test:///foo.mlir",
8 "text":"func @foo() -> i1 {\n%value = arith.constant true\n%result = call @foo() : () -> i1\nreturn %value : i1\n}"
11 {"jsonrpc":"2.0","id":1,"method":"textDocument/references","params":{
12 "textDocument":{"uri":"test:///foo.mlir"},
13 "position":{"line":1,"character":2},
14 "context":{"includeDeclaration": false}
17 // CHECK-NEXT: "jsonrpc": "2.0",
18 // CHECK-NEXT: "result": [
20 // CHECK-NEXT: "range": {
21 // CHECK-NEXT: "end": {
22 // CHECK-NEXT: "character": 6,
23 // CHECK-NEXT: "line": 1
25 // CHECK-NEXT: "start": {
26 // CHECK-NEXT: "character": 0,
27 // CHECK-NEXT: "line": 1
30 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
33 // CHECK-NEXT: "range": {
34 // CHECK-NEXT: "end": {
35 // CHECK-NEXT: "character": 13,
36 // CHECK-NEXT: "line": 3
38 // CHECK-NEXT: "start": {
39 // CHECK-NEXT: "character": 7,
40 // CHECK-NEXT: "line": 3
43 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
47 {"jsonrpc":"2.0","id":2,"method":"textDocument/references","params":{
48 "textDocument":{"uri":"test:///foo.mlir"},
49 "position":{"line":0,"character":7},
50 "context":{"includeDeclaration": false}
53 // CHECK-NEXT: "jsonrpc": "2.0",
54 // CHECK-NEXT: "result": [
56 // CHECK-NEXT: "range": {
57 // CHECK-NEXT: "end": {
58 // CHECK-NEXT: "character": 9,
59 // CHECK-NEXT: "line": 0
61 // CHECK-NEXT: "start": {
62 // CHECK-NEXT: "character": 5,
63 // CHECK-NEXT: "line": 0
66 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
69 // CHECK-NEXT: "range": {
70 // CHECK-NEXT: "end": {
71 // CHECK-NEXT: "character": 19,
72 // CHECK-NEXT: "line": 2
74 // CHECK-NEXT: "start": {
75 // CHECK-NEXT: "character": 15,
76 // CHECK-NEXT: "line": 2
79 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
83 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
85 {"jsonrpc":"2.0","method":"exit"}