1 // RUN: mlir-pdll-lsp-server -pdll-extra-dir %S -pdll-extra-dir %S/../../include -lit-test < %s | FileCheck -strict-whitespace %s
2 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"pdll","capabilities":{},"trace":"off"}}
4 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{
5 "uri":"test:///foo.pdll",
8 "text":"#include \"include/included.pdll\"\nConstraint ValueCst(value: Value);\nConstraint Cst();\nPattern FooPattern with benefit(1) {\nlet tuple = (value1 = _: Op, _: Op<test.op>);\nerase tuple.value1;\n}"
11 {"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{
12 "textDocument":{"uri":"test:///foo.pdll"},
13 "position":{"line":5,"character":12}
16 // CHECK-NEXT: "jsonrpc": "2.0",
17 // CHECK-NEXT: "result": {
18 // CHECK-NEXT: "isIncomplete": false,
19 // CHECK-NEXT: "items": [
21 // CHECK-NEXT: "detail": "0: Op",
22 // CHECK-NEXT: "filterText": "0",
23 // CHECK-NEXT: "insertText": "0",
24 // CHECK-NEXT: "insertTextFormat": 1,
25 // CHECK-NEXT: "kind": 5,
26 // CHECK-NEXT: "label": "0 (field #0)",
27 // CHECK-NEXT: "sortText": "0"
30 // CHECK-NEXT: "detail": "0: Op",
31 // CHECK-NEXT: "filterText": "value1 (field #0)",
32 // CHECK-NEXT: "insertText": "value1",
33 // CHECK-NEXT: "insertTextFormat": 1,
34 // CHECK-NEXT: "kind": 5,
35 // CHECK-NEXT: "label": "value1 (field #0)",
36 // CHECK-NEXT: "sortText": "0"
39 // CHECK-NEXT: "detail": "1: Op<test.op>",
40 // CHECK-NEXT: "filterText": "1",
41 // CHECK-NEXT: "insertText": "1",
42 // CHECK-NEXT: "insertTextFormat": 1,
43 // CHECK-NEXT: "kind": 5,
44 // CHECK-NEXT: "label": "1 (field #1)",
45 // CHECK-NEXT: "sortText": "1"
50 {"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{
51 "textDocument":{"uri":"test:///foo.pdll"},
52 "position":{"line":3,"character":23}
55 // CHECK-NEXT: "jsonrpc": "2.0",
56 // CHECK-NEXT: "result": {
57 // CHECK-NEXT: "isIncomplete": false,
58 // CHECK-NEXT: "items": [
60 // CHECK-NEXT: "detail": "pattern metadata",
61 // CHECK-NEXT: "documentation": {
62 // CHECK-NEXT: "kind": "markdown",
63 // CHECK-NEXT: "value": "The `benefit` of matching the pattern."
65 // CHECK-NEXT: "insertText": "benefit($1)",
66 // CHECK-NEXT: "insertTextFormat": 2,
67 // CHECK-NEXT: "kind": 7,
68 // CHECK-NEXT: "label": "benefit"
71 // CHECK-NEXT: "detail": "pattern metadata",
72 // CHECK-NEXT: "documentation": {
73 // CHECK-NEXT: "kind": "markdown",
74 // CHECK-NEXT: "value": "The pattern properly handles recursive application."
76 // CHECK-NEXT: "insertTextFormat": 1,
77 // CHECK-NEXT: "kind": 7,
78 // CHECK-NEXT: "label": "recursion"
83 {"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{
84 "textDocument":{"uri":"test:///foo.pdll"},
85 "position":{"line":4,"character":24}
88 // CHECK-NEXT: "jsonrpc": "2.0",
89 // CHECK-NEXT: "result": {
90 // CHECK-NEXT: "isIncomplete": false,
91 // CHECK-NEXT: "items": [
93 // CHECK-NEXT: "detail": "Attr constraint",
94 // CHECK-NEXT: "documentation": {
95 // CHECK-NEXT: "kind": "markdown",
96 // CHECK-NEXT: "value": "A single entity core constraint of type `mlir::Attribute`"
98 // CHECK-NEXT: "insertTextFormat": 1,
99 // CHECK-NEXT: "kind": 7,
100 // CHECK-NEXT: "label": "Attr",
101 // CHECK-NEXT: "sortText": "0"
104 // CHECK-NEXT: "detail": "Op constraint",
105 // CHECK-NEXT: "documentation": {
106 // CHECK-NEXT: "kind": "markdown",
107 // CHECK-NEXT: "value": "A single entity core constraint of type `mlir::Operation *`"
109 // CHECK-NEXT: "insertTextFormat": 1,
110 // CHECK-NEXT: "kind": 7,
111 // CHECK-NEXT: "label": "Op",
112 // CHECK-NEXT: "sortText": "0"
115 // CHECK-NEXT: "detail": "Value constraint",
116 // CHECK-NEXT: "documentation": {
117 // CHECK-NEXT: "kind": "markdown",
118 // CHECK-NEXT: "value": "A single entity core constraint of type `mlir::Value`"
120 // CHECK-NEXT: "insertTextFormat": 1,
121 // CHECK-NEXT: "kind": 7,
122 // CHECK-NEXT: "label": "Value",
123 // CHECK-NEXT: "sortText": "0"
126 // CHECK-NEXT: "detail": "ValueRange constraint",
127 // CHECK-NEXT: "documentation": {
128 // CHECK-NEXT: "kind": "markdown",
129 // CHECK-NEXT: "value": "A single entity core constraint of type `mlir::ValueRange`"
131 // CHECK-NEXT: "insertTextFormat": 1,
132 // CHECK-NEXT: "kind": 7,
133 // CHECK-NEXT: "label": "ValueRange",
134 // CHECK-NEXT: "sortText": "0"
137 // CHECK-NEXT: "detail": "Type constraint",
138 // CHECK-NEXT: "documentation": {
139 // CHECK-NEXT: "kind": "markdown",
140 // CHECK-NEXT: "value": "A single entity core constraint of type `mlir::Type`"
142 // CHECK-NEXT: "insertTextFormat": 1,
143 // CHECK-NEXT: "kind": 7,
144 // CHECK-NEXT: "label": "Type",
145 // CHECK-NEXT: "sortText": "0"
148 // CHECK-NEXT: "detail": "TypeRange constraint",
149 // CHECK-NEXT: "documentation": {
150 // CHECK-NEXT: "kind": "markdown",
151 // CHECK-NEXT: "value": "A single entity core constraint of type `mlir::TypeRange`"
153 // CHECK-NEXT: "insertTextFormat": 1,
154 // CHECK-NEXT: "kind": 7,
155 // CHECK-NEXT: "label": "TypeRange",
156 // CHECK-NEXT: "sortText": "0"
159 // CHECK-NEXT: "detail": "Attr<type> constraint",
160 // CHECK-NEXT: "documentation": {
161 // CHECK-NEXT: "kind": "markdown",
162 // CHECK-NEXT: "value": "A single entity core constraint of type `mlir::Attribute`"
164 // CHECK-NEXT: "insertText": "Attr<$1>",
165 // CHECK-NEXT: "insertTextFormat": 2,
166 // CHECK-NEXT: "kind": 7,
167 // CHECK-NEXT: "label": "Attr<type>",
168 // CHECK-NEXT: "sortText": "0"
171 // CHECK-NEXT: "detail": "Value<type> constraint",
172 // CHECK-NEXT: "documentation": {
173 // CHECK-NEXT: "kind": "markdown",
174 // CHECK-NEXT: "value": "A single entity core constraint of type `mlir::Value`"
176 // CHECK-NEXT: "insertText": "Value<$1>",
177 // CHECK-NEXT: "insertTextFormat": 2,
178 // CHECK-NEXT: "kind": 7,
179 // CHECK-NEXT: "label": "Value<type>",
180 // CHECK-NEXT: "sortText": "0"
183 // CHECK-NEXT: "detail": "ValueRange<type> constraint",
184 // CHECK-NEXT: "documentation": {
185 // CHECK-NEXT: "kind": "markdown",
186 // CHECK-NEXT: "value": "A single entity core constraint of type `mlir::ValueRange`"
188 // CHECK-NEXT: "insertText": "ValueRange<$1>",
189 // CHECK-NEXT: "insertTextFormat": 2,
190 // CHECK-NEXT: "kind": 7,
191 // CHECK-NEXT: "label": "ValueRange<type>",
192 // CHECK-NEXT: "sortText": "0"
195 // CHECK-NEXT: "detail": "(value: Value) -> Tuple<>",
196 // CHECK-NEXT: "kind": 8,
197 // CHECK-NEXT: "label": "ValueCst",
198 // CHECK-NEXT: "sortText": "2_ValueCst"
203 {"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{
204 "textDocument":{"uri":"test:///foo.pdll"},
205 "position":{"line":0,"character":18}
208 // CHECK-NEXT: "jsonrpc": "2.0",
209 // CHECK-NEXT: "result": {
210 // CHECK-NEXT: "isIncomplete": false,
211 // CHECK-NEXT: "items": [
213 // CHECK-NEXT: "kind": 17,
214 // CHECK-NEXT: "label": "included.pdll"
217 // CHECK-NEXT: "kind": 17,
218 // CHECK-NEXT: "label": "included.td"
223 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
225 {"jsonrpc":"2.0","method":"exit"}