From 30ffec7bc92578e437941ac9cd0716001d1a907d Mon Sep 17 00:00:00 2001 From: openhands Date: Sun, 26 Jan 2025 03:17:54 +0000 Subject: [PATCH 1/2] Add VSCode Hello World extension --- .../utils/runtime_templates/Dockerfile.j2 | 5 +++- .../hello-world/extension.js | 16 +++++++++++++ .../hello-world/package.json | 23 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 openhands/runtime/utils/vscode-extensions/hello-world/extension.js create mode 100644 openhands/runtime/utils/vscode-extensions/hello-world/package.json diff --git a/openhands/runtime/utils/runtime_templates/Dockerfile.j2 b/openhands/runtime/utils/runtime_templates/Dockerfile.j2 index 2dfd96050515..0cb71ffea77e 100644 --- a/openhands/runtime/utils/runtime_templates/Dockerfile.j2 +++ b/openhands/runtime/utils/runtime_templates/Dockerfile.j2 @@ -63,7 +63,10 @@ RUN if [ -z "${RELEASE_TAG}" ]; then \ tar -xzf ${RELEASE_TAG}-linux-${arch}.tar.gz && \ mv -f ${RELEASE_TAG}-linux-${arch} ${OPENVSCODE_SERVER_ROOT} && \ cp ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/openvscode-server ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/code && \ - rm -f ${RELEASE_TAG}-linux-${arch}.tar.gz + rm -f ${RELEASE_TAG}-linux-${arch}.tar.gz && \ + # Install our custom extension + mkdir -p ${OPENVSCODE_SERVER_ROOT}/extensions/openhands-hello-world && \ + cp -r /openhands/code/openhands/runtime/utils/vscode-extensions/hello-world/* ${OPENVSCODE_SERVER_ROOT}/extensions/openhands-hello-world/ {% endmacro %} diff --git a/openhands/runtime/utils/vscode-extensions/hello-world/extension.js b/openhands/runtime/utils/vscode-extensions/hello-world/extension.js new file mode 100644 index 000000000000..57e06488b68c --- /dev/null +++ b/openhands/runtime/utils/vscode-extensions/hello-world/extension.js @@ -0,0 +1,16 @@ +const vscode = require('vscode'); + +function activate(context) { + let disposable = vscode.commands.registerCommand('openhands-hello-world.helloWorld', function () { + vscode.window.showInformationMessage('Hello from OpenHands!'); + }); + + context.subscriptions.push(disposable); +} + +function deactivate() {} + +module.exports = { + activate, + deactivate +} \ No newline at end of file diff --git a/openhands/runtime/utils/vscode-extensions/hello-world/package.json b/openhands/runtime/utils/vscode-extensions/hello-world/package.json new file mode 100644 index 000000000000..5c057853d69c --- /dev/null +++ b/openhands/runtime/utils/vscode-extensions/hello-world/package.json @@ -0,0 +1,23 @@ +{ + "name": "openhands-hello-world", + "displayName": "OpenHands Hello World", + "description": "A simple hello world extension for OpenHands", + "version": "0.0.1", + "publisher": "openhands", + "engines": { + "vscode": "^1.94.0" + }, + "categories": [ + "Other" + ], + "activationEvents": [ + "onCommand:openhands-hello-world.helloWorld" + ], + "main": "./extension.js", + "contributes": { + "commands": [{ + "command": "openhands-hello-world.helloWorld", + "title": "Hello World from OpenHands" + }] + } +} \ No newline at end of file From 2332660cabf12c167fa496d20f5ff047406ade80 Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Tue, 28 Jan 2025 11:49:51 -0500 Subject: [PATCH 2/2] fix vscode location --- openhands/runtime/utils/runtime_templates/Dockerfile.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openhands/runtime/utils/runtime_templates/Dockerfile.j2 b/openhands/runtime/utils/runtime_templates/Dockerfile.j2 index 0cb71ffea77e..746165cae0cd 100644 --- a/openhands/runtime/utils/runtime_templates/Dockerfile.j2 +++ b/openhands/runtime/utils/runtime_templates/Dockerfile.j2 @@ -105,7 +105,6 @@ RUN \ # rather than the current OpenHands release {{ setup_base_system() }} -{{ setup_vscode_server() }} # Install micromamba RUN mkdir -p /openhands/micromamba/bin && \ @@ -140,6 +139,8 @@ COPY ./code/pyproject.toml ./code/poetry.lock /openhands/code/ COPY ./code/openhands /openhands/code/openhands RUN chmod a+rwx /openhands/code/openhands/__init__.py +{{ setup_vscode_server() }} + # ================================================================ # END: Build from versioned image # ================================================================