-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1840 from liam923/canonicalize-paths
Canonicalize paths when finding occurrences
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 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
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
54 changes: 54 additions & 0 deletions
54
tests/test-dirs/occurrences/project-wide/pwo-canonicalize.t
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,54 @@ | ||
$ cat > lib.ml << EOF | ||
> let foo = "bar" | ||
> let () = print_string foo | ||
> EOF | ||
|
||
$ cat > main.ml << EOF | ||
> let () = print_string Lib.foo | ||
> EOF | ||
|
||
$ cat > .merlin << EOF | ||
> INDEX project.ocaml-index | ||
> SOURCE_ROOT . | ||
> EOF | ||
|
||
$ ocamlc -bin-annot -bin-annot-occurrences -c lib.ml main.ml | ||
$ ocaml-index aggregate main.cmt lib.cmt --root . --rewrite-root | ||
|
||
$ ocamlmerlin single occurrences -scope project -identifier-at 1:4 \ | ||
> -filename lib.ml < lib.ml | jq .value | ||
[ | ||
{ | ||
"file": "$TESTCASE_ROOT/lib.ml", | ||
"start": { | ||
"line": 1, | ||
"col": 4 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"col": 7 | ||
} | ||
}, | ||
{ | ||
"file": "$TESTCASE_ROOT/lib.ml", | ||
"start": { | ||
"line": 2, | ||
"col": 22 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"col": 25 | ||
} | ||
}, | ||
{ | ||
"file": "$TESTCASE_ROOT/main.ml", | ||
"start": { | ||
"line": 1, | ||
"col": 26 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"col": 29 | ||
} | ||
} | ||
] |