Skip to content

Commit

Permalink
Add VSCode Hello World extension (#6463)
Browse files Browse the repository at this point in the history
Co-authored-by: openhands <[email protected]>
Co-authored-by: Engel Nyst <[email protected]>
  • Loading branch information
3 people authored Jan 31, 2025
1 parent 0c84fe5 commit 7f4b547
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
8 changes: 6 additions & 2 deletions openhands/runtime/utils/runtime_templates/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down Expand Up @@ -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 && \
Expand Down Expand Up @@ -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
# ================================================================
Expand Down
16 changes: 16 additions & 0 deletions openhands/runtime/utils/vscode-extensions/hello-world/extension.js
Original file line number Diff line number Diff line change
@@ -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
}
23 changes: 23 additions & 0 deletions openhands/runtime/utils/vscode-extensions/hello-world/package.json
Original file line number Diff line number Diff line change
@@ -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"
}]
}
}

0 comments on commit 7f4b547

Please sign in to comment.