Skip to content

Commit fb6773b

Browse files
committed
locate: reset state from entry points
1 parent 819e419 commit fb6773b

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

src/analysis/locate.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,6 @@ end = struct
703703
end
704704

705705
let locate ~config ~ml_or_mli ~path ~lazy_trie ~pos ~str_ident loc =
706-
File_switching.reset ();
707-
Fallback.reset ();
708706
Preferences.set ml_or_mli;
709707
log ~title:"locate"
710708
"present in the environment, walking up the typedtree looking for '%s'"
@@ -740,6 +738,8 @@ let from_longident ~config ~env ~lazy_trie ~pos nss ml_or_mli ident =
740738
locate ~config ~ml_or_mli ~path:tagged_path ~lazy_trie ~pos ~str_ident loc
741739

742740
let from_path ~config ~env ~local_defs ~pos ~namespace ml_or_mli path =
741+
File_switching.reset ();
742+
Fallback.reset ();
743743
let str_ident = Path.name path in
744744
if Utils.is_builtin_path path then
745745
`Builtin
@@ -761,6 +761,8 @@ let from_path ~config ~env ~local_defs ~pos ~namespace ml_or_mli path =
761761
| `Found (loc, _) -> find_source ~config loc str_ident
762762

763763
let from_string ~config ~env ~local_defs ~pos ?namespaces switch path =
764+
File_switching.reset ();
765+
Fallback.reset ();
764766
let browse = Mbrowse.of_typedtree local_defs in
765767
let lazy_trie =
766768
lazy (Typedtrie.of_browses ~local_buffer:true
@@ -808,6 +810,8 @@ let from_string ~config ~env ~local_defs ~pos ?namespaces switch path =
808810
| `Found (loc, _) -> find_source ~config loc path
809811

810812
let get_doc ~config ~env ~local_defs ~comments ~pos =
813+
File_switching.reset ();
814+
Fallback.reset ();
811815
let browse = Mbrowse.of_typedtree local_defs in
812816
let lazy_trie = lazy (Typedtrie.of_browses ~local_buffer:true
813817
[Browse_tree.of_browse browse]) in

tests/test-dirs/server-tests/locate-state/reset-file-switching.t

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,7 @@ random documentation is fetched for the same `document` request as before
5656
$ $MERLIN server document -position 23:5 < lib_doc.ml
5757
{
5858
"class": "return",
59-
"value": "List operations.
60-
61-
Some functions are flagged as not tail-recursive. A tail-recursive
62-
function uses constant stack space, while a non-tail-recursive function
63-
uses stack space proportional to the length of its list argument, which
64-
can be a problem with very long lists. When the function takes several
65-
list arguments, an approximate formula giving stack usage (in some
66-
unspecified constant unit) is shown in parentheses.
67-
68-
The above considerations can usually be ignored if your lists are not
69-
longer than about 10000 elements.
70-
71-
The labeled version of this module can be used as described in the
72-
{!StdLabels} module.",
59+
"value": "No documentation available",
7360
"notifications": []
7461
}
7562

0 commit comments

Comments
 (0)