Compare commits

...

3 commits

Author SHA1 Message Date
Giovanni Santini
539ed5d4df Merge branch 'main' into 'main'
fix: Make `command` required

Closes #122

See merge request jwestman/blueprint-compiler!135
2025-04-07 12:58:19 +00:00
James Westman
f50b898e4c adw_breakpoint: Fix crash in language server
Fix a crash that happened when an AdwBreakpointSetter rule was
incomplete, such as when you're still typing it. Fixes #189.
2025-04-01 19:27:59 -05:00
Giovanni Santini
c683254761 fix: Make command required
This solves a weird issue where the help function is executed everytime
even when we specify a command.

Fixes #122.
2023-08-01 11:55:33 +02:00
3 changed files with 10 additions and 5 deletions

View file

@ -81,8 +81,8 @@ class AdwBreakpointSetter(AstNode):
return self.tokens["property"]
@property
def value(self) -> Value:
return self.children[Value][0]
def value(self) -> T.Optional[Value]:
return self.children[Value][0] if len(self.children[Value]) > 0 else None
@property
def gir_class(self) -> T.Optional[GirType]:
@ -106,7 +106,10 @@ class AdwBreakpointSetter(AstNode):
return None
@property
def document_symbol(self) -> DocumentSymbol:
def document_symbol(self) -> T.Optional[DocumentSymbol]:
if self.value is None:
return None
return DocumentSymbol(
f"{self.object_id}.{self.property_name}",
SymbolKind.Property,

View file

@ -39,8 +39,7 @@ LIBDIR = None
class BlueprintApp:
def main(self):
self.parser = argparse.ArgumentParser()
self.subparsers = self.parser.add_subparsers(metavar="command")
self.parser.set_defaults(func=self.cmd_help)
self.subparsers = self.parser.add_subparsers(metavar="command", required=True)
compile = self.add_subcommand(
"compile", "Compile blueprint files", self.cmd_compile

View file

@ -308,6 +308,9 @@ class XmlOutput(OutputFormat):
elif isinstance(extension, AdwBreakpointSetters):
for setter in extension.setters:
if setter.value is None:
continue
attrs = {}
if isinstance(setter.value.child, Translated):