From e51f06fae680b8b3d33ab9e499aa6725b2507543 Mon Sep 17 00:00:00 2001 From: gou-jingjing Date: Wed, 27 Nov 2024 17:24:09 +0800 Subject: [PATCH 1/4] add aki global function(sync && async) snippets Signed-off-by: gou-jingjing --- src/vscode_plugin/package.json | 4 +++ .../snippets/aki_function_snippets.json | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/vscode_plugin/snippets/aki_function_snippets.json diff --git a/src/vscode_plugin/package.json b/src/vscode_plugin/package.json index a4f5456e..ed1f88d2 100644 --- a/src/vscode_plugin/package.json +++ b/src/vscode_plugin/package.json @@ -139,6 +139,10 @@ { "language": "cpp", "path": "./snippets/napi_variable_snippets.json" + { + "language": "cpp", + "path": "./snippets/aki_function_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 00000000..cf363f71 --- /dev/null +++ b/src/vscode_plugin/snippets/aki_function_snippets.json @@ -0,0 +1,33 @@ +{ + "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 -- Gitee From 23fbc0256fe746da7cd902f6645a62ab0168f8c0 Mon Sep 17 00:00:00 2001 From: gou-jingjing Date: Wed, 27 Nov 2024 17:26:49 +0800 Subject: [PATCH 2/4] remove blank line Signed-off-by: gou-jingjing --- src/vscode_plugin/snippets/aki_function_snippets.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/vscode_plugin/snippets/aki_function_snippets.json b/src/vscode_plugin/snippets/aki_function_snippets.json index cf363f71..9d6f9d1f 100644 --- a/src/vscode_plugin/snippets/aki_function_snippets.json +++ b/src/vscode_plugin/snippets/aki_function_snippets.json @@ -10,7 +10,6 @@ " // 'SayHello' function can be directly called from JavaScript.", " JSBIND_FUNCTION(SayHello);", "}" - ] }, "Aki async function": { @@ -27,7 +26,6 @@ " // function can be called asynchronously from JavaScript with Promises.", " JSBIND_PFUNCTION(AsyncSayHello);", "}" - ] } } \ No newline at end of file -- Gitee From f122173355b0cdf2fc4d7cd948fe8c66e021b411 Mon Sep 17 00:00:00 2001 From: gou-jingjing Date: Fri, 29 Nov 2024 17:41:21 +0800 Subject: [PATCH 3/4] resolve conflict Signed-off-by: gou-jingjing --- src/vscode_plugin/package.json | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/vscode_plugin/package.json b/src/vscode_plugin/package.json index 94eb81fa..aa74839a 100644 --- a/src/vscode_plugin/package.json +++ b/src/vscode_plugin/package.json @@ -141,16 +141,28 @@ "path": "./snippets/napi_variable_snippets.json" }, { + "language": "cpp", + "path": "./snippets/napi_external_snippets.json" + }, + { + "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/napi_external_snippets.json" + "path": "./snippets/aki_struct_snippets.json" }, { "language": "cpp", - "path": "./snippets/napi_error_snippets.json" + "path": "./snippets/aki_enum_snippets.json" } ] }, -- Gitee From b72f6561929cc17806ad2bd6fc5ccd58645cce7b Mon Sep 17 00:00:00 2001 From: gou-jingjing Date: Fri, 29 Nov 2024 17:42:25 +0800 Subject: [PATCH 4/4] resolve conflict Signed-off-by: gou-jingjing --- src/vscode_plugin/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vscode_plugin/package.json b/src/vscode_plugin/package.json index aa74839a..a4c66133 100644 --- a/src/vscode_plugin/package.json +++ b/src/vscode_plugin/package.json @@ -148,11 +148,11 @@ "language": "cpp", "path": "./snippets/napi_error_snippets.json" }, - { + { "language": "cpp", "path": "./snippets/aki_function_snippets.json" }, - { + { "language": "cpp", "path": "./snippets/aki_class_snippets.json" }, -- Gitee