From e1e0e04d56c146874e70310f19345a10440a5c65 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Wed, 1 Apr 2026 10:23:21 +0200 Subject: [PATCH 1/3] Fixed LUA simple expression in snippets.json --- snippets/snippets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/snippets.json b/snippets/snippets.json index 74f9b8d..9da850b 100644 --- a/snippets/snippets.json +++ b/snippets/snippets.json @@ -157,7 +157,7 @@ "lua": { "print_hello": "print('hello')", "print_stderr": "io.stderr:write('error\\n')", - "simple_expr": "return 1 + 1", + "simple_expr": "1 + 1", "simple_expr_result": "2", "incomplete_code": "function foo(", "complete_code": "x = 1", From 9af071c230429c9cbba238c0a16595ef4cb08426 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Wed, 1 Apr 2026 11:42:15 +0200 Subject: [PATCH 2/3] Added update_display_data_code for cpp --- snippets/snippets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/snippets.json b/snippets/snippets.json index 9da850b..a68b808 100644 --- a/snippets/snippets.json +++ b/snippets/snippets.json @@ -134,7 +134,7 @@ "completion_setup": "int test_variable_for_completion = 42;", "completion_prefix": "test_variable_for_", "display_data_code": "#include \n#include \"xcpp/xdisplay.hpp\"\n\nstruct html_content {\n std::string content;\n};\n\n#include \"nlohmann/json.hpp\"\nnlohmann::json mime_bundle_repr(const html_content& h) {\n auto bundle = nlohmann::json::object();\n bundle[\"text/html\"] = h.content;\n return bundle;\n}\n\nhtml_content h{\"bold\"};\nxcpp::display(h);", - "update_display_data_code": "// xeus-cling update_display_data requires display_id handling", + "update_display_data_code": "#include \n#include \"xcpp/xdisplay.hpp\"\n#include \"nlohmann/json.hpp\"\nnamespace nl = nlohmann;\nnamespace ht\n{\nstruct html\n{\ninline html(const std::string& content)\n{\nm_content = content;\n}\nstd::string m_content;\n};\nnl::json mime_bundle_repr(const html& a)\n{\nauto bundle = nl::json::object();\nbundle[\"text/html\"] = a.m_content;\nreturn bundle;\n}\n}\nht::html rect(R\"(\n
\nOriginal\n
)\");\nxcpp::display(rect, \"some_display_id\");\nrect.m_content = R\"(\n
\nUpdated\n
)\";xcpp::display(rect, \"some_display_id\", true);", "rich_execute_result_code": "// C++ uses display_data for rich output" }, "sql": { From 7b1fc460190fd16da26347ae8f737b210fc51a22 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Wed, 1 Apr 2026 13:28:33 +0200 Subject: [PATCH 3/3] Added input prompt for C++ --- snippets/snippets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/snippets.json b/snippets/snippets.json index a68b808..c42c200 100644 --- a/snippets/snippets.json +++ b/snippets/snippets.json @@ -128,7 +128,7 @@ "incomplete_code": "int foo(", "complete_code": "int x = 1;", "syntax_error": "int int;", - "input_prompt": "// C++ kernel stdin varies", + "input_prompt": "#include \n#include \nstd::string name;\nstd::cin >> name;", "sleep_code": "#include \n#include \nstd::this_thread::sleep_for(std::chrono::seconds(2));", "completion_var": "test_variable_for_completion", "completion_setup": "int test_variable_for_completion = 42;",