Skip to content

Commit dcd8675

Browse files
committed
More WIn debug.
1 parent e0f802b commit dcd8675

File tree

8 files changed

+106
-53
lines changed

8 files changed

+106
-53
lines changed

analysis/src/Commands.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ let completionWithParser ~debug ~path ~pos ~currentFile ~textOpt =
1414
let line, col = pos in
1515
let offsetNoWhite = PartialParser.skipWhite text offset in
1616
let posNoWhite = (line, max 0 col - offset + offsetNoWhite) in
17-
Printf.printf "posNoWhite %s offset:%d offsetNoWhite:%d len:%d\n"
17+
Printf.printf
18+
"posNoWhite %s offset:%d offsetNoWhite:%d len:%d currentChar:%c / %d\n"
1819
(SemanticTokens.posToString posNoWhite)
19-
offset offsetNoWhite (String.length text);
20+
offset offsetNoWhite (String.length text) text.[offset]
21+
(Char.code text.[offset]);
2022

2123
if Filename.check_suffix path ".res" then (
2224
let parser =

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Complete tests/src/CompletePrioritize1.res 4:2
2-
posNoWhite (5,3) offset:106 offsetNoWhite:105 len:110
2+
posNoWhite (5,3) offset:106 offsetNoWhite:105 len:110 currentChar:
3+
/ 10
34
Found expr:(5,2)->(5,4)
45
[{
56
"label": "Test.add",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Complete tests/src/CompletePrioritize2.res 8:2
2-
posNoWhite (9,3) offset:145 offsetNoWhite:144 len:146
2+
posNoWhite (9,3) offset:145 offsetNoWhite:144 len:146 currentChar:
3+
/ 10
34
Found expr:(9,2)->(9,4)
45
[{
56
"label": "Test.add",

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

Lines changed: 52 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Complete tests/src/Completion.res 0:2
2-
posNoWhite (1,8) offset:35 offsetNoWhite:34 len:1968
2+
posNoWhite (1,8) offset:35 offsetNoWhite:34 len:1968 currentChar:
3+
/ 10
34
Found expr:(1,1)->(1,9)
45
[{
56
"label": "mapReverse",
@@ -70,7 +71,8 @@ Found expr:(1,1)->(1,9)
7071
}]
7172

7273
Complete tests/src/Completion.res 1:2
73-
posNoWhite (2,6) offset:49 offsetNoWhite:48 len:1968
74+
posNoWhite (2,6) offset:49 offsetNoWhite:48 len:1968 currentChar:
75+
/ 10
7476
Found expr:(2,1)->(6,6)
7577
[{
7678
"label": "Floatarray",
@@ -291,7 +293,8 @@ Found expr:(2,1)->(6,6)
291293
}]
292294

293295
Complete tests/src/Completion.res 2:2
294-
posNoWhite (3,7) offset:64 offsetNoWhite:63 len:1968
296+
posNoWhite (3,7) offset:64 offsetNoWhite:63 len:1968 currentChar:
297+
/ 10
295298
Found expr:(3,1)->(3,8)
296299
[{
297300
"label": "mapi",
@@ -344,7 +347,8 @@ Found expr:(3,1)->(3,8)
344347
}]
345348

346349
Complete tests/src/Completion.res 12:2
347-
posNoWhite (13,14) offset:251 offsetNoWhite:250 len:1968
350+
posNoWhite (13,14) offset:251 offsetNoWhite:250 len:1968 currentChar:
351+
/ 10
348352
Found expr:(13,10)->(13,15)
349353
[{
350354
"label": "customDouble",
@@ -355,7 +359,8 @@ Found expr:(13,10)->(13,15)
355359
}]
356360

357361
Complete tests/src/Completion.res 19:2
358-
posNoWhite (20,17) offset:400 offsetNoWhite:399 len:1968
362+
posNoWhite (20,17) offset:400 offsetNoWhite:399 len:1968 currentChar:
363+
/ 10
359364
Found expr:(20,9)->(20,18)
360365
[{
361366
"label": "age",
@@ -372,7 +377,8 @@ Found expr:(20,9)->(20,18)
372377
}]
373378

374379
Complete tests/src/Completion.res 21:2
375-
posNoWhite (22,10) offset:419 offsetNoWhite:418 len:1968
380+
posNoWhite (22,10) offset:419 offsetNoWhite:418 len:1968 currentChar:
381+
/ 10
376382
Found expr:(22,1)->(22,11)
377383
Found expr:(22,10)->(22,11)
378384
[{
@@ -390,7 +396,8 @@ Found expr:(22,10)->(22,11)
390396
}]
391397

392398
Complete tests/src/Completion.res 23:2
393-
posNoWhite (24,10) offset:438 offsetNoWhite:437 len:1968
399+
posNoWhite (24,10) offset:438 offsetNoWhite:437 len:1968 currentChar:
400+
/ 10
394401
Found expr:(24,1)->(24,11)
395402
Found expr:(24,8)->(24,11)
396403
[{
@@ -402,7 +409,8 @@ Found expr:(24,8)->(24,11)
402409
}]
403410

404411
Complete tests/src/Completion.res 27:2
405-
posNoWhite (28,5) offset:470 offsetNoWhite:469 len:1968
412+
posNoWhite (28,5) offset:470 offsetNoWhite:469 len:1968 currentChar:
413+
/ 10
406414
Found expr:(28,1)->(28,6)
407415
Found expr:(28,5)->(28,6)
408416
[{
@@ -420,7 +428,8 @@ Found expr:(28,5)->(28,6)
420428
}]
421429

422430
Complete tests/src/Completion.res 36:2
423-
posNoWhite (37,4) offset:604 offsetNoWhite:603 len:1968
431+
posNoWhite (37,4) offset:604 offsetNoWhite:603 len:1968 currentChar:
432+
/ 10
424433
Found expr:(37,1)->(46,3)
425434
Found expr:(37,1)->(41,8)
426435
Found expr:(37,3)->(37,5)
@@ -439,7 +448,8 @@ Found expr:(37,3)->(37,5)
439448
}]
440449

441450
Complete tests/src/Completion.res 38:2
442-
posNoWhite (39,18) offset:631 offsetNoWhite:630 len:1968
451+
posNoWhite (39,18) offset:631 offsetNoWhite:630 len:1968 currentChar:
452+
/ 10
443453
Found expr:(39,1)->(39,19)
444454
Found expr:(39,10)->(39,19)
445455
[{
@@ -457,7 +467,8 @@ Found expr:(39,10)->(39,19)
457467
}]
458468

459469
Complete tests/src/Completion.res 50:2
460-
posNoWhite (51,27) offset:845 offsetNoWhite:844 len:1968
470+
posNoWhite (51,27) offset:845 offsetNoWhite:844 len:1968 currentChar:
471+
/ 10
461472
Found expr:(51,13)->(51,28)
462473
Found expr:(51,27)->(51,28)
463474
[{
@@ -469,7 +480,8 @@ Found expr:(51,27)->(51,28)
469480
}]
470481

471482
Complete tests/src/Completion.res 52:2
472-
posNoWhite (53,20) offset:874 offsetNoWhite:873 len:1968
483+
posNoWhite (53,20) offset:874 offsetNoWhite:873 len:1968 currentChar:
484+
/ 10
473485
Found expr:(53,13)->(53,21)
474486
Found expr:(53,20)->(53,21)
475487
[{
@@ -675,7 +687,8 @@ DocumentSymbol tests/src/Completion.res
675687
]
676688

677689
Complete tests/src/Completion.res 56:2
678-
posNoWhite (57,5) offset:896 offsetNoWhite:895 len:1968
690+
posNoWhite (57,5) offset:896 offsetNoWhite:895 len:1968 currentChar:
691+
/ 10
679692
XXX Not found!
680693
[{
681694
"label": "react.component",
@@ -686,7 +699,8 @@ XXX Not found!
686699
}]
687700

688701
Complete tests/src/Completion.res 58:2
689-
posNoWhite (59,7) offset:912 offsetNoWhite:911 len:1968
702+
posNoWhite (59,7) offset:912 offsetNoWhite:911 len:1968 currentChar:
703+
/ 10
690704
Found expr:(0,-1)->(69,17)
691705
[{
692706
"label": "component",
@@ -697,7 +711,8 @@ Found expr:(0,-1)->(69,17)
697711
}]
698712

699713
Complete tests/src/Completion.res 60:2
700-
posNoWhite (61,24) offset:945 offsetNoWhite:944 len:1968
714+
posNoWhite (61,24) offset:945 offsetNoWhite:944 len:1968 currentChar:
715+
/ 10
701716
Found expr:(61,9)->(61,25)
702717
[{
703718
"label": "age",
@@ -708,7 +723,8 @@ Found expr:(61,9)->(61,25)
708723
}]
709724

710725
Complete tests/src/Completion.res 62:2
711-
posNoWhite (63,23) offset:977 offsetNoWhite:976 len:1968
726+
posNoWhite (63,23) offset:977 offsetNoWhite:976 len:1968 currentChar:
727+
/ 10
712728
Found expr:(63,9)->(63,24)
713729
[{
714730
"label": "name",
@@ -719,7 +735,8 @@ Found expr:(63,9)->(63,24)
719735
}]
720736

721737
Complete tests/src/Completion.res 64:2
722-
posNoWhite (65,29) offset:1015 offsetNoWhite:1014 len:1968
738+
posNoWhite (65,29) offset:1015 offsetNoWhite:1014 len:1968 currentChar:
739+
/ 10
723740
Found expr:(65,9)->(65,30)
724741
[{
725742
"label": "name",
@@ -730,7 +747,8 @@ Found expr:(65,9)->(65,30)
730747
}]
731748

732749
Complete tests/src/Completion.res 67:2
733-
posNoWhite (68,1) offset:1049 offsetNoWhite:1048 len:1968
750+
posNoWhite (68,1) offset:1049 offsetNoWhite:1048 len:1968 currentChar:
751+
/ 10
734752
Found expr:(67,8)->(69,17)
735753
[{
736754
"label": "age",
@@ -747,7 +765,8 @@ Found expr:(67,8)->(69,17)
747765
}]
748766

749767
Complete tests/src/Completion.res 72:2
750-
posNoWhite (73,10) offset:1126 offsetNoWhite:1125 len:1968
768+
posNoWhite (73,10) offset:1126 offsetNoWhite:1125 len:1968 currentChar:
769+
/ 10
751770
Found expr:(73,8)->(75,18)
752771
[{
753772
"label": "age",
@@ -758,7 +777,8 @@ Found expr:(73,8)->(75,18)
758777
}]
759778

760779
Complete tests/src/Completion.res 76:2
761-
posNoWhite (77,21) offset:1212 offsetNoWhite:1211 len:1968
780+
posNoWhite (77,21) offset:1212 offsetNoWhite:1211 len:1968 currentChar:
781+
/ 10
762782
Found expr:(77,20)->(80,10)
763783
[{
764784
"label": "age",
@@ -775,7 +795,8 @@ Found expr:(77,20)->(80,10)
775795
}]
776796

777797
Complete tests/src/Completion.res 79:2
778-
posNoWhite (80,4) offset:1257 offsetNoWhite:1256 len:1968
798+
posNoWhite (80,4) offset:1257 offsetNoWhite:1256 len:1968 currentChar:
799+
/ 10
779800
Found expr:(80,2)->(82,20)
780801
[{
781802
"label": "age",
@@ -786,7 +807,8 @@ Found expr:(80,2)->(82,20)
786807
}]
787808

788809
Complete tests/src/Completion.res 83:2
789-
posNoWhite (84,14) offset:1355 offsetNoWhite:1354 len:1968
810+
posNoWhite (84,14) offset:1355 offsetNoWhite:1354 len:1968 currentChar:
811+
/ 10
790812
Found expr:(84,13)->(101,20)
791813
[{
792814
"label": "name",
@@ -803,7 +825,8 @@ Found expr:(84,13)->(101,20)
803825
}]
804826

805827
Complete tests/src/Completion.res 88:3
806-
posNoWhite (89,2) offset:1437 offsetNoWhite:1436 len:1967
828+
posNoWhite (89,2) offset:1437 offsetNoWhite:1436 len:1967 currentChar:
829+
/ 10
807830
Found expr:(89,1)->(93,3)
808831
[{
809832
"label": "x",
@@ -820,7 +843,8 @@ Found expr:(89,1)->(93,3)
820843
}]
821844

822845
Complete tests/src/Completion.res 90:3
823-
posNoWhite (91,18) offset:1465 offsetNoWhite:1464 len:1967
846+
posNoWhite (91,18) offset:1465 offsetNoWhite:1464 len:1967 currentChar:
847+
/ 10
824848
Found expr:(91,1)->(93,3)
825849
[{
826850
"label": "xx",
@@ -837,7 +861,8 @@ Found expr:(91,1)->(93,3)
837861
}]
838862

839863
Complete tests/src/Completion.res 96:3
840-
posNoWhite (97,2) offset:1551 offsetNoWhite:1550 len:1967
864+
posNoWhite (97,2) offset:1551 offsetNoWhite:1550 len:1967 currentChar:
865+
/ 10
841866
Found expr:(96,11)->(99,1)
842867
Found expr:(97,1)->(98,5)
843868
Found expr:(97,1)->(97,3)
@@ -850,7 +875,8 @@ Found expr:(97,1)->(97,3)
850875
}]
851876

852877
Complete tests/src/Completion.res 100:3
853-
posNoWhite (101,12) offset:1584 offsetNoWhite:1583 len:1967
878+
posNoWhite (101,12) offset:1584 offsetNoWhite:1583 len:1967 currentChar:
879+
/ 10
854880
Found expr:(101,11)->(120,32)
855881
[{
856882
"label": "name",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ TypeDefinition tests/src/Cross.res 37:37
9494
{"uri": "DefinitionWithInterface.resi", "range": {"start": {"line": 3, "character": 0}, "end": {"line": 3, "character": 6}}}
9595

9696
Complete tests/src/Cross.res 39:2
97-
posNoWhite (40,25) offset:856 offsetNoWhite:855 len:857
97+
posNoWhite (40,25) offset:856 offsetNoWhite:855 len:857 currentChar:
98+
/ 10
9899
Found expr:(40,1)->(40,26)
99100
[]
100101

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ Hover tests/src/Div.res 1:10
22
{"contents": "```rescript\n(\n string,\n ~props: ReactDOMRe.domProps=?,\n array<React.element>,\n) => React.element\n```"}
33

44
Complete tests/src/Div.res 3:3
5-
posNoWhite (4,14) offset:53 offsetNoWhite:52 len:54
5+
posNoWhite (4,14) offset:53 offsetNoWhite:52 len:54 currentChar:
6+
/ 10
67
Found expr:(4,2)->(4,15)
78
Found expr:(4,6)->(4,15)
89
[{

0 commit comments

Comments
 (0)