mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Change menu item shorthand syntax
I'm changing the syntax a bit because I want it to be more general in the future.
This commit is contained in:
parent
2130c78da9
commit
878ff1b37b
3 changed files with 22 additions and 13 deletions
|
@ -253,7 +253,7 @@ on one line. The action and icon are optional.
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
menu {
|
menu {
|
||||||
item _("Copy") "app.copy" "copy-symbolic";
|
item (_("Copy"), "app.copy", "copy-symbolic")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -95,19 +95,28 @@ menu_item_shorthand = Group(
|
||||||
Sequence(
|
Sequence(
|
||||||
Keyword("item"),
|
Keyword("item"),
|
||||||
UseLiteral("tag", "item"),
|
UseLiteral("tag", "item"),
|
||||||
|
OpenParen(),
|
||||||
Group(
|
Group(
|
||||||
MenuAttribute,
|
MenuAttribute,
|
||||||
Sequence(UseLiteral("name", "label"), value),
|
Sequence(UseLiteral("name", "label"), value),
|
||||||
),
|
),
|
||||||
Optional(Group(
|
Optional(Sequence(
|
||||||
|
Comma(),
|
||||||
|
Optional(Sequence(
|
||||||
|
Group(
|
||||||
MenuAttribute,
|
MenuAttribute,
|
||||||
Sequence(UseLiteral("name", "action"), value),
|
Sequence(UseLiteral("name", "action"), value),
|
||||||
)),
|
),
|
||||||
Optional(Group(
|
Optional(Sequence(
|
||||||
|
Comma(),
|
||||||
|
Group(
|
||||||
MenuAttribute,
|
MenuAttribute,
|
||||||
Sequence(UseLiteral("name", "icon"), value),
|
Sequence(UseLiteral("name", "icon"), value),
|
||||||
|
),
|
||||||
|
))
|
||||||
|
))
|
||||||
)),
|
)),
|
||||||
StmtEnd().expected("`;`"),
|
CloseParen().expected("')'"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -163,7 +172,7 @@ def menu_content_completer(ast_node, match_variables):
|
||||||
)
|
)
|
||||||
yield Completion(
|
yield Completion(
|
||||||
"item (shorthand)", CompletionItemKind.Snippet,
|
"item (shorthand)", CompletionItemKind.Snippet,
|
||||||
snippet='item _("${1:Label}") "${2:action-name}" "${3:icon-name}";'
|
snippet='item (_("${1:Label}"), "${2:action-name}", "${3:icon-name}");'
|
||||||
)
|
)
|
||||||
|
|
||||||
yield Completion(
|
yield Completion(
|
||||||
|
|
|
@ -13,8 +13,8 @@ menu {
|
||||||
label: "test item";
|
label: "test item";
|
||||||
}
|
}
|
||||||
|
|
||||||
item "test item shorthand 1";
|
item ("test item shorthand 1")
|
||||||
item "test item shorthand 2" "app.test-action";
|
item ("test item shorthand 2", "app.test-action")
|
||||||
item "test item shorthand 3" "app.test-action" "test-symbolic";
|
item ("test item shorthand 3", "app.test-action", "test-symbolic")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue