mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
tests: Test that docs & completions don't crash
This commit is contained in:
parent
6576e02837
commit
3f37380c25
4 changed files with 21 additions and 5 deletions
|
@ -24,7 +24,7 @@ from ..errors import CompileError, MultipleErrors
|
|||
from ..completions_utils import *
|
||||
from .. import decompiler as decompile
|
||||
from ..decompiler import DecompileCtx, decompiler
|
||||
from ..gir import StringType, BoolType, IntType, FloatType, GirType
|
||||
from ..gir import StringType, BoolType, IntType, FloatType, GirType, Enumeration
|
||||
from ..lsp_utils import Completion, CompletionItemKind, SemanticToken, SemanticTokenType
|
||||
from ..parse_tree import *
|
||||
from ..parser_utils import *
|
||||
|
|
|
@ -94,11 +94,12 @@ def get_types(gir):
|
|||
}
|
||||
|
||||
def _get_docs(gir, name):
|
||||
return (
|
||||
if gir_type := (
|
||||
gir.get_type("AccessibleProperty", "Gtk").members.get(name)
|
||||
or gir.get_type("AccessibleRelation", "Gtk").members.get(name)
|
||||
or gir.get_type("AccessibleState", "Gtk").members.get(name)
|
||||
).doc
|
||||
):
|
||||
return gir_type.doc
|
||||
|
||||
|
||||
class A11yProperty(BaseTypedAttribute):
|
||||
|
|
|
@ -112,10 +112,10 @@ class Flag(AstNode):
|
|||
@docs()
|
||||
def docs(self):
|
||||
type = self.parent.parent.value_type
|
||||
if not isinstance(type, Enumeration):
|
||||
return
|
||||
if member := type.members.get(self.tokens["value"]):
|
||||
return member.doc
|
||||
else:
|
||||
return type.doc
|
||||
|
||||
@validate()
|
||||
def validate_for_type(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue