Use typelib instead of XML

For normal compilation, use .typelib files rather than .gir XML files.
This is much faster.

Rather than using libgirepository, which would try to actually load the
libraries, we use a custom parser.

The language server will still read XML because it needs to access
documentation, which is not in the typelib, but that's generally fine
because it's a long lived process and only has to do that once.
This commit is contained in:
James Westman 2022-03-05 17:54:27 -06:00
parent e78fae4f12
commit 06f54c8ff8
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
10 changed files with 647 additions and 170 deletions

View file

@ -153,7 +153,7 @@ class IdentValue(Value):
def validate_for_type(self):
type = self.parent.value_type
if isinstance(type, gir.Enumeration) or isinstance(type, gir.Bitfield):
if isinstance(type, gir.Enumeration):
if self.tokens["value"] not in type.members:
raise CompileError(
f"{self.tokens['value']} is not a member of {type.full_name}",
@ -183,7 +183,7 @@ class IdentValue(Value):
@docs()
def docs(self):
type = self.parent.value_type
if isinstance(type, gir.Enumeration) or isinstance(type, gir.Bitfield):
if isinstance(type, gir.Enumeration):
if member := type.members.get(self.tokens["value"]):
return member.doc
else: