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.
occurrences: handle project wide queries
- Loading branch information
Showing
5 changed files
with
193 additions
and
57 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
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,37 @@ | ||
$ cat >main.ml <<EOF | ||
> type t = { lbl_a : int } | ||
> let f (x : t) = match x with | ||
> | { lbl_a } -> ignore lbl_a | ||
> EOF | ||
|
||
|
||
$ $MERLIN single occurrences -identifier-at 3:8 -scope project \ | ||
> -filename main.ml <main.ml | ||
{ | ||
"class": "return", | ||
"value": [ | ||
{ | ||
"file": "$TESTCASE_ROOT/main.ml", | ||
"start": { | ||
"line": 3, | ||
"col": 6 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"col": 11 | ||
} | ||
}, | ||
{ | ||
"file": "$TESTCASE_ROOT/main.ml", | ||
"start": { | ||
"line": 3, | ||
"col": 24 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"col": 29 | ||
} | ||
} | ||
], | ||
"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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
$ cat >dune-workspace <<'EOF' | ||
> (lang dune 3.11) | ||
> (workspace_indexation enabled) | ||
> EOF | ||
|
||
$ cat >dune-project <<'EOF' | ||
> (lang dune 3.11) | ||
> EOF | ||
|
||
$ mkdir lib | ||
$ cat >lib/lib.ml <<'EOF' | ||
> let x = 42 | ||
> let y = x | ||
> EOF | ||
|
||
$ cat >lib/dune <<'EOF' | ||
> (library | ||
> (name lib)) | ||
> EOF | ||
|
||
$ mkdir exe | ||
$ cat >exe/main.ml <<'EOF' | ||
> print_int Lib.x | ||
> EOF | ||
|
||
$ cat >exe/dune <<'EOF' | ||
> (library | ||
> (name main) | ||
> (libraries lib)) | ||
> EOF | ||
|
||
$ dune build @all | ||
ld: warning: -undefined suppress is deprecated | ||
ld: warning: -undefined suppress is deprecated | ||
ld: warning: -undefined suppress is deprecated | ||
ld: warning: -undefined suppress is deprecated | ||
|
||
$ ocaml-index dump _build/default/project.ocaml-index | ||
3 uids: | ||
{uid: Lib.1; locs: | ||
"y": File "$TESTCASE_ROOT/lib/lib.ml", line 2, characters 4-5 | ||
uid: Stdlib.313; locs: | ||
"print_int": File "$TESTCASE_ROOT/exe/main.ml", line 1, characters 0-9 | ||
uid: Lib.0; locs: | ||
"Lib.x": File "$TESTCASE_ROOT/exe/main.ml", line 1, characters 10-15; | ||
"x": File "$TESTCASE_ROOT/lib/lib.ml", line 1, characters 4-5; | ||
"x": File "$TESTCASE_ROOT/lib/lib.ml", line 2, characters 8-9 | ||
}, 0 approx shapes: {}, and shapes for CUS . | ||
|
||
Occurrences of Lib.x | ||
$ $MERLIN single occurrences -scope project -identifier-at 1:15 \ | ||
> -filename exe/main.ml <exe/main.ml | ||
{ | ||
"class": "return", | ||
"value": [ | ||
{ | ||
"file": "$TESTCASE_ROOT/lib/lib.ml", | ||
"start": { | ||
"line": 1, | ||
"col": 4 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"col": 5 | ||
} | ||
}, | ||
{ | ||
"file": "$TESTCASE_ROOT/exe/main.ml", | ||
"start": { | ||
"line": 1, | ||
"col": 14 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"col": 15 | ||
} | ||
}, | ||
{ | ||
"file": "$TESTCASE_ROOT/lib/lib.ml", | ||
"start": { | ||
"line": 2, | ||
"col": 8 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"col": 9 | ||
} | ||
} | ||
], | ||
"notifications": [] | ||
} |