mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
completions: Don't suggest "null" where not allowed
This commit is contained in:
parent
67983aee2e
commit
72319b29c6
1 changed files with 9 additions and 5 deletions
|
@ -32,6 +32,7 @@ from .completions_utils import (
|
|||
get_sort_key,
|
||||
new_statement_patterns,
|
||||
)
|
||||
from .language.contexts import ValueTypeCtx
|
||||
from .language.types import ClassName
|
||||
from .lsp_utils import Completion, CompletionItemKind, TextEdit, get_docs_section
|
||||
from .parser import SKIP_TOKENS
|
||||
|
@ -320,6 +321,8 @@ def prop_value_completer(ctx: CompletionContext):
|
|||
)
|
||||
|
||||
if (vt := ctx.ast_node.value_type) is not None:
|
||||
assert isinstance(vt, ValueTypeCtx)
|
||||
|
||||
if isinstance(vt.value_type, gir.Enumeration):
|
||||
for name, member in vt.value_type.members.items():
|
||||
yield Completion(
|
||||
|
@ -345,6 +348,7 @@ def prop_value_completer(ctx: CompletionContext):
|
|||
elif isinstance(vt.value_type, gir.Class) or isinstance(
|
||||
vt.value_type, gir.Interface
|
||||
):
|
||||
if vt.allow_null:
|
||||
yield Completion(
|
||||
"null",
|
||||
CompletionItemKind.Constant,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue