Fix GCC build problem with 288f05f related to SmallVector. (#116958)
[llvm-project.git] / mlir / test / mlir-pdll-lsp-server / hover.test
blob22673fed2bd9fc6a51bf59d281d6f863d4c29255
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"}}
3 // -----
4 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{
5   "uri":"test:///foo.pdll",
6   "languageId":"pdll",
7   "version":1,
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\""
9 }}}
10 // -----
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}
16 //      CHECK:  "id": 1,
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"
22 // CHECK-NEXT:    },
23 // CHECK-NEXT:    "range": {
24 // CHECK-NEXT:      "end": {
25 // CHECK-NEXT:        "character": 8,
26 // CHECK-NEXT:        "line": 5
27 // CHECK-NEXT:      },
28 // CHECK-NEXT:      "start": {
29 // CHECK-NEXT:        "character": 4,
30 // CHECK-NEXT:        "line": 5
31 // CHECK-NEXT:      }
32 // CHECK-NEXT:    }
33 // CHECK-NEXT:  }
34 // -----
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}
40 //      CHECK:  "id": 1,
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"
46 // CHECK-NEXT:    },
47 // CHECK-NEXT:    "range": {
48 // CHECK-NEXT:      "end": {
49 // CHECK-NEXT:        "character": 11,
50 // CHECK-NEXT:        "line": 4
51 // CHECK-NEXT:      },
52 // CHECK-NEXT:      "start": {
53 // CHECK-NEXT:        "character": 8,
54 // CHECK-NEXT:        "line": 4
55 // CHECK-NEXT:      }
56 // CHECK-NEXT:    }
57 // CHECK-NEXT:  }
58 // -----
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}
64 //      CHECK:  "id": 1,
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"
70 // CHECK-NEXT:    },
71 // CHECK-NEXT:    "range": {
72 // CHECK-NEXT:      "end": {
73 // CHECK-NEXT:        "character": 12,
74 // CHECK-NEXT:        "line": 5
75 // CHECK-NEXT:      },
76 // CHECK-NEXT:      "start": {
77 // CHECK-NEXT:        "character": 10,
78 // CHECK-NEXT:        "line": 5
79 // CHECK-NEXT:      }
80 // CHECK-NEXT:    }
81 // CHECK-NEXT:  }
82 // -----
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}
88 //      CHECK:  "id": 1,
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"
94 // CHECK-NEXT:    },
95 // CHECK-NEXT:    "range": {
96 // CHECK-NEXT:      "end": {
97 // CHECK-NEXT:        "character": 17,
98 // CHECK-NEXT:        "line": 0
99 // CHECK-NEXT:      },
100 // CHECK-NEXT:      "start": {
101 // CHECK-NEXT:        "character": 11,
102 // CHECK-NEXT:        "line": 0
103 // CHECK-NEXT:      }
104 // CHECK-NEXT:    }
105 // CHECK-NEXT:  }
106 // -----
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}
112 //      CHECK:  "id": 1,
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"
118 // CHECK-NEXT:    },
119 // CHECK-NEXT:    "range": {
120 // CHECK-NEXT:      "end": {
121 // CHECK-NEXT:        "character": 18,
122 // CHECK-NEXT:        "line": 3
123 // CHECK-NEXT:      },
124 // CHECK-NEXT:      "start": {
125 // CHECK-NEXT:        "character": 8,
126 // CHECK-NEXT:        "line": 3
127 // CHECK-NEXT:      }
128 // CHECK-NEXT:    }
129 // CHECK-NEXT:  }
130 // -----
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}
136 //      CHECK:  "id": 1,
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"
142 // CHECK-NEXT:    },
143 // CHECK-NEXT:    "range": {
144 // CHECK-NEXT:      "end": {
145 // CHECK-NEXT:        "character": 30,
146 // CHECK-NEXT:        "line": 8
147 // CHECK-NEXT:      },
148 // CHECK-NEXT:      "start": {
149 // CHECK-NEXT:        "character": 9,
150 // CHECK-NEXT:        "line": 8
151 // CHECK-NEXT:      }
152 // CHECK-NEXT:    }
153 // CHECK-NEXT:  }
154 // -----
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}
160 //      CHECK:  "id": 1,
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"
166 // CHECK-NEXT:    },
167 // CHECK-NEXT:    "range": {
168 // CHECK-NEXT:      "end": {
169 // CHECK-NEXT:        "character": 32,
170 // CHECK-NEXT:        "line": 9
171 // CHECK-NEXT:      },
172 // CHECK-NEXT:      "start": {
173 // CHECK-NEXT:        "character": 9,
174 // CHECK-NEXT:        "line": 9
175 // CHECK-NEXT:      }
176 // CHECK-NEXT:    }
177 // CHECK-NEXT:  }
178 // -----
179 {"jsonrpc":"2.0","id":7,"method":"shutdown"}
180 // -----
181 {"jsonrpc":"2.0","method":"exit"}