Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Add VSCode Hello World extension (#6463)

Robert Brennan7f4b5476dc4b
diff --git a/openhands/runtime/utils/runtime_templates/Dockerfile.j2 b/openhands/runtime/utils/runtime_templates/Dockerfile.j2
index 2dfd960505..746165cae0 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 %}
@@ -102,7 +105,6 @@ RUN \
# rather than the current OpenHands release
{{ setup_base_system() }}
-{{ setup_vscode_server() }}
# Install micromamba
RUN mkdir -p /openhands/micromamba/bin && \
@@ -137,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
# ================================================================
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 0000000000..57e06488b6
--- /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 0000000000..5c057853d6
--- /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