Skip to content

Commit b9af018

Browse files
Feat vscode startup (#7518)
Co-authored-by: OpenHands Bot <[email protected]>
1 parent 9850f17 commit b9af018

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

openhands/runtime/plugins/vscode/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ async def initialize(self, username: str):
3737
f"su - {username} -s /bin/bash << 'EOF'\n"
3838
f'sudo chown -R {username}:{username} /openhands/.openvscode-server\n'
3939
'cd /workspace\n'
40-
f'exec /openhands/.openvscode-server/bin/openvscode-server --host 0.0.0.0 --connection-token {self.vscode_connection_token} --port {self.vscode_port}\n'
40+
f'exec /openhands/.openvscode-server/bin/openvscode-server --host 0.0.0.0 --connection-token {self.vscode_connection_token} --port {self.vscode_port} --disable-workspace-trust\n'
4141
'EOF'
4242
)
43-
print(cmd)
43+
4444
self.gateway_process = subprocess.Popen(
4545
cmd,
4646
stderr=subprocess.STDOUT,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"workbench.colorTheme": "Default Dark Modern",
3+
"workbench.startupEditor": "none"
4+
}

openhands/runtime/utils/runtime_templates/Dockerfile.j2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ RUN \
135135

136136
COPY ./code/pyproject.toml ./code/poetry.lock /openhands/code/
137137

138+
COPY ./code/openhands/runtime/plugins/vscode/settings.json /workspace/.vscode/settings.json
139+
RUN chmod -R a+rwx /workspace/.vscode/settings.json
140+
138141
{{ install_dependencies() }}
139142

140143
# ================================================================
@@ -147,6 +150,10 @@ COPY ./code/pyproject.toml ./code/poetry.lock /openhands/code/
147150
# ================================================================
148151
RUN if [ -d /openhands/code/openhands ]; then rm -rf /openhands/code/openhands; fi
149152
COPY ./code/pyproject.toml ./code/poetry.lock /openhands/code/
153+
154+
COPY ./code/openhands/runtime/plugins/vscode/settings.json /workspace/.vscode/settings.json
155+
RUN chmod -R a+rwx /workspace/.vscode/settings.json
156+
150157
COPY ./code/openhands /openhands/code/openhands
151158
RUN chmod a+rwx /openhands/code/openhands/__init__.py
152159

openhands/server/file_config.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
from openhands.core.logger import openhands_logger as logger
66
from openhands.server.shared import config as shared_config
77

8-
FILES_TO_IGNORE = ['.git/', '.DS_Store', 'node_modules/', '__pycache__/', 'lost+found/']
8+
FILES_TO_IGNORE = [
9+
'.git/',
10+
'.DS_Store',
11+
'node_modules/',
12+
'__pycache__/',
13+
'lost+found/',
14+
'.vscode/',
15+
]
916

1017

1118
def sanitize_filename(filename):

0 commit comments

Comments
 (0)