1 // RUN: mlir-pdll-lsp-server -pdll-extra-dir %S -pdll-extra-dir %S/../../include -lit-test < %s | FileCheck %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":"Constraint FooCst();\n// This is documentation for the rewriter.\n/// And even more docs.\nRewrite FooRewrite(op: Op) -> Op;\nPattern Foo {\nlet root: Op;\nerase root;\n}\n#include \"include/included.td\"\n#include \"include/included.pdll\""
11 // Hover on a variable.
12 {"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
13 "textDocument":{"uri":"test:///foo.pdll"},
14 "position":{"line":5,"character":6}
17 // CHECK-NEXT: "jsonrpc": "2.0",
18 // CHECK-NEXT: "result": {
19 // CHECK-NEXT: "contents": {
20 // CHECK-NEXT: "kind": "markdown",
21 // CHECK-NEXT: "value": "**Variable**: `root`\n***\nType: `Op`\n"
23 // CHECK-NEXT: "range": {
24 // CHECK-NEXT: "end": {
25 // CHECK-NEXT: "character": 8,
26 // CHECK-NEXT: "line": 5
28 // CHECK-NEXT: "start": {
29 // CHECK-NEXT: "character": 4,
30 // CHECK-NEXT: "line": 5
35 // Hover on a pattern.
36 {"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
37 "textDocument":{"uri":"test:///foo.pdll"},
38 "position":{"line":4,"character":9}
41 // CHECK-NEXT: "jsonrpc": "2.0",
42 // CHECK-NEXT: "result": {
43 // CHECK-NEXT: "contents": {
44 // CHECK-NEXT: "kind": "markdown",
45 // CHECK-NEXT: "value": "**Pattern**: `Foo`\n***\nRootOp: `Op`\n"
47 // CHECK-NEXT: "range": {
48 // CHECK-NEXT: "end": {
49 // CHECK-NEXT: "character": 11,
50 // CHECK-NEXT: "line": 4
52 // CHECK-NEXT: "start": {
53 // CHECK-NEXT: "character": 8,
54 // CHECK-NEXT: "line": 4
59 // Hover on a core constraint.
60 {"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
61 "textDocument":{"uri":"test:///foo.pdll"},
62 "position":{"line":5,"character":11}
65 // CHECK-NEXT: "jsonrpc": "2.0",
66 // CHECK-NEXT: "result": {
67 // CHECK-NEXT: "contents": {
68 // CHECK-NEXT: "kind": "markdown",
69 // CHECK-NEXT: "value": "**Constraint**: `Op`\n"
71 // CHECK-NEXT: "range": {
72 // CHECK-NEXT: "end": {
73 // CHECK-NEXT: "character": 12,
74 // CHECK-NEXT: "line": 5
76 // CHECK-NEXT: "start": {
77 // CHECK-NEXT: "character": 10,
78 // CHECK-NEXT: "line": 5
83 // Hover on a user constraint.
84 {"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
85 "textDocument":{"uri":"test:///foo.pdll"},
86 "position":{"line":0,"character":14}
89 // CHECK-NEXT: "jsonrpc": "2.0",
90 // CHECK-NEXT: "result": {
91 // CHECK-NEXT: "contents": {
92 // CHECK-NEXT: "kind": "markdown",
93 // CHECK-NEXT: "value": "**Constraint**: `FooCst`\n***\n"
95 // CHECK-NEXT: "range": {
96 // CHECK-NEXT: "end": {
97 // CHECK-NEXT: "character": 17,
98 // CHECK-NEXT: "line": 0
100 // CHECK-NEXT: "start": {
101 // CHECK-NEXT: "character": 11,
102 // CHECK-NEXT: "line": 0
107 // Hover on a user rewrite.
108 {"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
109 "textDocument":{"uri":"test:///foo.pdll"},
110 "position":{"line":3,"character":11}
113 // CHECK-NEXT: "jsonrpc": "2.0",
114 // CHECK-NEXT: "result": {
115 // CHECK-NEXT: "contents": {
116 // CHECK-NEXT: "kind": "markdown",
117 // CHECK-NEXT: "value": "**Rewrite**: `FooRewrite`\n***\nParameters:\n* op: `Op`\n***\nResults:\n* `Op`\n***\n\n This is documentation for the rewriter.\n And even more docs.\n"
119 // CHECK-NEXT: "range": {
120 // CHECK-NEXT: "end": {
121 // CHECK-NEXT: "character": 18,
122 // CHECK-NEXT: "line": 3
124 // CHECK-NEXT: "start": {
125 // CHECK-NEXT: "character": 8,
126 // CHECK-NEXT: "line": 3
131 // Hover on an include file.
132 {"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
133 "textDocument":{"uri":"test:///foo.pdll"},
134 "position":{"line":8,"character":15}
137 // CHECK-NEXT: "jsonrpc": "2.0",
138 // CHECK-NEXT: "result": {
139 // CHECK-NEXT: "contents": {
140 // CHECK-NEXT: "kind": "markdown",
141 // CHECK-NEXT: "value": "`included.td`\n***\n{{.*}}included.td"
143 // CHECK-NEXT: "range": {
144 // CHECK-NEXT: "end": {
145 // CHECK-NEXT: "character": 30,
146 // CHECK-NEXT: "line": 8
148 // CHECK-NEXT: "start": {
149 // CHECK-NEXT: "character": 9,
150 // CHECK-NEXT: "line": 8
155 // Hover on an include file.
156 {"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
157 "textDocument":{"uri":"test:///foo.pdll"},
158 "position":{"line":9,"character":15}
161 // CHECK-NEXT: "jsonrpc": "2.0",
162 // CHECK-NEXT: "result": {
163 // CHECK-NEXT: "contents": {
164 // CHECK-NEXT: "kind": "markdown",
165 // CHECK-NEXT: "value": "`included.pdll`\n***\n{{.*}}included.pdll"
167 // CHECK-NEXT: "range": {
168 // CHECK-NEXT: "end": {
169 // CHECK-NEXT: "character": 32,
170 // CHECK-NEXT: "line": 9
172 // CHECK-NEXT: "start": {
173 // CHECK-NEXT: "character": 9,
174 // CHECK-NEXT: "line": 9
179 {"jsonrpc":"2.0","id":7,"method":"shutdown"}
181 {"jsonrpc":"2.0","method":"exit"}