From d01e75530ae66a4f03d7fd40a8f1c30ad6299e12 Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Tue, 21 Nov 2023 18:33:16 +0300 Subject: [PATCH] Snippets: Add common pragma names & values as snippets This is worse than a completion that could be provided by a plugin or an LSP, but until LSP is developed enough to be useful for KDE, this should be good enough for common use-cases. --- README.md | 2 +- ...qml_pragma_ComponentBehavior_Bound.sublime-snippet | 11 +++++++++++ ...FunctionSignatureBehavior_Enforced.sublime-snippet | 11 +++++++++++ ..._pragma_ListPropertyAssignBehavior.sublime-snippet | 11 +++++++++++ Snippets/qml_pragma_Singleton.sublime-snippet | 11 +++++++++++ Snippets/qml_pragma_Strict.sublime-snippet | 11 +++++++++++ Snippets/qml_pragma_ValueTypeBehavior.sublime-snippet | 11 +++++++++++ messages/1.7.0.txt | 3 +++ 8 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 Snippets/qml_pragma_ComponentBehavior_Bound.sublime-snippet create mode 100644 Snippets/qml_pragma_FunctionSignatureBehavior_Enforced.sublime-snippet create mode 100644 Snippets/qml_pragma_ListPropertyAssignBehavior.sublime-snippet create mode 100644 Snippets/qml_pragma_Singleton.sublime-snippet create mode 100644 Snippets/qml_pragma_Strict.sublime-snippet create mode 100644 Snippets/qml_pragma_ValueTypeBehavior.sublime-snippet diff --git a/README.md b/README.md index 120e1d0..823a2c2 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This package provides the following features: - Complete syntax highlighting for QML and qmldir files. - GoTo indexing for `id`s, property declarations and inline components. - - Snippets for commonly used properties and types. + - Snippets for commonly used properties, types and pragmas. - Command to turn property names into their `onPropertyChanged` signal handlers and vice-versa. If you are a KDE developer, check out [kdesrc-build plugin for Sublime Text](https://github.com/ratijas/kdesrc-build-sublime) as well! diff --git a/Snippets/qml_pragma_ComponentBehavior_Bound.sublime-snippet b/Snippets/qml_pragma_ComponentBehavior_Bound.sublime-snippet new file mode 100644 index 0000000..43f136d --- /dev/null +++ b/Snippets/qml_pragma_ComponentBehavior_Bound.sublime-snippet @@ -0,0 +1,11 @@ + + + + + pragma ComponentBehavior: Bound + source.qml - meta.block.qml + pragma + diff --git a/Snippets/qml_pragma_FunctionSignatureBehavior_Enforced.sublime-snippet b/Snippets/qml_pragma_FunctionSignatureBehavior_Enforced.sublime-snippet new file mode 100644 index 0000000..042e18a --- /dev/null +++ b/Snippets/qml_pragma_FunctionSignatureBehavior_Enforced.sublime-snippet @@ -0,0 +1,11 @@ + + + + + pragma FunctionSignatureBehavior: Enforced + source.qml - meta.block.qml + pragma + diff --git a/Snippets/qml_pragma_ListPropertyAssignBehavior.sublime-snippet b/Snippets/qml_pragma_ListPropertyAssignBehavior.sublime-snippet new file mode 100644 index 0000000..ea46fe4 --- /dev/null +++ b/Snippets/qml_pragma_ListPropertyAssignBehavior.sublime-snippet @@ -0,0 +1,11 @@ + + + + + pragma ListPropertyAssignBehavior: + source.qml - meta.block.qml + pragma + diff --git a/Snippets/qml_pragma_Singleton.sublime-snippet b/Snippets/qml_pragma_Singleton.sublime-snippet new file mode 100644 index 0000000..28fa5a5 --- /dev/null +++ b/Snippets/qml_pragma_Singleton.sublime-snippet @@ -0,0 +1,11 @@ + + + + + pragma Singleton + source.qml - meta.block.qml + pragma + diff --git a/Snippets/qml_pragma_Strict.sublime-snippet b/Snippets/qml_pragma_Strict.sublime-snippet new file mode 100644 index 0000000..8c6de45 --- /dev/null +++ b/Snippets/qml_pragma_Strict.sublime-snippet @@ -0,0 +1,11 @@ + + + + + pragma Strict + source.qml - meta.block.qml + pragma + diff --git a/Snippets/qml_pragma_ValueTypeBehavior.sublime-snippet b/Snippets/qml_pragma_ValueTypeBehavior.sublime-snippet new file mode 100644 index 0000000..34164da --- /dev/null +++ b/Snippets/qml_pragma_ValueTypeBehavior.sublime-snippet @@ -0,0 +1,11 @@ + + + + + pragma ValueTypeBehavior: + source.qml - meta.block.qml + pragma + diff --git a/messages/1.7.0.txt b/messages/1.7.0.txt index c1b46b0..722e592 100644 --- a/messages/1.7.0.txt +++ b/messages/1.7.0.txt @@ -1,5 +1,8 @@ QML for Sublime Text 1.7.0 has been released! +Added new snippets for common pragma names & values. Just start +typing "pragma" outside of the top-level object declaration. + A brand new command allows converting between property names and their change signal handlers! Try now, put a cursor on the words below, open command palette, and find "QML: Convert Between Property And Signal Handler" entry: