diff --git a/src/vscode_plugin/package.json b/src/vscode_plugin/package.json index d20723e5e0c712fb5364bc8a14df3d6d03f94307..a4c6613348364961a36b5f91dcaac82c0ac6daab 100644 --- a/src/vscode_plugin/package.json +++ b/src/vscode_plugin/package.json @@ -148,6 +148,21 @@ "language": "cpp", "path": "./snippets/napi_error_snippets.json" }, + { + "language": "cpp", + "path": "./snippets/aki_function_snippets.json" + }, + { + "language": "cpp", + "path": "./snippets/aki_class_snippets.json" + }, + { + "language": "cpp", + "path": "./snippets/aki_struct_snippets.json" + }, + { + "language": "cpp", + "path": "./snippets/aki_enum_snippets.json" } ] }, diff --git a/src/vscode_plugin/snippets/aki_function_snippets.json b/src/vscode_plugin/snippets/aki_function_snippets.json new file mode 100644 index 0000000000000000000000000000000000000000..9d6f9d1f00631373e12ee2226cba53aa3983d3d5 --- /dev/null +++ b/src/vscode_plugin/snippets/aki_function_snippets.json @@ -0,0 +1,31 @@ +{ + "Aki sync function": { + "prefix": "akisyncfunc", + "body": [ + "std::string SayHello(std::string msg) { return msg + \" too.\"; }", + "// Register the AKI plugin name: It is the name of the compiled *.so file, following the same rules as NAPI.", + "JSBIND_ADDON(entry)", + "// Used to define the scope of global functions that need to be bound.", + "JSBIND_GLOBAL() {", + " // 'SayHello' function can be directly called from JavaScript.", + " JSBIND_FUNCTION(SayHello);", + "}" + ] + }, + "Aki async function": { + "prefix": "akiasyncfunc", + "body": [ + "std::string AsyncSayHello(std::string msg) {", + " // Do something;", + " return msg + \" too.\";", + "}", + "// Register the AKI plugin name: It is the name of the compiled *.so file, following the same rules as NAPI.", + "JSBIND_ADDON(entry)", + "// Used to define the scope of global functions that need to be bound.", + "JSBIND_GLOBAL() {", + " // function can be called asynchronously from JavaScript with Promises.", + " JSBIND_PFUNCTION(AsyncSayHello);", + "}" + ] + } +} \ No newline at end of file