gir: Gracefully handle missing .gir files

They aren't required for compilation anymore, and not being able to show
documentation on hover is probably not worth crashing the language
server over.
This commit is contained in:
James Westman 2022-06-24 17:16:51 -05:00
parent 06f54c8ff8
commit c5f2e4ed4b
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6

View file

@ -214,9 +214,14 @@ class GirNode:
if self.signature:
sections.append("```\n" + self.signature + "\n```")
try:
el = self.xml.get_elements("doc")
if len(el) == 1:
sections.append(el[0].cdata.strip())
except:
# Not a huge deal, but if you want docs in the language server you
# should ensure .gir files are installed
pass
return "\n\n---\n\n".join(sections)