Skip to content

Commit c37c5df

Browse files
committed
More cleanup of debug.
1 parent eba4b26 commit c37c5df

File tree

5 files changed

+37
-69
lines changed

5 files changed

+37
-69
lines changed

analysis/src/FindFiles.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ let findProjectFiles ~namespace ~path ~sourceDirectories ~libBs =
139139
let interfaces = Hashtbl.create 100 in
140140
files
141141
|> StringSet.iter (fun path ->
142-
if isInterface path then (
143-
Log.log ("Adding intf " ^ Utils.dumpPath path);
144-
Hashtbl.replace interfaces (getName path) path));
142+
if isInterface path then Hashtbl.replace interfaces (getName path) path);
145143

146144
let normals =
147145
files |> StringSet.elements

analysis/src/Packages.ml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,9 @@ let newBsPackage ~rootPath =
3636
FindFiles.findProjectFiles ~namespace ~path:rootPath
3737
~sourceDirectories ~libBs
3838
in
39-
Log.log
40-
("-- All project files found: "
41-
^ string_of_int (List.length projectFilesAndPaths));
4239
projectFilesAndPaths
43-
|> List.iter (fun (name, paths) ->
44-
Log.log name;
45-
match paths with
46-
| SharedTypes.Impl {cmt} ->
47-
Log.log ("impl " ^ Utils.dumpPath cmt)
48-
| _ -> Log.log "Both");
40+
|> List.iter (fun (_name, paths) ->
41+
Log.log (SharedTypes.showPaths paths));
4942
let pathsForModule =
5043
makePathsForModule ~projectFilesAndPaths ~dependenciesFilesAndPaths
5144
in
@@ -59,7 +52,7 @@ let newBsPackage ~rootPath =
5952
[FindFiles.nameSpaceToName namespace]
6053
in
6154
Log.log
62-
("Dependency dirs "
55+
("Dependency dirs: "
6356
^ String.concat " "
6457
(dependencyDirectories |> List.map Utils.dumpPath));
6558
let opens_from_bsc_flags =

analysis/src/References.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ let getLocItem ~full ~line ~col =
2424
let locItems = locItemsForPos ~extra:full.extra pos in
2525
if !Log.spamError then
2626
print_endline
27-
("locItems:\n"
28-
^ (locItems |> List.map locItemToString |> String.concat "\n"));
27+
("locItems:\n "
28+
^ (locItems |> List.map locItemToString |> String.concat "\n "));
2929
match locItems with
3030
| _ :: _ :: _ :: ({locType = Typed ("makeProps", _, _)} as li) :: _
3131
when full.file.uri |> Uri2.isInterface ->

analysis/src/SharedTypes.ml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,14 @@ type paths =
125125

126126
let showPaths paths =
127127
match paths with
128-
| Impl {cmt; res} -> Printf.sprintf "Impl(%s, %s)" cmt res
129-
| Namespace {cmt} -> Printf.sprintf "Namespace(%s)" cmt
128+
| Impl {cmt; res} ->
129+
Printf.sprintf "Impl cmt:%s res:%s" (Utils.dumpPath cmt)
130+
(Utils.dumpPath res)
131+
| Namespace {cmt} -> Printf.sprintf "Namespace cmt:%s" (Utils.dumpPath cmt)
130132
| IntfAndImpl {cmti; resi; cmt; res} ->
131-
Printf.sprintf "IntfAndImpl(%s, %s, %s, %s)" cmti resi cmt res
133+
Printf.sprintf "IntfAndImpl cmti:%s resi:%s cmt:%s res:%s"
134+
(Utils.dumpPath cmti) (Utils.dumpPath resi) (Utils.dumpPath cmt)
135+
(Utils.dumpPath res)
132136

133137
let getSrc p =
134138
match p with
@@ -203,7 +207,9 @@ type openTracker = {
203207
module LocationSet = Set.Make (struct
204208
include Location
205209

206-
let compare loc1 loc2 = compare loc2 loc1 (* polymorphic compare should be OK *)
210+
let compare loc1 loc2 = compare loc2 loc1
211+
212+
(* polymorphic compare should be OK *)
207213
end)
208214

209215
type extra = {

analysis/tests/src/expected/Debug.res.txt

Lines changed: 21 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,31 @@ Debug tests/src/Debug.res 0:4
22
Dependencies: @rescript/react
33
Source directories: tests/node_modules/@rescript/react/./src tests/node_modules/@rescript/react/./src/legacy
44
Source files: tests/node_modules/@rescript/react/./src/React.res tests/node_modules/@rescript/react/./src/ReactDOM.res tests/node_modules/@rescript/react/./src/ReactDOMServer.res tests/node_modules/@rescript/react/./src/ReactDOMStyle.res tests/node_modules/@rescript/react/./src/ReactEvent.res tests/node_modules/@rescript/react/./src/ReactEvent.resi tests/node_modules/@rescript/react/./src/ReactTestUtils.res tests/node_modules/@rescript/react/./src/ReactTestUtils.resi tests/node_modules/@rescript/react/./src/RescriptReactErrorBoundary.res tests/node_modules/@rescript/react/./src/RescriptReactErrorBoundary.resi tests/node_modules/@rescript/react/./src/RescriptReactRouter.res tests/node_modules/@rescript/react/./src/RescriptReactRouter.resi tests/node_modules/@rescript/react/./src/legacy/ReactDOMRe.res tests/node_modules/@rescript/react/./src/legacy/ReasonReact.res
5-
Adding intf tests/node_modules/@rescript/react/./src/ReactEvent.resi
6-
Adding intf tests/node_modules/@rescript/react/./src/ReactTestUtils.resi
7-
Adding intf tests/node_modules/@rescript/react/./src/RescriptReactErrorBoundary.resi
8-
Adding intf tests/node_modules/@rescript/react/./src/RescriptReactRouter.resi
95
Source directories: tests/src
106
Source files: tests/src/Auto.res tests/src/Completion.res tests/src/Component.res tests/src/Component.resi tests/src/Cross.res tests/src/Debug.res tests/src/Definition.res tests/src/DefinitionWithInterface.res tests/src/DefinitionWithInterface.resi tests/src/Div.res tests/src/Fragment.res tests/src/Hover.res tests/src/Jsx.res tests/src/Jsx.resi tests/src/Patterns.res tests/src/RecModules.res tests/src/RecordCompletion.res tests/src/References.res tests/src/ReferencesWithInterface.res tests/src/ReferencesWithInterface.resi tests/src/Rename.res tests/src/RenameWithInterface.res tests/src/RenameWithInterface.resi tests/src/TypeDefinition.res
11-
Adding intf tests/src/Component.resi
12-
Adding intf tests/src/DefinitionWithInterface.resi
13-
Adding intf tests/src/Jsx.resi
14-
Adding intf tests/src/ReferencesWithInterface.resi
15-
Adding intf tests/src/RenameWithInterface.resi
16-
-- All project files found: 19
17-
Auto
18-
impl tests/lib/bs/./src/Auto.cmt
19-
Completion
20-
impl tests/lib/bs/./src/Completion.cmt
21-
Component
22-
Both
23-
Cross
24-
impl tests/lib/bs/./src/Cross.cmt
25-
Debug
26-
impl tests/lib/bs/./src/Debug.cmt
27-
Definition
28-
impl tests/lib/bs/./src/Definition.cmt
29-
DefinitionWithInterface
30-
Both
31-
Div
32-
impl tests/lib/bs/./src/Div.cmt
33-
Fragment
34-
impl tests/lib/bs/./src/Fragment.cmt
35-
Hover
36-
impl tests/lib/bs/./src/Hover.cmt
37-
Jsx
38-
Both
39-
Patterns
40-
impl tests/lib/bs/./src/Patterns.cmt
41-
RecModules
42-
impl tests/lib/bs/./src/RecModules.cmt
43-
RecordCompletion
44-
impl tests/lib/bs/./src/RecordCompletion.cmt
45-
References
46-
impl tests/lib/bs/./src/References.cmt
47-
ReferencesWithInterface
48-
Both
49-
Rename
50-
impl tests/lib/bs/./src/Rename.cmt
51-
RenameWithInterface
52-
Both
53-
TypeDefinition
54-
impl tests/lib/bs/./src/TypeDefinition.cmt
55-
Dependency dirs tests/node_modules/@rescript/react/lib/bs/./src tests/node_modules/@rescript/react/lib/bs/./src/legacy
7+
Impl cmt:tests/lib/bs/./src/Auto.cmt res:tests/src/Auto.res
8+
Impl cmt:tests/lib/bs/./src/Completion.cmt res:tests/src/Completion.res
9+
IntfAndImpl cmti:tests/lib/bs/./src/Component.cmti resi:tests/src/Component.resi cmt:tests/lib/bs/./src/Component.cmt res:tests/src/Component.res
10+
Impl cmt:tests/lib/bs/./src/Cross.cmt res:tests/src/Cross.res
11+
Impl cmt:tests/lib/bs/./src/Debug.cmt res:tests/src/Debug.res
12+
Impl cmt:tests/lib/bs/./src/Definition.cmt res:tests/src/Definition.res
13+
IntfAndImpl cmti:tests/lib/bs/./src/DefinitionWithInterface.cmti resi:tests/src/DefinitionWithInterface.resi cmt:tests/lib/bs/./src/DefinitionWithInterface.cmt res:tests/src/DefinitionWithInterface.res
14+
Impl cmt:tests/lib/bs/./src/Div.cmt res:tests/src/Div.res
15+
Impl cmt:tests/lib/bs/./src/Fragment.cmt res:tests/src/Fragment.res
16+
Impl cmt:tests/lib/bs/./src/Hover.cmt res:tests/src/Hover.res
17+
IntfAndImpl cmti:tests/lib/bs/./src/Jsx.cmti resi:tests/src/Jsx.resi cmt:tests/lib/bs/./src/Jsx.cmt res:tests/src/Jsx.res
18+
Impl cmt:tests/lib/bs/./src/Patterns.cmt res:tests/src/Patterns.res
19+
Impl cmt:tests/lib/bs/./src/RecModules.cmt res:tests/src/RecModules.res
20+
Impl cmt:tests/lib/bs/./src/RecordCompletion.cmt res:tests/src/RecordCompletion.res
21+
Impl cmt:tests/lib/bs/./src/References.cmt res:tests/src/References.res
22+
IntfAndImpl cmti:tests/lib/bs/./src/ReferencesWithInterface.cmti resi:tests/src/ReferencesWithInterface.resi cmt:tests/lib/bs/./src/ReferencesWithInterface.cmt res:tests/src/ReferencesWithInterface.res
23+
Impl cmt:tests/lib/bs/./src/Rename.cmt res:tests/src/Rename.res
24+
IntfAndImpl cmti:tests/lib/bs/./src/RenameWithInterface.cmti resi:tests/src/RenameWithInterface.resi cmt:tests/lib/bs/./src/RenameWithInterface.cmt res:tests/src/RenameWithInterface.res
25+
Impl cmt:tests/lib/bs/./src/TypeDefinition.cmt res:tests/src/TypeDefinition.res
26+
Dependency dirs: tests/node_modules/@rescript/react/lib/bs/./src tests/node_modules/@rescript/react/lib/bs/./src/legacy
5627
Opens from bsconfig:
5728
locItems:
58-
0:4-0:5 Typed m (Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b> (Definition Value)
29+
0:4-0:5 Typed m (Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b> (Definition Value)
5930
[ref] Trying to find a defintion for a definition
6031
[ref] Declared
6132
[ref] exported, looking for alternate Debug

0 commit comments

Comments
 (0)