llvm/mlir/test/mlir-pdll-lsp-server/definition.test

// RUN: mlir-pdll-lsp-server -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":"Pattern FooPattern {\nlet root: Op<toy.test>;\nerase root;\n}"
}}}
// -----
{"jsonrpc":"2.0","id":1,"method":"textDocument/definition","params":{
  "textDocument":{"uri":"test:///foo.pdll"},
  "position":{"line":0,"character":12}
}}
//      CHECK:  "id": 1
// CHECK-NEXT:  "jsonrpc": "2.0",
// CHECK-NEXT:  "result": [
// CHECK-NEXT:    {
// CHECK-NEXT:      "range": {
// CHECK-NEXT:        "end": {
// CHECK-NEXT:          "character": 18,
// CHECK-NEXT:          "line": 0
// CHECK-NEXT:        },
// CHECK-NEXT:        "start": {
// CHECK-NEXT:          "character": 8,
// CHECK-NEXT:          "line": 0
// CHECK-NEXT:        }
// CHECK-NEXT:      },
// CHECK-NEXT:      "uri": "{{.*}}/foo.pdll"
// CHECK-NEXT:    }
// -----
{"jsonrpc":"2.0","id":2,"method":"textDocument/definition","params":{
  "textDocument":{"uri":"test:///foo.pdll"},
  "position":{"line":2,"character":8}
}}
//      CHECK:  "id": 2
// CHECK-NEXT:  "jsonrpc": "2.0",
// CHECK-NEXT:  "result": [
// CHECK-NEXT:    {
// CHECK-NEXT:      "range": {
// CHECK-NEXT:        "end": {
// CHECK-NEXT:          "character": 8,
// CHECK-NEXT:          "line": 1
// CHECK-NEXT:        },
// CHECK-NEXT:        "start": {
// CHECK-NEXT:          "character": 4,
// CHECK-NEXT:          "line": 1
// CHECK-NEXT:        }
// CHECK-NEXT:      },
// CHECK-NEXT:      "uri": "{{.*}}/foo.pdll"
// CHECK-NEXT:    }
// -----
{"jsonrpc":"2.0","id":3,"method":"shutdown"}
// -----
{"jsonrpc":"2.0","method":"exit"}