mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
lsp: Add document outline
This commit is contained in:
parent
950b141d26
commit
e087aeb44f
24 changed files with 469 additions and 28 deletions
|
@ -36,6 +36,16 @@ class LayoutProperty(AstNode):
|
|||
def value(self) -> Value:
|
||||
return self.children[Value][0]
|
||||
|
||||
@property
|
||||
def document_symbol(self) -> DocumentSymbol:
|
||||
return DocumentSymbol(
|
||||
self.name,
|
||||
SymbolKind.Field,
|
||||
self.range,
|
||||
self.group.tokens["name"].range,
|
||||
self.value.range.text,
|
||||
)
|
||||
|
||||
@context(ValueTypeCtx)
|
||||
def value_type(self) -> ValueTypeCtx:
|
||||
# there isn't really a way to validate these
|
||||
|
@ -56,6 +66,15 @@ class ExtLayout(AstNode):
|
|||
Until(LayoutProperty, "}"),
|
||||
)
|
||||
|
||||
@property
|
||||
def document_symbol(self) -> DocumentSymbol:
|
||||
return DocumentSymbol(
|
||||
"layout",
|
||||
SymbolKind.Struct,
|
||||
self.range,
|
||||
self.group.tokens["layout"].range,
|
||||
)
|
||||
|
||||
@validate("layout")
|
||||
def container_is_widget(self):
|
||||
validate_parent_type(self, "Gtk", "Widget", "layout properties")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue