@@ -179,7 +179,7 @@ defmodule ElixirLS.LanguageServer.Providers.DocumentSymbols do
179
179
defp extract_symbol ( _current_module , { :@ , location , [ { type_kind , _ , type_expression } ] } )
180
180
when type_kind in [ :type , :typep , :opaque , :callback , :macrocallback ] and
181
181
not is_nil ( type_expression ) do
182
- { type_name , type_head_location } =
182
+ type_name_location =
183
183
case type_expression do
184
184
[ { :"::" , _ , [ { _ , type_head_location , _ } = type_head | _ ] } ] ->
185
185
{ Macro . to_string ( type_head ) , type_head_location }
@@ -189,22 +189,29 @@ defmodule ElixirLS.LanguageServer.Providers.DocumentSymbols do
189
189
190
190
[ { _ , type_head_location , _ } = type_head | _ ] ->
191
191
{ Macro . to_string ( type_head ) , type_head_location }
192
+
193
+ _ ->
194
+ nil
192
195
end
193
196
194
- type_name =
195
- type_name
196
- |> String . replace ( "\n " , "" )
197
+ if type_name_location do
198
+ { type_name , type_head_location } = type_name_location
197
199
198
- type = if type_kind in [ :type , :typep , :opaque ] , do: :class , else: :event
200
+ type_name =
201
+ type_name
202
+ |> String . replace ( "\n " , "" )
199
203
200
- % Info {
201
- type: type ,
202
- name: "@#{ type_kind } #{ type_name } " ,
203
- location: location ,
204
- selection_location: type_head_location ,
205
- symbol: "#{ type_name } " ,
206
- children: [ ]
207
- }
204
+ type = if type_kind in [ :type , :typep , :opaque ] , do: :class , else: :event
205
+
206
+ % Info {
207
+ type: type ,
208
+ name: "@#{ type_kind } #{ type_name } " ,
209
+ location: location ,
210
+ selection_location: type_head_location ,
211
+ symbol: "#{ type_name } " ,
212
+ children: [ ]
213
+ }
214
+ end
208
215
end
209
216
210
217
# @behaviour BehaviourModule
0 commit comments