@@ -34,7 +34,8 @@ code_actions(Uri, Range, #{<<"diagnostics">> := Diagnostics}) ->
3434 lists :flatten ([make_code_actions (Uri , D ) || D <- Diagnostics ]) ++
3535 wrangler_handler :get_code_actions (Uri , Range ) ++
3636 els_code_actions :extract_function (Uri , Range ) ++
37- els_code_actions :bump_variables (Uri , Range )
37+ els_code_actions :bump_variables (Uri , Range ) ++
38+ els_code_actions :browse_docs (Uri , Range )
3839 ).
3940
4041-spec make_code_actions (uri (), map ()) -> [map ()].
@@ -43,35 +44,38 @@ make_code_actions(
4344 #{<<" message" >> := Message , <<" range" >> := Range } = Diagnostic
4445) ->
4546 Data = maps :get (<<" data" >>, Diagnostic , <<>>),
46- make_code_actions (
47- [
48- {" function (.*) is unused" , fun els_code_actions :export_function /4 },
49- {" variable '(.*)' is unused" , fun els_code_actions :ignore_variable /4 },
50- {" variable '(.*)' is unbound" , fun els_code_actions :suggest_variable /4 },
51- {" undefined macro '(.*)'" , fun els_code_actions :add_include_lib_macro /4 },
52- {" undefined macro '(.*)'" , fun els_code_actions :define_macro /4 },
53- {" undefined macro '(.*)'" , fun els_code_actions :suggest_macro /4 },
54- {" record (.*) undefined" , fun els_code_actions :add_include_lib_record /4 },
55- {" record (.*) undefined" , fun els_code_actions :define_record /4 },
56- {" record (.*) undefined" , fun els_code_actions :suggest_record /4 },
57- {" field (.*) undefined in record (.*)" , fun els_code_actions :suggest_record_field /4 },
58- {" Module name '(.*)' does not match file name '(.*)'" ,
59- fun els_code_actions :fix_module_name /4 },
60- {" Unused macro: (.*)" , fun els_code_actions :remove_macro /4 },
61- {" function (.*) undefined" , fun els_code_actions :create_function /4 },
62- {" function (.*) undefined" , fun els_code_actions :suggest_function /4 },
63- {" Cannot find definition for function (.*)" , fun els_code_actions :suggest_function /4 },
64- {" Cannot find module (.*)" , fun els_code_actions :suggest_module /4 },
65- {" Unused file: (.*)" , fun els_code_actions :remove_unused /4 },
66- {" Atom typo\\ ? Did you mean: (.*)" , fun els_code_actions :fix_atom_typo /4 },
67- {" undefined callback function (.*) \\ \( behaviour '(.*)'\\ \) " ,
68- fun els_code_actions :undefined_callback /4 }
69- ],
70- Uri ,
71- Range ,
72- Data ,
73- Message
74- ).
47+ els_code_actions :browse_error (Diagnostic ) ++
48+ make_code_actions (
49+ [
50+ {" function (.*) is unused" , fun els_code_actions :export_function /4 },
51+ {" variable '(.*)' is unused" , fun els_code_actions :ignore_variable /4 },
52+ {" variable '(.*)' is unbound" , fun els_code_actions :suggest_variable /4 },
53+ {" undefined macro '(.*)'" , fun els_code_actions :add_include_lib_macro /4 },
54+ {" undefined macro '(.*)'" , fun els_code_actions :define_macro /4 },
55+ {" undefined macro '(.*)'" , fun els_code_actions :suggest_macro /4 },
56+ {" record (.*) undefined" , fun els_code_actions :add_include_lib_record /4 },
57+ {" record (.*) undefined" , fun els_code_actions :define_record /4 },
58+ {" record (.*) undefined" , fun els_code_actions :suggest_record /4 },
59+ {" field (.*) undefined in record (.*)" ,
60+ fun els_code_actions :suggest_record_field /4 },
61+ {" Module name '(.*)' does not match file name '(.*)'" ,
62+ fun els_code_actions :fix_module_name /4 },
63+ {" Unused macro: (.*)" , fun els_code_actions :remove_macro /4 },
64+ {" function (.*) undefined" , fun els_code_actions :create_function /4 },
65+ {" function (.*) undefined" , fun els_code_actions :suggest_function /4 },
66+ {" Cannot find definition for function (.*)" ,
67+ fun els_code_actions :suggest_function /4 },
68+ {" Cannot find module (.*)" , fun els_code_actions :suggest_module /4 },
69+ {" Unused file: (.*)" , fun els_code_actions :remove_unused /4 },
70+ {" Atom typo\\ ? Did you mean: (.*)" , fun els_code_actions :fix_atom_typo /4 },
71+ {" undefined callback function (.*) \\ \( behaviour '(.*)'\\ \) " ,
72+ fun els_code_actions :undefined_callback /4 }
73+ ],
74+ Uri ,
75+ Range ,
76+ Data ,
77+ Message
78+ ).
7579
7680-spec make_code_actions ([{string (), Fun }], uri (), range (), binary (), binary ()) ->
7781 [map ()]
0 commit comments