-
Notifications
You must be signed in to change notification settings - Fork 16
Make Merlin look for dot-merlin-reader in the install directory #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
60 changes: 60 additions & 0 deletions
60
tests/test-dirs/config/dot-merlin-reader/find-dot-merlin-reader.t
This file contains hidden or 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,60 @@ | ||
| $ cat > .merlin <<EOF | ||
| > UNIT_NAME Dot_merlin_was_successfully_read | ||
| > EOF | ||
|
|
||
|
|
||
| In real-world scenarios, ocamlmerlin and dot-merlin-reader are usually installed in the | ||
| same directory (for example, via an opam install). In this situation, if dot-merlin-reader | ||
| isn't on the PATH, we can still read the .merlin file. | ||
| $ mkdir merlin-bin | ||
| $ cp $(which dot-merlin-reader) merlin-bin | ||
| $ cp $(which ocamlmerlin) merlin-bin | ||
| $ cp $(which ocamlmerlin-server) merlin-bin | ||
| $ cp $(which ocaml-index) merlin-bin | ||
|
|
||
| $ PATH="" merlin-bin/ocamlmerlin single dump-configuration -filename test.ml \ | ||
| > | jq .value.merlin.unit_name -r | ||
| Dot_merlin_was_successfully_read | ||
|
|
||
| The dot-merlin-reader in the same directory is prioritized over the one on the PATH. | ||
| $ mkdir bad-dot-merlin-reader-bin | ||
| $ cat > bad-dot-merlin-reader-bin/dot-merlin-reader <<EOF | ||
| > #!/bin/sh | ||
| > echo "this is a bad dot-merlin-reader" >&2 | ||
| > exit 1 | ||
| > EOF | ||
|
|
||
| $ PATH="bad-dot-merlin-reader-bin" \ | ||
| > merlin-bin/ocamlmerlin single dump-configuration -filename test.ml \ | ||
| > | jq .value.merlin.unit_name -r | ||
| Dot_merlin_was_successfully_read | ||
|
|
||
| But we can fall back to the one on the PATH if a dot-merlin-reader doesn't exist in the | ||
| same directory. | ||
| $ cp -r merlin-bin merlin-bin-no-reader | ||
| $ rm merlin-bin-no-reader/dot-merlin-reader | ||
|
|
||
| $ PATH="" \ | ||
| > merlin-bin-no-reader/ocamlmerlin single dump-configuration -filename test.ml \ | ||
| > | jq .value.merlin.unit_name -r | ||
| null | ||
|
|
||
| $ PATH="merlin-bin" \ | ||
| > merlin-bin-no-reader/ocamlmerlin single dump-configuration -filename test.ml \ | ||
| > | jq .value.merlin.unit_name -r | ||
| Dot_merlin_was_successfully_read | ||
|
|
||
| We can override using the DOT_MERLIN_READER_EXE environment variable. | ||
| $ cp -r merlin-bin merlin-bin-bad-reader | ||
| $ rm merlin-bin-bad-reader/dot-merlin-reader | ||
| $ cp bad-dot-merlin-reader-bin/dot-merlin-reader merlin-bin-bad-reader | ||
|
|
||
| $ PATH="merlin-bin-bad-reader" \ | ||
| > merlin-bin-bad-reader/ocamlmerlin single dump-configuration -filename test.ml \ | ||
| > | jq .value.merlin.unit_name -r | ||
| null | ||
|
|
||
| $ PATH="merlin-bin-bad-reader" DOT_MERLIN_READER_EXE="merlin-bin/dot-merlin-reader" \ | ||
| > merlin-bin-bad-reader/ocamlmerlin single dump-configuration -filename test.ml \ | ||
| > | jq .value.merlin.unit_name -r | ||
| Dot_merlin_was_successfully_read |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.