Skip to content

Commit 280f627

Browse files
authored
Improve and test tags (#108)
1 parent 57644ed commit 280f627

File tree

4 files changed

+56
-7
lines changed

4 files changed

+56
-7
lines changed

queries/tags.scm

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44
(
55
(comment)? @doc .
66
(module_definition (module_binding (module_name) @name) @definition.module)
7-
(#strip! @doc "^\\(\\*\\*?\\s*|\\s\\*\\)$")
7+
(#strip! @doc "^\\(\\*+\\s*|\\s*\\*+\\)$")
88
)
99

1010
(module_path (module_name) @name) @reference.module
11+
(extended_module_path (module_name) @name) @reference.module
1112

1213
; Module types
1314
;--------------
1415

1516
(
1617
(comment)? @doc .
1718
(module_type_definition (module_type_name) @name) @definition.interface
18-
(#strip! @doc "^\\(\\*\\*?\\s*|\\s\\*\\)$")
19+
(#strip! @doc "^\\(\\*+\\s*|\\s*\\*+\\)$")
1920
)
2021

2122
(module_type_path (module_type_name) @name) @reference.implementation
@@ -35,13 +36,13 @@
3536
body: [(fun_expression) (function_expression)])
3637
] @definition.function
3738
)
38-
(#strip! @doc "^\\(\\*\\*?\\s*|\\s\\*\\)$")
39+
(#strip! @doc "^\\(\\*+\\s*|\\s*\\*+\\)$")
3940
)
4041

4142
(
4243
(comment)? @doc .
4344
(external (value_name) @name) @definition.function
44-
(#strip! @doc "^\\(\\*\\*?\\s*|\\s\\*\\)$")
45+
(#strip! @doc "^\\(\\*+\\s*|\\s*\\*+\\)$")
4546
)
4647

4748
(application_expression
@@ -65,7 +66,7 @@
6566
(value_definition
6667
(let_binding
6768
pattern: (parenthesized_operator (_) @name)) @definition.function)
68-
(#strip! @doc "^\\(\\*\\*?\\s*|\\s\\*\\)$")
69+
(#strip! @doc "^\\(\\*+\\s*|\\s*\\*+\\)$")
6970
)
7071

7172
[
@@ -95,7 +96,7 @@
9596
(class_definition (class_binding (class_name) @name) @definition.class)
9697
(class_type_definition (class_type_binding (class_type_name) @name) @definition.class)
9798
]
98-
(#strip! @doc "^\\(\\*\\*?\\s*|\\s\\*\\)$")
99+
(#strip! @doc "^\\(\\*+\\s*|\\s*\\*+\\)$")
99100
)
100101

101102
[
@@ -109,7 +110,7 @@
109110
(
110111
(comment)? @doc .
111112
(method_definition (method_name) @name) @definition.method
112-
(#strip! @doc "^\\(\\*\\*?\\s*|\\s\\*\\)$")
113+
(#strip! @doc "^\\(\\*+\\s*|\\s*\\*+\\)$")
113114
)
114115

115116
(method_invocation (method_name) @name) @reference.call

test/tags/classes.ml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class zero = object
2+
(* ^ definition.class *)
3+
val v = 0
4+
method get = v
5+
(* ^ definition.method *)
6+
end
7+
8+
let v = new zero
9+
(* ^ reference.class *)
10+
11+
let x = v#get
12+
(* ^ reference.call *)

test/tags/functions.ml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
let f x = Fun.id x
2+
(* ^ definition.function *)
3+
(* ^ reference.call *)
4+
5+
let f = fun x -> f @@ x |> f
6+
(* ^ definition.function *)
7+
(* ^ reference.call *)
8+
(* ^ reference.call *)
9+
10+
external f : 'a -> 'a = "id"
11+
(* ^ definition.function *)
12+
13+
let ( + ) a b = a + b
14+
(* ^ definition.function *)
15+
(* ^ reference.call *)

test/tags/modules.ml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module M : Map.S = Map.Make (Int)
2+
(* ^ definition.module *)
3+
(* ^ reference.module *)
4+
(* ^ reference.implementation *)
5+
(* ^ reference.module *)
6+
(* ^ reference.module *)
7+
(* ^ reference.module *)
8+
9+
module F (X: Map.OrderedType) = struct
10+
(* ^ definition.module *)
11+
(* ^ reference.module *)
12+
(* ^ reference.implementation *)
13+
let compare = X.compare
14+
(* ^ reference.module *)
15+
end
16+
17+
module type T = sig end
18+
(* ^ definition.interface *)
19+
20+
module rec M : T = struct end and N : T = struct end
21+
(* ^ definition.module *)

0 commit comments

Comments
 (0)