Comments (1)
@xvw To tests your changes on a small scale you won't need the custom dune: you can build the index by hand and instruct Merlin to use it:
From the testsuite:
$ cat >lib.ml <<'EOF'
> let foo = "bar"
> let () = print_string foo
> EOF
$ cat >main.ml <<'EOF'
> let () = print_string Lib.foo
> EOF
$ ocamlc -bin-annot -bin-annot-occurrences -c lib.ml main.ml
$ ocaml-index aggregate main.cmt lib.cmt
$ ocaml-index dump project.ocaml-index
2 uids:
{uid: Stdlib.312; locs:
"print_string": File "lib.ml", line 2, characters 9-21;
"print_string": File "main.ml", line 1, characters 9-21
uid: Lib.0; locs:
"foo": File "lib.ml", line 1, characters 4-7;
"foo": File "lib.ml", line 2, characters 22-25;
"Lib.foo": File "main.ml", line 1, characters 22-29
}, 0 approx shapes: {}, and shapes for CUS .
$ $MERLIN single occurrences -scope project -identifier-at 1:28 \
> -index-file project.ocaml-index \
> -filename main.ml <main.ml
{
"class": "return",
"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
}
}
],
"notifications": []
}
- Build the cmt files with indexes in them with OCaml 5.2 and the
-bin-annot -bin-annot-occurrences
flags. - Gather the occurrences from all the cmts by running the indexer:
ocaml-index aggregate -o the_index_file.index *.cmt
- Instruct Merlin to use that index via the emacs
merlin-flags
command:-index-file ./the_index_file.index
or by using a.merlin
file with the directiveINDEX ./the_index_file.index
.
These are still moving parts, if by mistake the latest versions of these tools don't work together you can follow the instructions here for a working 4.14-base version of the feature: https://discuss.ocaml.org/t/ann-preview-play-with-project-wide-occurrences-for-ocaml/13814
The emacs mode should work regardless :-)
from merlin.
Related Issues (20)
- `complete-prefix` short-circuits too eagerly when deciding whether to return only record field names
- Implement Enhanced Hover Feature for PPXs in Merlin
- Jump to incorrect module HOT 2
- Make `complete-prefix` smarter about field projection expressions passed as `-prefix`
- string litteral with an extension node is wrongly marked as being unterminated HOT 3
- Hover of a mutually recursive type can cause a stack overflow HOT 4
- Can't go-to-definition in generated file HOT 13
- Incorrect module type from `type-enclosing` HOT 1
- Optional argument include by `case-analysis` HOT 1
- Failed to install merlin with opam with gcc14 HOT 1
- Merlin-lib: return the description of a warning based on its identifier HOT 1
- Tracker: project-wide occurrences
- `case-analysis` fails to load module HOT 2
- No config found for file .ocamlinit. Try calling 'dune build'. HOT 3
- Wildcard constructor patterns display an incorrect type on hover HOT 5
- unknown flag `-unboxed-types` HOT 1
- Jump to definition with let-punning HOT 1
- Exception Not_found in merlin locate HOT 1
- Permissions and deletion of temporary files created by preprocessors (pp) HOT 1
- The request for documentation of function argument gives documentation for whole function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from merlin.