diff --git a/docs/examples.rst b/docs/examples.rst index c3100cc..27617c3 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -199,7 +199,7 @@ Basic Usage .. code-block:: Gtk.Label { - style "dim-label", "title"; + styles: ["dim-label", "title"]; } diff --git a/gtkblueprinttool/extensions/gtk_file_filter.py b/gtkblueprinttool/extensions/gtk_file_filter.py index a6dfaf6..90a23f3 100644 --- a/gtkblueprinttool/extensions/gtk_file_filter.py +++ b/gtkblueprinttool/extensions/gtk_file_filter.py @@ -49,6 +49,7 @@ def create_node(tag_name: str, singular: str): Keyword(tag_name), UseLiteral("tag_name", tag_name), Op(":"), + OpenBracket(), Delimited( Group( FilterString, @@ -59,6 +60,7 @@ def create_node(tag_name: str, singular: str): ), Comma(), ), + CloseBracket(), ) ) @@ -75,7 +77,7 @@ suffixes = create_node("suffixes", "suffix") def file_filter_completer(ast_node, match_variables): file_filter = ast_node.root.gir.get_type("FileFilter", "Gtk") if ast_node.gir_class and ast_node.gir_class.assignable_to(file_filter): - yield Completion("mime-types", CompletionItemKind.Snippet, snippet="mime-types \"$0\";") - yield Completion("patterns", CompletionItemKind.Snippet, snippet="patterns \"$0\";") - yield Completion("suffixes", CompletionItemKind.Snippet, snippet="suffixes \"$0\";") + yield Completion("mime-types", CompletionItemKind.Snippet, snippet="mime-types: [\"$0\"];") + yield Completion("patterns", CompletionItemKind.Snippet, snippet="patterns: [\"$0\"];") + yield Completion("suffixes", CompletionItemKind.Snippet, snippet="suffixes: [\"$0\"];") diff --git a/gtkblueprinttool/extensions/gtk_styles.py b/gtkblueprinttool/extensions/gtk_styles.py index 5c9cd21..17a7b89 100644 --- a/gtkblueprinttool/extensions/gtk_styles.py +++ b/gtkblueprinttool/extensions/gtk_styles.py @@ -43,7 +43,9 @@ class StyleClass(AstNode): styles = Group( Styles, Statement( - Keyword("style"), + Keyword("styles"), + Op(":"), + OpenBracket(), Delimited( Group( StyleClass, @@ -51,6 +53,7 @@ styles = Group( ), Comma(), ), + CloseBracket(), ) ) @@ -60,5 +63,5 @@ styles = Group( matches=new_statement_patterns, ) def style_completer(ast_node, match_variables): - yield Completion("style", CompletionItemKind.Keyword, snippet="style \"$0\";") + yield Completion("styles", CompletionItemKind.Keyword, snippet="styles: [\"$0\"];") diff --git a/tests/samples/file_filter.blp b/tests/samples/file_filter.blp index 1164434..8c91014 100644 --- a/tests/samples/file_filter.blp +++ b/tests/samples/file_filter.blp @@ -2,7 +2,7 @@ using Gtk 4.0; FileFilter { name: "File Filter Name"; - mime-types: "text/plain", "image/ *"; - patterns: "*.txt"; - suffixes: "png"; + mime-types: ["text/plain", "image/ *"]; + patterns: ["*.txt"]; + suffixes: ["png"]; } diff --git a/tests/samples/style.blp b/tests/samples/style.blp index 6d47e49..fc3f023 100644 --- a/tests/samples/style.blp +++ b/tests/samples/style.blp @@ -1,5 +1,5 @@ using Gtk 4.0; Label { - style "class-1", "class-2"; + styles: ["class-1", "class-2"]; }