7
7
]).
8
8
9
9
-include (" els_lsp.hrl" ).
10
- - include_lib ( " kernel/include/logger.hrl " ).
10
+
11
11
% %==============================================================================
12
12
% % els_provider functions
13
13
% %==============================================================================
@@ -24,19 +24,13 @@ handle_request({definition, Params}) ->
24
24
POIs = els_dt_document :get_element_at_pos (Document , Line + 1 , Character + 1 ),
25
25
case goto_definition (Uri , POIs ) of
26
26
null ->
27
- ? LOG_INFO (" goto defintion failed" , []),
28
- #{
29
- text := Text
30
- } = Document ,
27
+ #{text := Text } = Document ,
31
28
IncompletePOIs = match_incomplete (Text , {Line , Character }),
32
- ? LOG_INFO (" Incomplete pois: ~p " , [IncompletePOIs ]),
33
29
case goto_definition (Uri , IncompletePOIs ) of
34
30
null ->
35
- Fuzzy = make_fuzzy (POIs ),
36
- ? LOG_INFO (" FUZZY: ~p " , [Fuzzy ]),
37
- case goto_definition (Uri , Fuzzy ) of
31
+ FuzzyPOIs = make_fuzzy (POIs ),
32
+ case goto_definition (Uri , FuzzyPOIs ) of
38
33
null ->
39
- ? LOG_INFO (" goto defintion failed AGAIN" , []),
40
34
els_references_provider :handle_request ({references , Params });
41
35
GoTo ->
42
36
{response , GoTo }
@@ -45,11 +39,10 @@ handle_request({definition, Params}) ->
45
39
{response , GoTo }
46
40
end ;
47
41
GoTo ->
48
- ? LOG_INFO (" goto??? ~p " , [GoTo ]),
49
42
{response , GoTo }
50
43
end .
51
44
52
- -spec make_fuzzy (els_poi :poi ()) -> els_poi :poi () | foo_bar_baz ( 1 ) .
45
+ -spec make_fuzzy ([ els_poi :poi ()] ) -> [ els_poi :poi ()] .
53
46
make_fuzzy (POIs ) ->
54
47
lists :flatmap (
55
48
fun
@@ -82,6 +75,10 @@ make_fuzzy(POIs) ->
82
75
POI #{id => M },
83
76
POI #{id => {M , any_arity }}
84
77
];
78
+ (#{kind := macro , id := M } = POI ) ->
79
+ [
80
+ POI #{id => {M , any_arity }}
81
+ ];
85
82
(#{kind := atom , id := Id } = POI ) ->
86
83
[
87
84
POI #{id => {Id , any_arity }, kind => application },
@@ -105,10 +102,8 @@ goto_definition(Uri, [#{id := FunId, kind := function} = POI | Rest]) ->
105
102
% % cursor is not over a function - continue
106
103
case els_code_navigation :goto_definition (Uri , POI ) of
107
104
{ok , Definitions } ->
108
- ? LOG_INFO (" found definitions: ~p " , [Definitions ]),
109
105
goto_definitions_to_goto (Definitions );
110
106
_ ->
111
- ? LOG_INFO (" try rest..." ),
112
107
goto_definition (Uri , Rest )
113
108
end ;
114
109
Behaviours ->
@@ -124,14 +119,11 @@ goto_definition(Uri, [#{id := FunId, kind := function} = POI | Rest]) ->
124
119
goto_definitions_to_goto (Definitions )
125
120
end
126
121
end ;
127
- goto_definition (Uri , [#{id := Id } = POI | Rest ]) ->
128
- ? LOG_INFO (" goto: ~p " , [Id ]),
122
+ goto_definition (Uri , [POI | Rest ]) ->
129
123
case els_code_navigation :goto_definition (Uri , POI ) of
130
124
{ok , Definitions } ->
131
- ? LOG_INFO (" got definitions: ~p " , [Definitions ]),
132
125
goto_definitions_to_goto (Definitions );
133
126
_ ->
134
- ? LOG_INFO (" try rest... ~p " , [Rest ]),
135
127
goto_definition (Uri , Rest )
136
128
end .
137
129
0 commit comments