[clang-tidy][NFC]remove deps of clang in clang tidy test (#116588)
[llvm-project.git] / mlir / test / mlir-lsp-server / definition.test
blob99f7c2b2c395372996ee12c416d22949f08ae4f1
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"}}
3 // -----
4 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{
5   "uri":"test:///foo.mlir",
6   "languageId":"mlir",
7   "version":1,
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)"
9 }}}
10 // -----
11 {"jsonrpc":"2.0","id":1,"method":"textDocument/definition","params":{
12   "textDocument":{"uri":"test:///foo.mlir"},
13   "position":{"line":4,"character":12}
15 //      CHECK:  "id": 1
16 // CHECK-NEXT:  "jsonrpc": "2.0",
17 // CHECK-NEXT:  "result": [
18 // CHECK-NEXT:    {
19 // CHECK-NEXT:      "range": {
20 // CHECK-NEXT:        "end": {
21 // CHECK-NEXT:          "character": 6,
22 // CHECK-NEXT:          "line": 3
23 // CHECK-NEXT:        },
24 // CHECK-NEXT:        "start": {
25 // CHECK-NEXT:          "character": 0,
26 // CHECK-NEXT:          "line": 3
27 // CHECK-NEXT:        }
28 // CHECK-NEXT:      },
29 // CHECK-NEXT:      "uri": "{{.*}}/foo.mlir"
30 // CHECK-NEXT:    }
31 // -----
32 {"jsonrpc":"2.0","id":2,"method":"textDocument/definition","params":{
33   "textDocument":{"uri":"test:///foo.mlir"},
34   "position":{"line":2,"character":12}
36 //      CHECK:  "id": 2
37 // CHECK-NEXT:  "jsonrpc": "2.0",
38 // CHECK-NEXT:  "result": [
39 // CHECK-NEXT:    {
40 // CHECK-NEXT:      "range": {
41 // CHECK-NEXT:        "end": {
42 // CHECK-NEXT:          "character": 9,
43 // CHECK-NEXT:          "line": 2
44 // CHECK-NEXT:        },
45 // CHECK-NEXT:        "start": {
46 // CHECK-NEXT:          "character": 0,
47 // CHECK-NEXT:          "line": 2
48 // CHECK-NEXT:        }
49 // CHECK-NEXT:      },
50 // CHECK-NEXT:      "uri": "{{.*}}/foo.mlir"
51 // CHECK-NEXT:    }
52 // -----
53 {"jsonrpc":"2.0","id":2,"method":"textDocument/definition","params":{
54   "textDocument":{"uri":"test:///foo.mlir"},
55   "position":{"line":2,"character":25}
57 //      CHECK:  "id": 2
58 // CHECK-NEXT:  "jsonrpc": "2.0",
59 // CHECK-NEXT:  "result": [
60 // CHECK-NEXT:    {
61 // CHECK-NEXT:      "range": {
62 // CHECK-NEXT:        "end": {
63 // CHECK-NEXT:          "character": 5,
64 // CHECK-NEXT:          "line": 1
65 // CHECK-NEXT:        },
66 // CHECK-NEXT:        "start": {
67 // CHECK-NEXT:          "character": 0,
68 // CHECK-NEXT:          "line": 1
69 // CHECK-NEXT:        }
70 // CHECK-NEXT:      },
71 // CHECK-NEXT:      "uri": "{{.*}}/foo.mlir"
72 // CHECK-NEXT:    }
73 // -----
74 {"jsonrpc":"2.0","id":2,"method":"textDocument/definition","params":{
75   "textDocument":{"uri":"test:///foo.mlir"},
76   "position":{"line":2,"character":57}
78 //      CHECK:  "id": 2
79 // CHECK-NEXT:  "jsonrpc": "2.0",
80 // CHECK-NEXT:  "result": [
81 // CHECK-NEXT:    {
82 // CHECK-NEXT:      "range": {
83 // CHECK-NEXT:        "end": {
84 // CHECK-NEXT:          "character": 5,
85 // CHECK-NEXT:          "line": 0
86 // CHECK-NEXT:        },
87 // CHECK-NEXT:        "start": {
88 // CHECK-NEXT:          "character": 0,
89 // CHECK-NEXT:          "line": 0
90 // CHECK-NEXT:        }
91 // CHECK-NEXT:      },
92 // CHECK-NEXT:      "uri": "{{.*}}/foo.mlir"
93 // CHECK-NEXT:    }
94 // -----
95 {"jsonrpc":"2.0","id":2,"method":"textDocument/definition","params":{
96   "textDocument":{"uri":"test:///foo.mlir"},
97   "position":{"line":3,"character":37}
99 //      CHECK:  "id": 2
100 // CHECK-NEXT:  "jsonrpc": "2.0",
101 // CHECK-NEXT:  "result": [
102 // CHECK-NEXT:    {
103 // CHECK-NEXT:      "range": {
104 // CHECK-NEXT:        "end": {
105 // CHECK-NEXT:          "character": 4,
106 // CHECK-NEXT:          "line": 6
107 // CHECK-NEXT:        },
108 // CHECK-NEXT:        "start": {
109 // CHECK-NEXT:          "character": 0,
110 // CHECK-NEXT:          "line": 6
111 // CHECK-NEXT:        }
112 // CHECK-NEXT:      },
113 // CHECK-NEXT:      "uri": "{{.*}}/foo.mlir"
114 // CHECK-NEXT:    }
115 // -----
116 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
117 // -----
118 {"jsonrpc":"2.0","method":"exit"}