1 // RUN: mlir-lsp-server -lit-test < %s | FileCheck -strict-whitespace %s
2 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"mlir","capabilities":{},"trace":"off"}}
4 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{
5 "uri":"test:///foo.mlir",
8 "text":"#attr = 1 : index\n!type = index\nfunc.func @foo(%arg0: !type) -> i1 attributes {attr = #attr} {\n%value = arith.constant true loc(#loc)\nreturn %value : i1\n}\n#loc = loc(\"foo.mlir\":1:2)"
11 {"jsonrpc":"2.0","id":1,"method":"textDocument/definition","params":{
12 "textDocument":{"uri":"test:///foo.mlir"},
13 "position":{"line":4,"character":12}
16 // CHECK-NEXT: "jsonrpc": "2.0",
17 // CHECK-NEXT: "result": [
19 // CHECK-NEXT: "range": {
20 // CHECK-NEXT: "end": {
21 // CHECK-NEXT: "character": 6,
22 // CHECK-NEXT: "line": 3
24 // CHECK-NEXT: "start": {
25 // CHECK-NEXT: "character": 0,
26 // CHECK-NEXT: "line": 3
29 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
32 {"jsonrpc":"2.0","id":2,"method":"textDocument/definition","params":{
33 "textDocument":{"uri":"test:///foo.mlir"},
34 "position":{"line":2,"character":12}
37 // CHECK-NEXT: "jsonrpc": "2.0",
38 // CHECK-NEXT: "result": [
40 // CHECK-NEXT: "range": {
41 // CHECK-NEXT: "end": {
42 // CHECK-NEXT: "character": 9,
43 // CHECK-NEXT: "line": 2
45 // CHECK-NEXT: "start": {
46 // CHECK-NEXT: "character": 0,
47 // CHECK-NEXT: "line": 2
50 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
53 {"jsonrpc":"2.0","id":2,"method":"textDocument/definition","params":{
54 "textDocument":{"uri":"test:///foo.mlir"},
55 "position":{"line":2,"character":25}
58 // CHECK-NEXT: "jsonrpc": "2.0",
59 // CHECK-NEXT: "result": [
61 // CHECK-NEXT: "range": {
62 // CHECK-NEXT: "end": {
63 // CHECK-NEXT: "character": 5,
64 // CHECK-NEXT: "line": 1
66 // CHECK-NEXT: "start": {
67 // CHECK-NEXT: "character": 0,
68 // CHECK-NEXT: "line": 1
71 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
74 {"jsonrpc":"2.0","id":2,"method":"textDocument/definition","params":{
75 "textDocument":{"uri":"test:///foo.mlir"},
76 "position":{"line":2,"character":57}
79 // CHECK-NEXT: "jsonrpc": "2.0",
80 // CHECK-NEXT: "result": [
82 // CHECK-NEXT: "range": {
83 // CHECK-NEXT: "end": {
84 // CHECK-NEXT: "character": 5,
85 // CHECK-NEXT: "line": 0
87 // CHECK-NEXT: "start": {
88 // CHECK-NEXT: "character": 0,
89 // CHECK-NEXT: "line": 0
92 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
95 {"jsonrpc":"2.0","id":2,"method":"textDocument/definition","params":{
96 "textDocument":{"uri":"test:///foo.mlir"},
97 "position":{"line":3,"character":37}
100 // CHECK-NEXT: "jsonrpc": "2.0",
101 // CHECK-NEXT: "result": [
103 // CHECK-NEXT: "range": {
104 // CHECK-NEXT: "end": {
105 // CHECK-NEXT: "character": 4,
106 // CHECK-NEXT: "line": 6
108 // CHECK-NEXT: "start": {
109 // CHECK-NEXT: "character": 0,
110 // CHECK-NEXT: "line": 6
113 // CHECK-NEXT: "uri": "{{.*}}/foo.mlir"
116 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
118 {"jsonrpc":"2.0","method":"exit"}