// RUN: mlir-pdll-lsp-server -pdll-extra-dir %S -pdll-extra-dir %S/../../include -lit-test < %s | FileCheck -strict-whitespace %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":"#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}"
}}}
// -----
{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{
"textDocument":{"uri":"test:///foo.pdll"},
"position":{"line":5,"character":12}
}}
// CHECK: "id": 1
// CHECK-NEXT: "jsonrpc": "2.0",
// CHECK-NEXT: "result": {
// CHECK-NEXT: "isIncomplete": false,
// CHECK-NEXT: "items": [
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "0: Op",
// CHECK-NEXT: "filterText": "0",
// CHECK-NEXT: "insertText": "0",
// CHECK-NEXT: "insertTextFormat": 1,
// CHECK-NEXT: "kind": 5,
// CHECK-NEXT: "label": "0 (field #0)",
// CHECK-NEXT: "sortText": "0"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "0: Op",
// CHECK-NEXT: "filterText": "value1 (field #0)",
// CHECK-NEXT: "insertText": "value1",
// CHECK-NEXT: "insertTextFormat": 1,
// CHECK-NEXT: "kind": 5,
// CHECK-NEXT: "label": "value1 (field #0)",
// CHECK-NEXT: "sortText": "0"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "1: Op<test.op>",
// CHECK-NEXT: "filterText": "1",
// CHECK-NEXT: "insertText": "1",
// CHECK-NEXT: "insertTextFormat": 1,
// CHECK-NEXT: "kind": 5,
// CHECK-NEXT: "label": "1 (field #1)",
// CHECK-NEXT: "sortText": "1"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// -----
{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{
"textDocument":{"uri":"test:///foo.pdll"},
"position":{"line":3,"character":23}
}}
// CHECK: "id": 1
// CHECK-NEXT: "jsonrpc": "2.0",
// CHECK-NEXT: "result": {
// CHECK-NEXT: "isIncomplete": false,
// CHECK-NEXT: "items": [
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "pattern metadata",
// CHECK-NEXT: "documentation": {
// CHECK-NEXT: "kind": "markdown",
// CHECK-NEXT: "value": "The `benefit` of matching the pattern."
// CHECK-NEXT: },
// CHECK-NEXT: "insertText": "benefit($1)",
// CHECK-NEXT: "insertTextFormat": 2,
// CHECK-NEXT: "kind": 7,
// CHECK-NEXT: "label": "benefit"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "pattern metadata",
// CHECK-NEXT: "documentation": {
// CHECK-NEXT: "kind": "markdown",
// CHECK-NEXT: "value": "The pattern properly handles recursive application."
// CHECK-NEXT: },
// CHECK-NEXT: "insertTextFormat": 1,
// CHECK-NEXT: "kind": 7,
// CHECK-NEXT: "label": "recursion"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// -----
{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{
"textDocument":{"uri":"test:///foo.pdll"},
"position":{"line":4,"character":24}
}}
// CHECK: "id": 1
// CHECK-NEXT: "jsonrpc": "2.0",
// CHECK-NEXT: "result": {
// CHECK-NEXT: "isIncomplete": false,
// CHECK-NEXT: "items": [
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "Attr constraint",
// CHECK-NEXT: "documentation": {
// CHECK-NEXT: "kind": "markdown",
// CHECK-NEXT: "value": "A single entity core constraint of type `mlir::Attribute`"
// CHECK-NEXT: },
// CHECK-NEXT: "insertTextFormat": 1,
// CHECK-NEXT: "kind": 7,
// CHECK-NEXT: "label": "Attr",
// CHECK-NEXT: "sortText": "0"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "Op constraint",
// CHECK-NEXT: "documentation": {
// CHECK-NEXT: "kind": "markdown",
// CHECK-NEXT: "value": "A single entity core constraint of type `mlir::Operation *`"
// CHECK-NEXT: },
// CHECK-NEXT: "insertTextFormat": 1,
// CHECK-NEXT: "kind": 7,
// CHECK-NEXT: "label": "Op",
// CHECK-NEXT: "sortText": "0"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "Value constraint",
// CHECK-NEXT: "documentation": {
// CHECK-NEXT: "kind": "markdown",
// CHECK-NEXT: "value": "A single entity core constraint of type `mlir::Value`"
// CHECK-NEXT: },
// CHECK-NEXT: "insertTextFormat": 1,
// CHECK-NEXT: "kind": 7,
// CHECK-NEXT: "label": "Value",
// CHECK-NEXT: "sortText": "0"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "ValueRange constraint",
// CHECK-NEXT: "documentation": {
// CHECK-NEXT: "kind": "markdown",
// CHECK-NEXT: "value": "A single entity core constraint of type `mlir::ValueRange`"
// CHECK-NEXT: },
// CHECK-NEXT: "insertTextFormat": 1,
// CHECK-NEXT: "kind": 7,
// CHECK-NEXT: "label": "ValueRange",
// CHECK-NEXT: "sortText": "0"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "Type constraint",
// CHECK-NEXT: "documentation": {
// CHECK-NEXT: "kind": "markdown",
// CHECK-NEXT: "value": "A single entity core constraint of type `mlir::Type`"
// CHECK-NEXT: },
// CHECK-NEXT: "insertTextFormat": 1,
// CHECK-NEXT: "kind": 7,
// CHECK-NEXT: "label": "Type",
// CHECK-NEXT: "sortText": "0"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "TypeRange constraint",
// CHECK-NEXT: "documentation": {
// CHECK-NEXT: "kind": "markdown",
// CHECK-NEXT: "value": "A single entity core constraint of type `mlir::TypeRange`"
// CHECK-NEXT: },
// CHECK-NEXT: "insertTextFormat": 1,
// CHECK-NEXT: "kind": 7,
// CHECK-NEXT: "label": "TypeRange",
// CHECK-NEXT: "sortText": "0"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "Attr<type> constraint",
// CHECK-NEXT: "documentation": {
// CHECK-NEXT: "kind": "markdown",
// CHECK-NEXT: "value": "A single entity core constraint of type `mlir::Attribute`"
// CHECK-NEXT: },
// CHECK-NEXT: "insertText": "Attr<$1>",
// CHECK-NEXT: "insertTextFormat": 2,
// CHECK-NEXT: "kind": 7,
// CHECK-NEXT: "label": "Attr<type>",
// CHECK-NEXT: "sortText": "0"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "Value<type> constraint",
// CHECK-NEXT: "documentation": {
// CHECK-NEXT: "kind": "markdown",
// CHECK-NEXT: "value": "A single entity core constraint of type `mlir::Value`"
// CHECK-NEXT: },
// CHECK-NEXT: "insertText": "Value<$1>",
// CHECK-NEXT: "insertTextFormat": 2,
// CHECK-NEXT: "kind": 7,
// CHECK-NEXT: "label": "Value<type>",
// CHECK-NEXT: "sortText": "0"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "ValueRange<type> constraint",
// CHECK-NEXT: "documentation": {
// CHECK-NEXT: "kind": "markdown",
// CHECK-NEXT: "value": "A single entity core constraint of type `mlir::ValueRange`"
// CHECK-NEXT: },
// CHECK-NEXT: "insertText": "ValueRange<$1>",
// CHECK-NEXT: "insertTextFormat": 2,
// CHECK-NEXT: "kind": 7,
// CHECK-NEXT: "label": "ValueRange<type>",
// CHECK-NEXT: "sortText": "0"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "detail": "(value: Value) -> Tuple<>",
// CHECK-NEXT: "kind": 8,
// CHECK-NEXT: "label": "ValueCst",
// CHECK-NEXT: "sortText": "2_ValueCst"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// -----
{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{
"textDocument":{"uri":"test:///foo.pdll"},
"position":{"line":0,"character":18}
}}
// CHECK: "id": 1
// CHECK-NEXT: "jsonrpc": "2.0",
// CHECK-NEXT: "result": {
// CHECK-NEXT: "isIncomplete": false,
// CHECK-NEXT: "items": [
// CHECK-NEXT: {
// CHECK-NEXT: "kind": 17,
// CHECK-NEXT: "label": "included.pdll"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "kind": 17,
// CHECK-NEXT: "label": "included.td"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// -----
{"jsonrpc":"2.0","id":3,"method":"shutdown"}
// -----
{"jsonrpc":"2.0","method":"exit"}