@@ -190,13 +190,20 @@ defmodule ElixirLS.LanguageServer.Providers.DocumentSymbols do
190
190
191
191
type = if type_kind in [ :type , :typep , :opaque ] , do: :class , else: :event
192
192
193
+ name_str =
194
+ try do
195
+ to_string ( name )
196
+ rescue
197
+ _ -> "__unknown__"
198
+ end
199
+
193
200
% Info {
194
201
type: type ,
195
- name: "#{ name } /#{ length ( args || [ ] ) } " ,
202
+ name: "#{ name_str } /#{ length ( args || [ ] ) } " ,
196
203
detail: "@#{ type_kind } " ,
197
204
location: location ,
198
205
selection_location: type_head_location ,
199
- symbol: to_string ( name ) ,
206
+ symbol: name_str ,
200
207
children: [ ]
201
208
}
202
209
end
@@ -220,10 +227,17 @@ defmodule ElixirLS.LanguageServer.Providers.DocumentSymbols do
220
227
{ defname , location , [ { :when , _ , [ { name , head_location , args } = _fn_head , _ ] } | _ ] }
221
228
)
222
229
when defname in @ defs do
230
+ name_str =
231
+ try do
232
+ to_string ( name )
233
+ rescue
234
+ _ -> "__unknown__"
235
+ end
236
+
223
237
% Info {
224
238
type: if ( defname in @ macro_defs , do: :constant , else: :function ) ,
225
- symbol: to_string ( name ) ,
226
- name: "#{ to_string ( name ) } /#{ length ( args || [ ] ) } " ,
239
+ symbol: name_str ,
240
+ name: "#{ name_str } /#{ length ( args || [ ] ) } " ,
227
241
detail: defname ,
228
242
location: location ,
229
243
selection_location: head_location ,
@@ -237,10 +251,17 @@ defmodule ElixirLS.LanguageServer.Providers.DocumentSymbols do
237
251
{ defname , location , [ { name , head_location , args } = _fn_head | _ ] }
238
252
)
239
253
when defname in @ defs do
254
+ name_str =
255
+ try do
256
+ to_string ( name )
257
+ rescue
258
+ _ -> "__unknown__"
259
+ end
260
+
240
261
% Info {
241
262
type: if ( defname in @ macro_defs , do: :constant , else: :function ) ,
242
- symbol: to_string ( name ) ,
243
- name: "#{ to_string ( name ) } /#{ length ( args || [ ] ) } " ,
263
+ symbol: name_str ,
264
+ name: "#{ name_str } /#{ length ( args || [ ] ) } " ,
244
265
detail: defname ,
245
266
location: location ,
246
267
selection_location: head_location ,
0 commit comments