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":"#attr = 1 : index\n!type = index\nfunc.func @foo(%arg0: !type) -> i1 attributes {attr = #attr} {\n%value = arith.constant true\n%result = call @foo(%arg0) : (!type) -> i1\nreturn %value : i1 loc(#loc)\n}\n#loc = loc(\"foo.mlir\":1:2)"
11 {"jsonrpc":"2.0","id":1,"method":"textDocument/references","params":{
12 "textDocument":{"uri":"test:///foo.mlir"},
13 "position":{"line":3,"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": 3
25 // CHECK-NEXT: "start": {
26 // CHECK-NEXT: "character": 0,
27 // CHECK-NEXT: "line": 3
30 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
33 // CHECK-NEXT: "range": {
34 // CHECK-NEXT: "end": {
35 // CHECK-NEXT: "character": 13,
36 // CHECK-NEXT: "line": 5
38 // CHECK-NEXT: "start": {
39 // CHECK-NEXT: "character": 7,
40 // CHECK-NEXT: "line": 5
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":2,"character":12},
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": 14,
59 // CHECK-NEXT: "line": 2
61 // CHECK-NEXT: "start": {
62 // CHECK-NEXT: "character": 10,
63 // CHECK-NEXT: "line": 2
66 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
69 // CHECK-NEXT: "range": {
70 // CHECK-NEXT: "end": {
71 // CHECK-NEXT: "character": 19,
72 // CHECK-NEXT: "line": 4
74 // CHECK-NEXT: "start": {
75 // CHECK-NEXT: "character": 15,
76 // CHECK-NEXT: "line": 4
79 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
83 {"jsonrpc":"2.0","id":2,"method":"textDocument/references","params":{
84 "textDocument":{"uri":"test:///foo.mlir"},
85 "position":{"line":0,"character":3},
86 "context":{"includeDeclaration": false}
89 // CHECK-NEXT: "jsonrpc": "2.0",
90 // CHECK-NEXT: "result": [
92 // CHECK-NEXT: "range": {
93 // CHECK-NEXT: "end": {
94 // CHECK-NEXT: "character": 5,
95 // CHECK-NEXT: "line": 0
97 // CHECK-NEXT: "start": {
98 // CHECK-NEXT: "character": 0,
99 // CHECK-NEXT: "line": 0
102 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
105 // CHECK-NEXT: "range": {
106 // CHECK-NEXT: "end": {
107 // CHECK-NEXT: "character": 59,
108 // CHECK-NEXT: "line": 2
110 // CHECK-NEXT: "start": {
111 // CHECK-NEXT: "character": 54,
112 // CHECK-NEXT: "line": 2
115 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
119 {"jsonrpc":"2.0","id":2,"method":"textDocument/references","params":{
120 "textDocument":{"uri":"test:///foo.mlir"},
121 "position":{"line":1,"character":3},
122 "context":{"includeDeclaration": false}
125 // CHECK-NEXT: "jsonrpc": "2.0",
126 // CHECK-NEXT: "result": [
128 // CHECK-NEXT: "range": {
129 // CHECK-NEXT: "end": {
130 // CHECK-NEXT: "character": 5,
131 // CHECK-NEXT: "line": 1
133 // CHECK-NEXT: "start": {
134 // CHECK-NEXT: "character": 0,
135 // CHECK-NEXT: "line": 1
138 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
141 // CHECK-NEXT: "range": {
142 // CHECK-NEXT: "end": {
143 // CHECK-NEXT: "character": 27,
144 // CHECK-NEXT: "line": 2
146 // CHECK-NEXT: "start": {
147 // CHECK-NEXT: "character": 22,
148 // CHECK-NEXT: "line": 2
151 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
154 // CHECK-NEXT: "range": {
155 // CHECK-NEXT: "end": {
156 // CHECK-NEXT: "character": 35,
157 // CHECK-NEXT: "line": 4
159 // CHECK-NEXT: "start": {
160 // CHECK-NEXT: "character": 30,
161 // CHECK-NEXT: "line": 4
164 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
168 {"jsonrpc":"2.0","id":2,"method":"textDocument/references","params":{
169 "textDocument":{"uri":"test:///foo.mlir"},
170 "position":{"line":7,"character":3},
171 "context":{"includeDeclaration": false}
174 // CHECK-NEXT: "jsonrpc": "2.0",
175 // CHECK-NEXT: "result": [
177 // CHECK-NEXT: "range": {
178 // CHECK-NEXT: "end": {
179 // CHECK-NEXT: "character": 4,
180 // CHECK-NEXT: "line": 7
182 // CHECK-NEXT: "start": {
183 // CHECK-NEXT: "character": 0,
184 // CHECK-NEXT: "line": 7
187 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
190 // CHECK-NEXT: "range": {
191 // CHECK-NEXT: "end": {
192 // CHECK-NEXT: "character": 27,
193 // CHECK-NEXT: "line": 5
195 // CHECK-NEXT: "start": {
196 // CHECK-NEXT: "character": 23,
197 // CHECK-NEXT: "line": 5
200 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
204 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
206 {"jsonrpc":"2.0","method":"exit"}