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 = i32\n!alias = i32\nfunc.func private @foo(%arg: i32) -> i32 {\n%cast = \"builtin.unrealized_conversion_cast\"() : () -> (!pdl.value)\nreturn %"
11 {"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{
12 "textDocument":{"uri":"test:///foo.mlir"},
13 "position":{"line":2,"character":0}
15 // CHECK-LABEL: "id": 1
16 // CHECK-NEXT: "jsonrpc": "2.0",
17 // CHECK-NEXT: "result": {
18 // CHECK-NEXT: "isIncomplete": false,
19 // CHECK-NEXT: "items": [
21 // CHECK: "detail": "dialect",
22 // CHECK: "insertTextFormat": 1,
24 // CHECK: "label": "builtin",
25 // CHECK: "sortText": "3"
28 // CHECK: "detail": "operation",
29 // CHECK: "insertTextFormat": 1,
31 // CHECK: "label": "module",
32 // CHECK: "sortText": "1"
37 {"jsonrpc":"2.0","id":2,"method":"textDocument/completion","params":{
38 "textDocument":{"uri":"test:///foo.mlir"},
39 "position":{"line":3,"character":9}
41 // CHECK-LABEL: "id": 2
42 // CHECK-NEXT: "jsonrpc": "2.0",
43 // CHECK-NEXT: "result": {
44 // CHECK-NEXT: "isIncomplete": false,
45 // CHECK-NEXT: "items": [
47 // CHECK: "detail": "dialect",
48 // CHECK: "insertTextFormat": 1,
50 // CHECK: "label": "builtin",
51 // CHECK: "sortText": "3"
53 // CHECK-NOT: "detail": "operation",
57 {"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{
58 "textDocument":{"uri":"test:///foo.mlir"},
59 "position":{"line":3,"character":17}
61 // CHECK-LABEL: "id": 3
62 // CHECK-NEXT: "jsonrpc": "2.0",
63 // CHECK-NEXT: "result": {
64 // CHECK-NEXT: "isIncomplete": false,
65 // CHECK-NEXT: "items": [
66 // CHECK-NOT: "detail": "dialect",
68 // CHECK: "detail": "operation",
69 // CHECK: "insertTextFormat": 1,
71 // CHECK: "label": "module",
72 // CHECK: "sortText": "1"
77 {"jsonrpc":"2.0","id":4,"method":"textDocument/completion","params":{
78 "textDocument":{"uri":"test:///foo.mlir"},
79 "position":{"line":4,"character":8}
81 // CHECK-LABEL: "id": 4
82 // CHECK-NEXT: "jsonrpc": "2.0",
83 // CHECK-NEXT: "result": {
84 // CHECK-NEXT: "isIncomplete": false,
85 // CHECK-NEXT: "items": [
87 // CHECK-NEXT: "detail": "arg #0: i32",
88 // CHECK-NEXT: "insertText": "arg",
89 // CHECK-NEXT: "insertTextFormat": 1,
90 // CHECK-NEXT: "kind": 6,
91 // CHECK-NEXT: "label": "%arg"
94 // CHECK-NEXT: "detail": "builtin.unrealized_conversion_cast: !pdl.value",
95 // CHECK-NEXT: "insertText": "cast",
96 // CHECK-NEXT: "insertTextFormat": 1,
97 // CHECK-NEXT: "kind": 6,
98 // CHECK-NEXT: "label": "%cast"
103 {"jsonrpc":"2.0","id":5,"method":"textDocument/completion","params":{
104 "textDocument":{"uri":"test:///foo.mlir"},
105 "position":{"line":2,"character":10}
107 // CHECK-LABEL: "id": 5
108 // CHECK-NEXT: "jsonrpc": "2.0",
109 // CHECK-NEXT: "result": {
110 // CHECK-NEXT: "isIncomplete": false,
111 // CHECK-NEXT: "items": [
113 // CHECK-NEXT: "detail": "optional",
114 // CHECK-NEXT: "insertTextFormat": 1,
115 // CHECK-NEXT: "kind": 14,
116 // CHECK-NEXT: "label": "public",
117 // CHECK-NEXT: "sortText": "0"
120 // CHECK-NEXT: "detail": "optional",
121 // CHECK-NEXT: "insertTextFormat": 1,
122 // CHECK-NEXT: "kind": 14,
123 // CHECK-NEXT: "label": "private",
124 // CHECK-NEXT: "sortText": "0"
127 // CHECK-NEXT: "detail": "optional",
128 // CHECK-NEXT: "insertTextFormat": 1,
129 // CHECK-NEXT: "kind": 14,
130 // CHECK-NEXT: "label": "nested",
131 // CHECK-NEXT: "sortText": "0"
136 {"jsonrpc":"2.0","id":6,"method":"textDocument/completion","params":{
137 "textDocument":{"uri":"test:///foo.mlir"},
138 "position":{"line":0,"character":8}
140 // CHECK-LABEL: "id": 6
141 // CHECK-NEXT: "jsonrpc": "2.0",
142 // CHECK-NEXT: "result": {
143 // CHECK-NEXT: "isIncomplete": false,
144 // CHECK-NEXT: "items": [
146 // CHECK: "insertTextFormat": 1,
148 // CHECK: "label": "false"
151 // CHECK: "insertTextFormat": 1,
153 // CHECK: "label": "loc"
156 // CHECK: "insertTextFormat": 1,
158 // CHECK: "label": "true"
161 // CHECK: "insertTextFormat": 1,
163 // CHECK: "label": "unit"
168 {"jsonrpc":"2.0","id":7,"method":"textDocument/completion","params":{
169 "textDocument":{"uri":"test:///foo.mlir"},
170 "position":{"line":3,"character":56}
172 // CHECK-LABEL: "id": 7
173 // CHECK-NEXT: "jsonrpc": "2.0",
174 // CHECK-NEXT: "result": {
175 // CHECK-NEXT: "isIncomplete": false,
176 // CHECK-NEXT: "items": [
178 // CHECK: "insertTextFormat": 1,
180 // CHECK: "label": "index"
183 // CHECK: "insertTextFormat": 1,
185 // CHECK: "label": "none"
188 // CHECK: "insertText": "i",
189 // CHECK: "insertTextFormat": 1,
191 // CHECK: "label": "i<N>"
196 {"jsonrpc":"2.0","id":8,"method":"textDocument/completion","params":{
197 "textDocument":{"uri":"test:///foo.mlir"},
198 "position":{"line":3,"character":57}
200 // CHECK-LABEL: "id": 8
201 // CHECK-NEXT: "jsonrpc": "2.0",
202 // CHECK-NEXT: "result": {
203 // CHECK-NEXT: "isIncomplete": false,
204 // CHECK-NEXT: "items": [
206 // CHECK: "detail": "dialect",
207 // CHECK: "insertTextFormat": 1,
209 // CHECK: "label": "builtin",
210 // CHECK: "sortText": "3"
213 // CHECK: "detail": "alias: i32",
214 // CHECK: "insertTextFormat": 1,
216 // CHECK: "label": "alias",
217 // CHECK: "sortText": "2"
222 {"jsonrpc":"2.0","id":9,"method":"textDocument/completion","params":{
223 "textDocument":{"uri":"test:///foo.mlir"},
224 "position":{"line":3,"character":61}
226 // CHECK-LABEL: "id": 9
227 // CHECK-NEXT: "jsonrpc": "2.0",
228 // CHECK-NEXT: "result": {
229 // CHECK-NEXT: "isIncomplete": false,
230 // CHECK-NEXT: "items": [
232 // CHECK-NEXT: "insertTextFormat": 1,
233 // CHECK-NEXT: "kind": 14,
234 // CHECK-NEXT: "label": "attribute",
235 // CHECK-NEXT: "sortText": "0"
238 // CHECK-NEXT: "insertTextFormat": 1,
239 // CHECK-NEXT: "kind": 14,
240 // CHECK-NEXT: "label": "operation",
241 // CHECK-NEXT: "sortText": "0"
244 // CHECK-NEXT: "insertTextFormat": 1,
245 // CHECK-NEXT: "kind": 14,
246 // CHECK-NEXT: "label": "range",
247 // CHECK-NEXT: "sortText": "0"
250 // CHECK-NEXT: "insertTextFormat": 1,
251 // CHECK-NEXT: "kind": 14,
252 // CHECK-NEXT: "label": "type",
253 // CHECK-NEXT: "sortText": "0"
256 // CHECK-NEXT: "insertTextFormat": 1,
257 // CHECK-NEXT: "kind": 14,
258 // CHECK-NEXT: "label": "value",
259 // CHECK-NEXT: "sortText": "0"
264 {"jsonrpc":"2.0","id":10,"method":"shutdown"}
266 {"jsonrpc":"2.0","method":"exit"}