forked from ocaml/merlin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
225 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ | |
} | ||
], | ||
"stdlib": null, | ||
"index_file": null, | ||
"reader": [], | ||
"protocol": "json", | ||
"log_file": null, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
$ dune build @check | ||
|
||
FIXME: When the deifinition is in one of the implicit transitive dependencies | ||
Merlin does not found the file in the source path provided by Dune. One possible | ||
fix would be for Dune to provide additional source path for "externatl" deps. | ||
When the definition is in one of the implicit transitive dependencies | ||
Merlin does not find the file in the source path provided by Dune. One possible | ||
fix would be for Dune to provide additional source path for "external" deps. | ||
$ $MERLIN single locate -look-for ml -position 1:15 \ | ||
> -filename bin/main.ml <bin/main.ml | ||
{ | ||
"class": "return", | ||
"value": "'Lib1.t' seems to originate from 'Lib2' whose ML file could not be found", | ||
"value": { | ||
"file": "$TESTCASE_ROOT/src/lib2/lib2.ml", | ||
"pos": { | ||
"line": 1, | ||
"col": 5 | ||
} | ||
}, | ||
"notifications": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
$ cat >main.ml <<'EOF' | ||
> module M : sig | ||
> type t = A of { label_a : int } | ||
> end = struct | ||
> type t = A of { label_a : int } | ||
> let _ = A { label_a = 1 } | ||
> end | ||
> | ||
> let _ = M.A { label_a = 1 } | ||
> | ||
> open M | ||
> | ||
> let _ = A { label_a = 1 } | ||
> EOF | ||
|
||
Constructor declaration: | ||
$ $MERLIN single locate -look-for mli -position 12:8 \ | ||
> -filename main.ml <main.ml | jq '.value.pos' | ||
{ | ||
"line": 2, | ||
"col": 11 | ||
} | ||
|
||
Constructor definition: | ||
$ $MERLIN single locate -look-for ml -position 12:8 \ | ||
> -filename main.ml <main.ml | jq '.value.pos' | ||
{ | ||
"line": 4, | ||
"col": 11 | ||
} | ||
|
||
Label declaration: | ||
$ $MERLIN single locate -look-for mli -position 12:13 \ | ||
> -filename main.ml <main.ml | jq '.value.pos' | ||
{ | ||
"line": 2, | ||
"col": 18 | ||
} | ||
|
||
Label definition: | ||
$ $MERLIN single locate -look-for ml -position 12:13 \ | ||
> -filename main.ml <main.ml | jq '.value.pos' | ||
{ | ||
"line": 4, | ||
"col": 18 | ||
} | ||
|
||
Constructor occurrences: | ||
$ $MERLIN single occurrences -identifier-at 12:8 \ | ||
> -filename main.ml <main.ml | grep line | uniq | ||
"line": 4, | ||
"line": 5, | ||
"line": 8, | ||
"line": 12, | ||
|
||
Label occurrences: | ||
$ $MERLIN single occurrences -identifier-at 12:13 \ | ||
> -filename main.ml <main.ml | jq '.value' | ||
[ | ||
{ | ||
"start": { | ||
"line": 4, | ||
"col": 18 | ||
}, | ||
"end": { | ||
"line": 4, | ||
"col": 25 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 5, | ||
"col": 14 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"col": 21 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 8, | ||
"col": 14 | ||
}, | ||
"end": { | ||
"line": 8, | ||
"col": 21 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 12, | ||
"col": 12 | ||
}, | ||
"end": { | ||
"line": 12, | ||
"col": 19 | ||
} | ||
} | ||
] | ||
|
||
$ cat >main.ml <<'EOF' | ||
> type t = { a : int; b : float } | ||
> let _ = { a = 4; b = 2.0 } | ||
> let a = 4 | ||
> let r = { a; b = 2.0 } | ||
> let _ = { r with b = 2.0 } | ||
> let { a; b } = r | ||
> EOF | ||
|
||
$ $MERLIN single occurrences -identifier-at 6:15 \ | ||
> -filename main.ml <main.ml | jq '.value' | ||
[ | ||
{ | ||
"start": { | ||
"line": 4, | ||
"col": 4 | ||
}, | ||
"end": { | ||
"line": 4, | ||
"col": 5 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 5, | ||
"col": 10 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"col": 11 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 6, | ||
"col": 15 | ||
}, | ||
"end": { | ||
"line": 6, | ||
"col": 16 | ||
} | ||
} | ||
] | ||
|
||
$ $MERLIN single occurrences -identifier-at 2:10 \ | ||
> -filename main.ml <main.ml | jq '.value' | ||
[ | ||
{ | ||
"start": { | ||
"line": 1, | ||
"col": 11 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"col": 12 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 2, | ||
"col": 10 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"col": 11 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 4, | ||
"col": 10 | ||
}, | ||
"end": { | ||
"line": 4, | ||
"col": 11 | ||
} | ||
}, | ||
{ | ||
"start": { | ||
"line": 6, | ||
"col": 6 | ||
}, | ||
"end": { | ||
"line": 6, | ||
"col": 7 | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters