forked from OSchip/llvm-project
182 lines
5.8 KiB
Plaintext
182 lines
5.8 KiB
Plaintext
// RUN: mlir-pdll-lsp-server -pdll-extra-dir %S -pdll-extra-dir %S/../../include -lit-test < %s | FileCheck %s
|
|
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"pdll","capabilities":{},"trace":"off"}}
|
|
// -----
|
|
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{
|
|
"uri":"test:///foo.pdll",
|
|
"languageId":"pdll",
|
|
"version":1,
|
|
"text":"Constraint FooCst();\nRewrite FooRewrite(op: Op) -> Op;\nPattern Foo {\nlet root: Op;\nerase root;\n}\n#include \"include/included.td\"\n#include \"include/included.pdll\""
|
|
}}}
|
|
// -----
|
|
// Hover on a variable.
|
|
{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
|
|
"textDocument":{"uri":"test:///foo.pdll"},
|
|
"position":{"line":3,"character":6}
|
|
}}
|
|
// CHECK: "id": 1,
|
|
// CHECK-NEXT: "jsonrpc": "2.0",
|
|
// CHECK-NEXT: "result": {
|
|
// CHECK-NEXT: "contents": {
|
|
// CHECK-NEXT: "kind": "markdown",
|
|
// CHECK-NEXT: "value": "**Variable**: `root`\n***\nType: `Op`\n"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "end": {
|
|
// CHECK-NEXT: "character": 8,
|
|
// CHECK-NEXT: "line": 3
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "start": {
|
|
// CHECK-NEXT: "character": 4,
|
|
// CHECK-NEXT: "line": 3
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// -----
|
|
// Hover on a pattern.
|
|
{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
|
|
"textDocument":{"uri":"test:///foo.pdll"},
|
|
"position":{"line":2,"character":9}
|
|
}}
|
|
// CHECK: "id": 1,
|
|
// CHECK-NEXT: "jsonrpc": "2.0",
|
|
// CHECK-NEXT: "result": {
|
|
// CHECK-NEXT: "contents": {
|
|
// CHECK-NEXT: "kind": "markdown",
|
|
// CHECK-NEXT: "value": "**Pattern**: `Foo`\n***\nRootOp: `Op`\n"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "end": {
|
|
// CHECK-NEXT: "character": 11,
|
|
// CHECK-NEXT: "line": 2
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "start": {
|
|
// CHECK-NEXT: "character": 8,
|
|
// CHECK-NEXT: "line": 2
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// -----
|
|
// Hover on a core constraint.
|
|
{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
|
|
"textDocument":{"uri":"test:///foo.pdll"},
|
|
"position":{"line":3,"character":11}
|
|
}}
|
|
// CHECK: "id": 1,
|
|
// CHECK-NEXT: "jsonrpc": "2.0",
|
|
// CHECK-NEXT: "result": {
|
|
// CHECK-NEXT: "contents": {
|
|
// CHECK-NEXT: "kind": "markdown",
|
|
// CHECK-NEXT: "value": "**Constraint**: `Op`\n"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "end": {
|
|
// CHECK-NEXT: "character": 12,
|
|
// CHECK-NEXT: "line": 3
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "start": {
|
|
// CHECK-NEXT: "character": 10,
|
|
// CHECK-NEXT: "line": 3
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// -----
|
|
// Hover on a user constraint.
|
|
{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
|
|
"textDocument":{"uri":"test:///foo.pdll"},
|
|
"position":{"line":0,"character":14}
|
|
}}
|
|
// CHECK: "id": 1,
|
|
// CHECK-NEXT: "jsonrpc": "2.0",
|
|
// CHECK-NEXT: "result": {
|
|
// CHECK-NEXT: "contents": {
|
|
// CHECK-NEXT: "kind": "markdown",
|
|
// CHECK-NEXT: "value": "**Constraint**: `FooCst`\n***\n"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "end": {
|
|
// CHECK-NEXT: "character": 17,
|
|
// CHECK-NEXT: "line": 0
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "start": {
|
|
// CHECK-NEXT: "character": 11,
|
|
// CHECK-NEXT: "line": 0
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// -----
|
|
// Hover on a user rewrite.
|
|
{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
|
|
"textDocument":{"uri":"test:///foo.pdll"},
|
|
"position":{"line":1,"character":11}
|
|
}}
|
|
// CHECK: "id": 1,
|
|
// CHECK-NEXT: "jsonrpc": "2.0",
|
|
// CHECK-NEXT: "result": {
|
|
// CHECK-NEXT: "contents": {
|
|
// CHECK-NEXT: "kind": "markdown",
|
|
// CHECK-NEXT: "value": "**Rewrite**: `FooRewrite`\n***\nParameters:\n* op: `Op`\n***\nResults:\n* `Op`\n***\n"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "end": {
|
|
// CHECK-NEXT: "character": 18,
|
|
// CHECK-NEXT: "line": 1
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "start": {
|
|
// CHECK-NEXT: "character": 8,
|
|
// CHECK-NEXT: "line": 1
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// -----
|
|
// Hover on an include file.
|
|
{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
|
|
"textDocument":{"uri":"test:///foo.pdll"},
|
|
"position":{"line":6,"character":15}
|
|
}}
|
|
// CHECK: "id": 1,
|
|
// CHECK-NEXT: "jsonrpc": "2.0",
|
|
// CHECK-NEXT: "result": {
|
|
// CHECK-NEXT: "contents": {
|
|
// CHECK-NEXT: "kind": "markdown",
|
|
// CHECK-NEXT: "value": "`included.td`\n***\n{{.*}}included.td"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "end": {
|
|
// CHECK-NEXT: "character": 30,
|
|
// CHECK-NEXT: "line": 6
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "start": {
|
|
// CHECK-NEXT: "character": 9,
|
|
// CHECK-NEXT: "line": 6
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// -----
|
|
// Hover on an include file.
|
|
{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{
|
|
"textDocument":{"uri":"test:///foo.pdll"},
|
|
"position":{"line":7,"character":15}
|
|
}}
|
|
// CHECK: "id": 1,
|
|
// CHECK-NEXT: "jsonrpc": "2.0",
|
|
// CHECK-NEXT: "result": {
|
|
// CHECK-NEXT: "contents": {
|
|
// CHECK-NEXT: "kind": "markdown",
|
|
// CHECK-NEXT: "value": "`included.pdll`\n***\n{{.*}}included.pdll"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "end": {
|
|
// CHECK-NEXT: "character": 32,
|
|
// CHECK-NEXT: "line": 7
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "start": {
|
|
// CHECK-NEXT: "character": 9,
|
|
// CHECK-NEXT: "line": 7
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// -----
|
|
{"jsonrpc":"2.0","id":7,"method":"shutdown"}
|
|
// -----
|
|
{"jsonrpc":"2.0","method":"exit"}
|