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.
Small refactors, added documentation and tests update
- Loading branch information
Showing
9 changed files
with
68 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,48 @@ | ||
(** Provides tools to lookup items in the typing environment. | ||
Establishing the namespace of an item before looking it up in the environement | ||
is necessary to prevent mixing items which have the same name but are not of | ||
the same namespace. (For example the environment can contain both type named | ||
`t` and a value named `t`.) *) | ||
|
||
(** Namespaces describe in which section of the environment an item should be | ||
looked for. *) | ||
module Namespace : sig | ||
type t = Shape.Sig_component_kind.t | ||
|
||
val to_string : t -> string | ||
|
||
type under_type = [ `Constr | `Labels ] | ||
type inferred_basic = | ||
[ `Constr | `Labels | `Mod | `Modtype | `Type | `Vals ] | ||
type inferred = | ||
[ `Constr | ||
| `Labels | ||
| `Mod | ||
| `Modtype | ||
| `This_cstr of Types.constructor_description | ||
| `This_label of Types.label_description | ||
| `Type | ||
| `Vals ] | ||
|
||
val from_context : Context.t -> inferred list | ||
end | ||
|
||
type item = { | ||
uid: Shape.Uid.t; | ||
loc: Location.t; | ||
namespace: Namespace.t | ||
} | ||
|
||
val loc | ||
: Path.t | ||
-> Namespace.t | ||
-> Env.t | ||
-> item option | ||
|
||
val in_namespaces | ||
: Namespace.inferred list | ||
-> Longident.t | ||
-> Env.t | ||
-> (Path.t * item) option | ||
type t = Shape.Sig_component_kind.t | ||
|
||
val to_string : t -> string | ||
|
||
type under_type = [ `Constr | `Labels ] | ||
type inferred_basic = | ||
[ `Constr | `Labels | `Mod | `Modtype | `Type | `Vals ] | ||
type inferred = | ||
[ `Constr | ||
| `Labels | ||
| `Mod | ||
| `Modtype | ||
| `This_cstr of Types.constructor_description | ||
| `This_label of Types.label_description | ||
| `Type | ||
| `Vals ] | ||
|
||
(** Returns potential namespaces given the context of an expression *) | ||
val from_context : Context.t -> inferred list | ||
end | ||
|
||
type item = { | ||
uid: Shape.Uid.t; | ||
loc: Location.t; | ||
namespace: Namespace.t | ||
} | ||
|
||
val by_path | ||
: Path.t | ||
-> Namespace.t | ||
-> Env.t | ||
-> item option | ||
|
||
val by_longident | ||
: Namespace.inferred list | ||
-> Longident.t | ||
-> Env.t | ||
-> (Path.t * item) option |
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
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,11 @@ | ||
$ cat >test.ml <<EOF | ||
> let rec rev acc = function | ||
> | [] -> acc | ||
> | hd :: tl -> rev (hd::acc) tl | ||
> | ||
> let _ = rev [] | ||
> EOF | ||
|
||
$ $MERLIN single type-enclosing -position 2:12 \ | ||
> -filename test.ml < test.ml | | ||
> jq '.value' |
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