completions: property_completer improvements

This commit is contained in:
z00000000z 2023-08-23 16:21:37 +00:00 committed by James Westman
parent 582502c1b4
commit bcac788456
15 changed files with 76 additions and 33 deletions

View file

@ -141,7 +141,7 @@ class ExtAdwMessageDialog(AstNode):
applies_in_subclass=("Adw", "MessageDialog"),
matches=new_statement_patterns,
)
def style_completer(ast_node, match_variables):
def style_completer(lsp, ast_node, match_variables):
yield Completion(
"responses", CompletionItemKind.Keyword, snippet="responses [\n\t$0\n]"
)

View file

@ -204,7 +204,7 @@ class ExtAccessibility(AstNode):
applies_in=[ObjectContent],
matches=new_statement_patterns,
)
def a11y_completer(ast_node, match_variables):
def a11y_completer(lsp, ast_node, match_variables):
yield Completion(
"accessibility", CompletionItemKind.Snippet, snippet="accessibility {\n $0\n}"
)
@ -214,7 +214,7 @@ def a11y_completer(ast_node, match_variables):
applies_in=[ExtAccessibility],
matches=new_statement_patterns,
)
def a11y_name_completer(ast_node, match_variables):
def a11y_name_completer(lsp, ast_node, match_variables):
for name, type in get_types(ast_node.root.gir).items():
yield Completion(
name,

View file

@ -87,5 +87,5 @@ class ExtComboBoxItems(AstNode):
applies_in_subclass=("Gtk", "ComboBoxText"),
matches=new_statement_patterns,
)
def items_completer(ast_node, match_variables):
def items_completer(lsp, ast_node, match_variables):
yield Completion("items", CompletionItemKind.Snippet, snippet="items [$0]")

View file

@ -104,7 +104,7 @@ ext_file_filter_suffixes = create_node("suffixes", "suffix")
applies_in_subclass=("Gtk", "FileFilter"),
matches=new_statement_patterns,
)
def file_filter_completer(ast_node, match_variables):
def file_filter_completer(lsp, ast_node, match_variables):
yield Completion(
"mime-types", CompletionItemKind.Snippet, snippet='mime-types ["$0"]'
)

View file

@ -89,7 +89,7 @@ class ExtLayout(AstNode):
applies_in_subclass=("Gtk", "Widget"),
matches=new_statement_patterns,
)
def layout_completer(ast_node, match_variables):
def layout_completer(lsp, ast_node, match_variables):
yield Completion("layout", CompletionItemKind.Snippet, snippet="layout {\n $0\n}")

View file

@ -221,7 +221,7 @@ from .ui import UI
applies_in=[UI],
matches=new_statement_patterns,
)
def menu_completer(ast_node, match_variables):
def menu_completer(lsp, ast_node, match_variables):
yield Completion("menu", CompletionItemKind.Snippet, snippet="menu {\n $0\n}")
@ -229,7 +229,7 @@ def menu_completer(ast_node, match_variables):
applies_in=[Menu],
matches=new_statement_patterns,
)
def menu_content_completer(ast_node, match_variables):
def menu_content_completer(lsp, ast_node, match_variables):
yield Completion(
"submenu", CompletionItemKind.Snippet, snippet="submenu {\n $0\n}"
)

View file

@ -129,14 +129,14 @@ class ExtScaleMarks(AstNode):
applies_in_subclass=("Gtk", "Scale"),
matches=new_statement_patterns,
)
def complete_marks(ast_node, match_variables):
def complete_marks(lsp, ast_node, match_variables):
yield Completion("marks", CompletionItemKind.Keyword, snippet="marks [\n\t$0\n]")
@completer(
applies_in=[ExtScaleMarks],
)
def complete_mark(ast_node, match_variables):
def complete_mark(lsp, ast_node, match_variables):
yield Completion("mark", CompletionItemKind.Keyword, snippet="mark ($0),")

View file

@ -94,5 +94,5 @@ class ExtSizeGroupWidgets(AstNode):
applies_in_subclass=("Gtk", "SizeGroup"),
matches=new_statement_patterns,
)
def size_group_completer(ast_node, match_variables):
def size_group_completer(lsp, ast_node, match_variables):
yield Completion("widgets", CompletionItemKind.Snippet, snippet="widgets [$0]")

View file

@ -71,5 +71,5 @@ class ExtStringListStrings(AstNode):
applies_in_subclass=("Gtk", "StringList"),
matches=new_statement_patterns,
)
def strings_completer(ast_node, match_variables):
def strings_completer(lsp, ast_node, match_variables):
yield Completion("strings", CompletionItemKind.Snippet, snippet="strings [$0]")

View file

@ -76,7 +76,7 @@ class ExtStyles(AstNode):
applies_in_subclass=("Gtk", "Widget"),
matches=new_statement_patterns,
)
def style_completer(ast_node, match_variables):
def style_completer(lsp, ast_node, match_variables):
yield Completion("styles", CompletionItemKind.Keyword, snippet='styles ["$0"]')