File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -491,6 +491,10 @@ def parse_docstring comments
491
491
# HACK: Pass a dummy code object to the parser for plugins that
492
492
# expect it not to be nil
493
493
YARD ::Docstring . parser . parse ( comments , YARD ::CodeObjects ::Base . new ( :root , 'stub' ) )
494
+ rescue StandardError => e
495
+ Solargraph . logger . info "YARD failed to parse docstring: [#{ e . class } ] #{ e . message } "
496
+ Solargraph . logger . debug "Unparsed comment: #{ comments } "
497
+ YARD ::Docstring . parser
494
498
end
495
499
end
496
500
end
Original file line number Diff line number Diff line change @@ -317,4 +317,10 @@ class Foo
317
317
)
318
318
expect ( source . string_ranges . length ) . to eq ( 4 )
319
319
end
320
+
321
+ it 'handles errors in docstrings' do
322
+ # YARD has a known problem with empty @overload tags
323
+ comments = "@overload\n @return [String]"
324
+ expect { Solargraph ::Source . parse_docstring ( comments ) } . not_to raise_error
325
+ end
320
326
end
You can’t perform that action at this time.
0 commit comments