Skip to content

Commit

Permalink
updating fork (#1)
Browse files Browse the repository at this point in the history
* Add back hideHover and use on tree context menu show
Fixes microsoft#106268

* Update distro

* 💄

* explorer: Fix TrustedTypes violation

microsoft#106285

* produce deb, rpm packages

* Add loginShell (microsoft/vscode-remote-release#3593)

* chore - tweak onDidAddNotebookDocument, onDidRemoveNotebookDocument event, use ResourceMap and fix confusion between models and editors

* notebook update

* pinned tabs - update setting enum name

* Use innerText over innerHTML, microsoft#106285

* rename to IHostColorSchemeService

* API proposal for tree item icon color
Part of microsoft#103120

* chore - when target might be undefined use `target?.dispose()` over `dispose(target)`

* deprecate onDidChangeCells

* Reenable notebook smoke test microsoft#105330

* deprecate onDidChangeContent

* Add numeric values support for terminal.integrated.fontWeight

* unified onDidChangeContent

* [email protected]

Fixes microsoft#105957

* 💄

* debt - remove _unInitializedDocuments

* remove `NotebookDocument#displayOrder` , fixes microsoft#106305

* no uninitialized documents.

* chore - update references viewlet

* debug: make serverReadyAction play nicely with js-debug

Fixes microsoft#86035
Fixes microsoft/vscode-js-debug#440

* fix rpm

* high contrast switching in browser

* Fix occasional bad custom selectbox layout
Fix microsoft#106302

* review comments

* Bump vscode-ripgrep for ARM
microsoft#6442

* Revert more specific class names for editor tokens

Reverts microsoft#103485
Fixes microsoft#106261

I believe that microsoft#103485 broke cases where the markdown renderer creates tokenized strings that are used outside of an editor's dom node (such as in hovers or in webviews)

The safest fix for now is to revert it. We can revist this and make the markdown renderer handle the tokenized output better next iteration

* remove emit selections.

* merge conflict resolve.

* fix integration tests.

* Disable errors in non-semantic supported files

Fixes microsoft#106299
Fixes microsoft#106314

Also enables js/ts features on the right side of PRs and in search results

* proper fix for microsoft#105202 (microsoft#106293)

* Only enable 'open with' on files

Fixes microsoft#106291

* Add WebviewView.description

Allow configuring the description for webview views.

This is rendered next to the title in a less prominently in the title

* Remove manual strikethroughs for deprecated properties in vscode.d.ts

Now that TS has support for `@deprecated`, these manual strike throughs should no longer be required.

* Add show method to webview view

Fixes microsoft#106085

* Skip failing test

* fix microsoft#106283

* enable test

* fix microsoft#106283

* pinnedTabSizing.standard => pinnedTabSizing.normal

* install dot net core sdk

* update distro

* tabs - align icon and text vertically centered in tab

* update distro

* distro

* fix microsoft#106308

* Update gitignore decorations when .git/info/exclude file is edited (microsoft#106270)

* detect local `exclude` file edits

* use `uri.path` to detect exclude file edits

`uri.path` uses forward slash as a path separator indepentent of
the host system, which makes it easier to use with regex

* updated searches

* editor - rename context keys variables

* fix microsoft#105999

* pinned tabs - prevent to close pinned tabs via Cmd+W (microsoft#100738)

* Reduce usage of `.innerHTML` (microsoft#106285)

* fix uninstalling extension

* remove unused import

* add `replaceNotebookMetadata` (should become `replaceMetadata`) to NotebookEditorEdit, microsoft#105283

* add `replaceNotebookMetadata`, microsoft#105283

* use textContent instead of innerHTML (for microsoft#106285)

* chore - move appyWorkspaceEdit from extHostTextEditors to (new) extHostBulkEdits and mainThreadBulkEdits

* chore - extract extHostNotebookDocument for the NotebookDocument and NotebookCell types and friends

* chore - extract ExtHostNotebookEditor into its own file

* chore - remove ExtHostNotebookEditor#uri and use document.uri instead

* chore - 💄 member order: property, ctor, method

* publish arm deb and rpm

* trusted types

related to microsoft#106285

* use async await

* distro

* update trusted types search

* trusted types - use textContent for style elements, fyi @rebornix

* fix arch

* Fix compile after merge

* Use instantiation service to create TerminalLinks

* Consolidate colon trim logic

* Avoid slice when checking colon

* Check length again

I prefer chatAt over slice as it's more obvious what's happening

* Move comment into helper function

* Update extensions/git/src/commands.ts

* Update extensions/git/src/commands.ts

* Update extensions/git/src/commands.ts

* Save prompt is shown while saving from settings split json editor (fix microsoft#106330)

* Only allow configurePlugin against main TS Server

Fixes microsoft#106346

Looks like the TS Server doesn't support this in partial mode at the moment

* Adding more explicit typings for promises

This gets us ready for TS 4.1

* Don't use async on abstract functions

* chore - use workingCopyService.isDirty instead notebook.isDirty

* Update Codicons
- Update 'pinned'
- Add 'export'
- Compress 'merge'
microsoft/vscode-codicons@5bcb1a0

* Add explicit undefined parameters / types

These errors come from the new stricter types for Promises in TS 4.1

* debt - IMainNotebookController#removeNotebookDocument

* debt - invoke resolve notebook when opening a notebook in an editor, not when loading a notebook from source

* do not need isUntitled.

* 💂 polish nb tests.

* remove selections from nb text model.

* replace changeCellLanguage to applyEdit

* fix microsoft#105916. expand metadata section if modified.

* move dirty state to NotebookEditorModel.

* chore, simply notebook text model event emitter

* refs microsoft#106285

* Add subscribers action

* Fix terminal ts 4.1 compile issues

Part of microsoft#106358

* Fix ts 4.1 issues in terminal api tests

* Update Codicons: add 'graph-left'
microsoft/vscode-codicons@dd1edb2

* initialize notebook text model data only through ctor.

* 💄

* Mark property readonly

* Enable webview commands for webview views

Fixes microsoft#105670

Previously our webview commands assumed that webviews were always going to be in an editor. This is no longer true with webview views.

To fix this, I've added an `activeWebview` to the `IWebviewService`. This  tracks the currently focused webview.

* microsoft#106358

* debug: bump js-debug-companion

* re microsoft#105735.

* re microsoft#105735. no more udpateMetadata api.

* Fix microsoft#106303

* Use destructuring to make code more clear

* Add isWritableFileSystem api

Fixes microsoft#91697

This new API checks if a given scheme allows writing

* Revert "Fix microsoft#106303"

This reverts commit 8e5eed1.

this is causing a layer check issue

* Cache webview view title across reloads

Fixes microsoft#105867

* fix some TS 4.1 errors (microsoft#106358)

* fix some TS 4.1 errors (microsoft#106358)

* fix TS 4.1 compile errors, microsoft#106358

* pinned tabs - flip default to "shrink"

* fix ts errors

related to microsoft#106358

* pinned tabs - closing pinned tab should open next non-pinned

* pinned tabs - add a tab.lastPinnedBorder color

* Adds commands for --no-verify commit variants (microsoft#106335)

* add `{allow,confirm}NoVerifyCommit`  options

* adds commit comands with no verify

* handles no verify command variants

* handle no verify commit option

* only display no verify variants when option is set

* trusted types

related to microsoft#106395

* more TS 4.1 fixes (microsoft#106358)

* update trusted types search

* Fix TS 4.1 errors for tasks and remote explorer
Part of microsoft#106358

* Adress microsoft#106358: Fix TS 4.1 errors in codebase

* debt - simplify metadata edit because we now have CellEditType.DocumentMetadata

* Fix Trusted Types violations (round #2) microsoft#106395

* debug: return result of a msg to debug adapter can be undefined

* add ExtHostFileSystemInfo which knows what schemes are reserved and which are used, microsoft#91697

* fixes microsoft#106334

* web - fix bad credentials lookup

* Correct path to code-workspace.xml

Fixes microsoft#106384

* Multi git executable paths (microsoft#85954)

* Multi git executable path

* update `git.path` setting description

* 💄

Co-authored-by: João Moreno <[email protected]>

* Correct linux code-workspace path

* fixes microsoft#104047

* Add defaultUriScheme to path service (microsoft#106400)

Fixes microsoft/vscode-internalbacklog#1179

* 💄

* Fix  microsoft#106303

* Avoid innerHTML (microsoft#106395)

* Avoid innerHTML (microsoft#106395)

* debt - REMOTE_HOST_SCHEME => Schemas.vscodeRemote

* fixes microsoft#106355

* pathService - defaultUriScheme() => defaultUriScheme

* Adjust active terminal tab when active tab moves (microsoft#106413)

Fixes microsoft#106300

* debt - adopt defaultUriScheme also for userHome

* debt - adopt defaultUriScheme over hardcoded vscode-remote in toLocalResource

* some integration tests for notebook editing, microsoft#105283

* refs microsoft#106358

* Bump yargs-parser in /extensions/markdown-language-features (microsoft#106373)

Bumps [yargs-parser](https:/yargs/yargs-parser) from 13.1.1 to 13.1.2.
- [Release notes](https:/yargs/yargs-parser/releases)
- [Changelog](https:/yargs/yargs-parser/blob/master/docs/CHANGELOG-full.md)
- [Commits](https:/yargs/yargs-parser/commits)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump yargs-parser in /extensions/css-language-features/server

Bumps [yargs-parser](https:/yargs/yargs-parser) from 13.1.1 to 13.1.2.
- [Release notes](https:/yargs/yargs-parser/releases)
- [Changelog](https:/yargs/yargs-parser/blob/master/docs/CHANGELOG-full.md)
- [Commits](https:/yargs/yargs-parser/commits)

Signed-off-by: dependabot[bot] <[email protected]>

* Remove arrays.findIndex

For microsoft#103454

This should be a direct map to the `.findIndex` mathod

* Use textContnet for style element

For microsoft#106395

* use textcontent in menu css
refs microsoft#106395

* Fix one innerHTML usage microsoft#106395

* Use `@example` tags in vscode.d.ts (microsoft#106352)

`@example` is the standard way to document code examples. This also gets us syntax highlighting of code examples in hovers

* - reload only local user configuration after initi
- add perf mark up and logs

* re microsoft#105735. batch apply edits.

* notebook text model initialization does not increment version

* private outputs slice and unknown change.

* applyEdit supports begin/end selections.

* replace insertCell with applyEdit.

* do not copy execution related metadata

* 💄

* fix build.

* Document view.type contribution

Fixes microsoft#105821

* Improve views contribution point

- add required properties
- add default snippet
- use `markdownDescription` for markdown string

* Replace our arrays.find with stdlib find

For microsoft#103454

* Pin blob storage dep
see Azure/azure-sdk-for-js#11187

* unit tests for batched edits.

* remove spliceNotebook api from textmodel.

* update exploration branch

* Fix some trusted type violations, microsoft#106395

* fix fonts in monaco menu

* update distro

* some jsdoc for microsoft#54938

* try to fix build (linux)

* electron - set spellcheck: false again for windows

* update search file, microsoft#106395

* 🆙 web playground

* Trusted types - don't use innerHTML for rapid render, microsoft#106395

* Remove Schemas.vscodeRemote from simple file dialog

* debt - remove some any casts from window

* update distro

* fix linux build

* argh

* proxy authentication does not work on 1.49 (microsoft#106434)

* do not use hasClass and first

microsoft#103454

* debug and explroer: do not use dom.addClass, dom.toggleClass

* do not use deprecated dom helper methods

microsoft#103454

* adopt new amd loader with support for TrustedScriptURL, add typings for TrustedTypesFactory et al, microsoft#106396

* explorer: Should maintain row focus after deleting a file

fixes microsoft#71315

* Update Codicons: add 'magnet' icon
microsoft/vscode-codicons@4c61155

* Remove unused 'SettingSearch' issue type

* notebook document data loss.

* cell language should not be freezed.

* Add preferred_username to the list of msft token claims (microsoft#106511)

* debug: update js-debug

* fix microsoft#106430.

* hide outputs if it is transient.

* Add optional typing for webview state in WebviewPanelSerializer

This makes it easier for extensions to correctly type their state if they wish

* Add comment to WebviewViewResolveContext

* use optional chaining

* Use `Set` instead of array

Sets should offer faster checking to see if a property has been seen

* Create webview.web.contribution

Fixes microsoft#106516

Creates an explicit contribution file for web. This makes sure we only don't register the `IWebviewService` twice. Not 100% sure this fixes the issue since I couldn't repo the original bug with our oss builds

* Revert "API proposal for tree item icon color"

This reverts commit 52e557f.

* Skip formatting when during format-on-save, the configured formatter cannot be found (continue to show silent notification), microsoft#106376

* don't use renderCodicons any more, microsoft#105799

* remove old renderCodicons-function, rename renderCodiconsAsElement to renderCodicons

* NotebookEditorEdit-api changes, microsoft#105283

* WorkspaceEdit-api changes, microsoft#105283

* adopt notebook integration tests, microsoft#105283

* add NotebookCell#index, microsoft#106637

* fix delay issue for provideCodeLenses, microsoft#106267

* rename RunOnceScheduler#timeout to delay

* use debian stretch images (microsoft#106656)

* remove deprecated function calls

related to microsoft#103454

* workaround, maybe fix for microsoft#106657

* update search files

* debt - make class list utils functions so that @deprecated works for them

* fixes microsoft#106406

* notebook - when creating a notebook, check that no notebook with another viewtype exists

* fix bad classList usage

* add regression test for microsoft#106657

* fixes microsoft#86180

* fixes microsoft#100172

Co-authored-by: Alex Ross <[email protected]>
Co-authored-by: Daniel Imms <[email protected]>
Co-authored-by: João Moreno <[email protected]>
Co-authored-by: isidor <[email protected]>
Co-authored-by: Christof Marti <[email protected]>
Co-authored-by: Johannes Rieken <[email protected]>
Co-authored-by: Benjamin Pasero <[email protected]>
Co-authored-by: Martin Aeschlimann <[email protected]>
Co-authored-by: rebornix <[email protected]>
Co-authored-by: Rob Lourens <[email protected]>
Co-authored-by: IllusionMH <[email protected]>
Co-authored-by: Daniel Imms <[email protected]>
Co-authored-by: Connor Peet <[email protected]>
Co-authored-by: Matt Bierner <[email protected]>
Co-authored-by: Jean Pierre <[email protected]>
Co-authored-by: Peng Lyu <[email protected]>
Co-authored-by: Sandeep Somavarapu <[email protected]>
Co-authored-by: Vyacheslav Pukhanov <[email protected]>
Co-authored-by: Alex Dima <[email protected]>
Co-authored-by: João Moreno <[email protected]>
Co-authored-by: Miguel Solorio <[email protected]>
Co-authored-by: SteVen Batten <[email protected]>
Co-authored-by: Jackson Kearl <[email protected]>
Co-authored-by: Rachel Macfarlane <[email protected]>
Co-authored-by: Dirk Baeumer <[email protected]>
Co-authored-by: WhizSid <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <[email protected]>
Co-authored-by: Oleg Demchenko <[email protected]>
  • Loading branch information
1 parent 00ebabb commit 1c4f377
Show file tree
Hide file tree
Showing 3,957 changed files with 332,374 additions and 172,980 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
121 changes: 121 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-12

ARG TARGET_DISPLAY=":1"

# VNC options
ARG MAX_VNC_RESOLUTION=1920x1080x16
ARG TARGET_VNC_RESOLUTION=1920x1080
ARG TARGET_VNC_DPI=72
ARG TARGET_VNC_PORT=5901
ARG VNC_PASSWORD="vscode"

# noVNC (VNC web client) options
ARG INSTALL_NOVNC="true"
ARG NOVNC_VERSION=1.1.0
ARG TARGET_NOVNC_PORT=6080
ARG WEBSOCKETIFY_VERSION=0.9.0

# Firefox is useful for testing things like browser launch events, but optional
ARG INSTALL_FIREFOX="false"

# Expected non-root username from base image
ARG USERNAME=node

# Core environment variables for X11, VNC, and fluxbox
ENV DBUS_SESSION_BUS_ADDRESS="autolaunch:" \
MAX_VNC_RESOLUTION="${MAX_VNC_RESOLUTION}" \
VNC_RESOLUTION="${TARGET_VNC_RESOLUTION}" \
VNC_DPI="${TARGET_VNC_DPI}" \
VNC_PORT="${TARGET_VNC_PORT}" \
NOVNC_PORT="${TARGET_NOVNC_PORT}" \
DISPLAY="${TARGET_DISPLAY}" \
LANG="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
VISUAL="nano" \
EDITOR="nano"

# Configure apt and install packages
RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
#
# Install the Cascadia Code fonts - https:/microsoft/cascadia-code
&& curl -sSL https:/microsoft/cascadia-code/releases/download/v2004.30/CascadiaCode_2004.30.zip -o /tmp/cascadia-fonts.zip \
&& unzip /tmp/cascadia-fonts.zip -d /tmp/cascadia-fonts \
&& mkdir -p /usr/share/fonts/truetype/cascadia \
&& mv /tmp/cascadia-fonts/ttf/* /usr/share/fonts/truetype/cascadia/ \
&& rm -rf /tmp/cascadia-fonts.zip /tmp/cascadia-fonts \
#
# Install X11, fluxbox and VS Code dependencies
&& apt-get -y install --no-install-recommends \
xvfb \
x11vnc \
fluxbox \
dbus-x11 \
x11-utils \
x11-xserver-utils \
xdg-utils \
fbautostart \
xterm \
eterm \
gnome-terminal \
gnome-keyring \
seahorse \
nautilus \
libx11-dev \
libxkbfile-dev \
libsecret-1-dev \
libnotify4 \
libnss3 \
libxss1 \
libasound2 \
xfonts-base \
xfonts-terminus \
fonts-noto \
fonts-wqy-microhei \
fonts-droid-fallback \
vim-tiny \
nano \
#
# [Optional] Install noVNC
&& if [ "${INSTALL_NOVNC}" = "true" ]; then \
mkdir -p /usr/local/novnc \
&& curl -sSL https:/novnc/noVNC/archive/v${NOVNC_VERSION}.zip -o /tmp/novnc-install.zip \
&& unzip /tmp/novnc-install.zip -d /usr/local/novnc \
&& cp /usr/local/novnc/noVNC-${NOVNC_VERSION}/vnc_lite.html /usr/local/novnc/noVNC-${NOVNC_VERSION}/index.html \
&& rm /tmp/novnc-install.zip \
&& curl -sSL https:/novnc/websockify/archive/v${WEBSOCKETIFY_VERSION}.zip -o /tmp/websockify-install.zip \
&& unzip /tmp/websockify-install.zip -d /usr/local/novnc \
&& apt-get -y install --no-install-recommends python-numpy \
&& ln -s /usr/local/novnc/websockify-${WEBSOCKETIFY_VERSION} /usr/local/novnc/noVNC-${NOVNC_VERSION}/utils/websockify \
&& rm /tmp/websockify-install.zip; \
fi \
#
# [Optional] Install Firefox
&& if [ "${INSTALL_FIREFOX}" = "true" ]; then \
apt-get -y install --no-install-recommends firefox-esr; \
fi \
#
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

COPY bin/init-dev-container.sh /usr/local/share/
COPY bin/set-resolution /usr/local/bin/
COPY fluxbox/* /root/.fluxbox/
COPY fluxbox/* /home/${USERNAME}/.fluxbox/

# Update privs, owners of config files
RUN mkdir -p /var/run/dbus /root/.vnc /home/${USERNAME}/.vnc \
&& touch /root/.Xmodmap /home/${USERNAME}/.Xmodmap \
&& echo "${VNC_PASSWORD}" | tee /root/.vnc/passwd > /home/${USERNAME}/.vnc/passwd \
&& chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.Xmodmap /home/${USERNAME}/.fluxbox /home/${USERNAME}/.vnc \
&& chmod +x /usr/local/share/init-dev-container.sh /usr/local/bin/set-resolution

ENTRYPOINT ["/usr/local/share/init-dev-container.sh"]
CMD ["sleep", "infinity"]
82 changes: 82 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Code - OSS Development Container

This repository includes configuration for a development container for working with Code - OSS in an isolated local container or using [Visual Studio Codespaces](https://aka.ms/vso).

> **Tip:** The default VNC password is `vscode`. The VNC server runs on port `5901` with a web client at `6080`. For better performance, we recommend using a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/). Applications like the macOS Screen Sharing app will not perform as well. [Chicken](https://sourceforge.net/projects/chicken/) is a good macOS alternative.
## Quick start - local

1. Install Docker Desktop or Docker for Linux on your local machine. (See [docs](https://aka.ms/vscode-remote/containers/getting-started) for additional details.)

2. **Important**: Docker needs at least **4 Cores and 6 GB of RAM (8 GB recommended)** to run full build. If you on macOS, or using the old Hyper-V engine for Windows, update these values for Docker Desktop by right-clicking on the Docker status bar item, going to **Preferences/Settings > Resources > Advanced**.

> **Note:** The [Resource Monitor](https://marketplace.visualstudio.com/items?itemName=mutantdino.resourcemonitor) extension is included in the container so you can keep an eye on CPU/Memory in the status bar.
3. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the [Remote - Containers](https://aka.ms/vscode-remote/download/containers) extension.

![Image of Remote - Containers extension](https://microsoft.github.io/vscode-remote-release/images/remote-containers-extn.png)

> Note that the Remote - Containers extension requires the Visual Studio Code distribution of Code - OSS. See the [FAQ](https://aka.ms/vscode-remote/faq/license) for details.
4. Press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> and select **Remote - Containers: Open Repository in Container...**.

> **Tip:** While you can use your local source tree instead, operations like `yarn install` can be slow on macOS or using the Hyper-V engine on Windows. We recommend the "open repository" approach instead since it uses "named volume" rather than the local filesystem.
5. Type `https:/microsoft/vscode` (or a branch or PR URL) in the input box and press <kbd>Enter</kbd>.

6. After the container is running, open a web browser and go to [http://localhost:6080](http://localhost:6080) or use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to `localhost:5901` and enter `vscode` as the password.

Anything you start in VS Code or the integrated terminal will appear here.

Next: **[Try it out!](#try-it)**

## Quick start - Codespaces

>Note that the Codespaces browser-based editor cannot currently access the desktop environment in this container (due to a [missing feature](https:/MicrosoftDocs/vsonline/issues/117)). We recommend using Visual Studio Code from the desktop to connect instead in the near term.
1. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the [Visual Studio Codespaces](https://aka.ms/vscs-ext-vscode) extension.

![Image of VS Codespaces extension](https://microsoft.github.io/vscode-remote-release/images/codespaces-extn.png)

> Note that the Visual Studio Codespaces extension requires the Visual Studio Code distribution of Code - OSS.
2. Sign in by pressing <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> and selecting **Codespaces: Sign In**. You may also need to use the **Codespaces: Create Plan** if you do not have a plan. See the [Codespaces docs](https://aka.ms/vso-docs/vscode) for details.

3. Press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> and select **Codespaces: Create New Codespace**.

4. Use default settings (which should include **Standard** 4 core, 8 GB RAM Codespace), select a plan, and then enter the repository URL `https:/microsoft/vscode` (or a branch or PR URL) in the input box when prompted.

5. After the container is running, open a web browser and go to [http://localhost:6080](http://localhost:6080) or use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to `localhost:5901` and enter `vscode` as the password.

6. Anything you start in VS Code or the integrated terminal will appear here.

## Try it!

This container uses the [Fluxbox](http://fluxbox.org/) window manager to keep things lean. **Right-click on the desktop** to see menu options. It works with GNOME and GTK applications, so other tools can be installed if needed.

Note you can also set the resolution from the command line by typing `set-resolution`.

To start working with Code - OSS, follow these steps:

1. In your local VS Code, open a terminal (<kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>\`</kbd>) and type the following commands:

```bash
yarn install
bash scripts/code.sh
```

2. After the build is complete, open a web browser and go to [http://localhost:6080](http://localhost:6080) or use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to `localhost:5901` and enter `vscode` as the password.

3. You should now see Code - OSS!

Next, let's try debugging.
1. Shut down Code - OSS by clicking the box in the upper right corner of the Code - OSS window through your browser or VNC viewer.
2. Go to your local VS Code client, and use Run / Debug view to launch the **VS Code** configuration. (Typically the default, so you can likely just press <kbd>F5</kbd>).
> **Note:** If launching times out, you can increase the value of `timeout` in the "VS Code", "Attach Main Process", "Attach Extension Host", and "Attach to Shared Process" configurations in [launch.json](../.vscode/launch.json). However, running `scripts/code.sh` first will set up Electron which will usually solve timeout issues.
3. After a bit, Code - OSS will appear with the debugger attached!
Enjoy!
91 changes: 91 additions & 0 deletions .devcontainer/bin/init-dev-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/bash

NONROOT_USER=node
LOG=/tmp/container-init.log

# Execute the command it not already running
startInBackgroundIfNotRunning()
{
log "Starting $1."
echo -e "\n** $(date) **" | sudoIf tee -a /tmp/$1.log > /dev/null
if ! pidof $1 > /dev/null; then
keepRunningInBackground "$@"
while ! pidof $1 > /dev/null; do
sleep 1
done
log "$1 started."
else
echo "$1 is already running." | sudoIf tee -a /tmp/$1.log > /dev/null
log "$1 is already running."
fi
}

# Keep command running in background
keepRunningInBackground()
{
($2 sh -c "while :; do echo [\$(date)] Process started.; $3; echo [\$(date)] Process exited!; sleep 5; done 2>&1" | sudoIf tee -a /tmp/$1.log > /dev/null & echo "$!" | sudoIf tee /tmp/$1.pid > /dev/null)
}

# Use sudo to run as root when required
sudoIf()
{
if [ "$(id -u)" -ne 0 ]; then
sudo "$@"
else
"$@"
fi
}

# Use sudo to run as non-root user if not already running
sudoUserIf()
{
if [ "$(id -u)" -eq 0 ]; then
sudo -u ${NONROOT_USER} "$@"
else
"$@"
fi
}

# Log messages
log()
{
echo -e "[$(date)] $@" | sudoIf tee -a $LOG > /dev/null
}

log "** SCRIPT START **"

# Start dbus.
log 'Running "/etc/init.d/dbus start".'
if [ -f "/var/run/dbus/pid" ] && ! pidof dbus-daemon > /dev/null; then
sudoIf rm -f /var/run/dbus/pid
fi
sudoIf /etc/init.d/dbus start 2>&1 | sudoIf tee -a /tmp/dbus-daemon-system.log > /dev/null
while ! pidof dbus-daemon > /dev/null; do
sleep 1
done

# Set up Xvfb.
startInBackgroundIfNotRunning "Xvfb" sudoIf "Xvfb ${DISPLAY:-:1} +extension RANDR -screen 0 ${MAX_VNC_RESOLUTION:-1920x1080x16}"

# Start fluxbox as a light weight window manager.
startInBackgroundIfNotRunning "fluxbox" sudoUserIf "dbus-launch startfluxbox"

# Start x11vnc
startInBackgroundIfNotRunning "x11vnc" sudoIf "x11vnc -display ${DISPLAY:-:1} -rfbport ${VNC_PORT:-5901} -localhost -no6 -xkb -shared -forever -passwdfile $HOME/.vnc/passwd"

# Set resolution
/usr/local/bin/set-resolution ${VNC_RESOLUTION:-1280x720} ${VNC_DPI:-72}


# Spin up noVNC if installed and not runnning.
if [ -d "/usr/local/novnc" ] && [ "$(ps -ef | grep /usr/local/novnc/noVNC*/utils/launch.sh | grep -v grep)" = "" ]; then
keepRunningInBackground "noVNC" sudoIf "/usr/local/novnc/noVNC*/utils/launch.sh --listen ${NOVNC_PORT:-6080} --vnc localhost:${VNC_PORT:-5901}"
log "noVNC started."
else
log "noVNC is already running or not installed."
fi

# Run whatever was passed in
log "Executing \"$@\"."
"$@"
log "** SCRIPT EXIT **"
25 changes: 25 additions & 0 deletions .devcontainer/bin/set-resolution
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
RESOLUTION=${1:-${VNC_RESOLUTION:-1920x1080}}
DPI=${2:-${VNC_DPI:-72}}
if [ -z "$1" ]; then
echo -e "**Current Settings **\n"
xrandr
echo -n -e "\nEnter new resolution (WIDTHxHEIGHT, blank for ${RESOLUTION}, Ctrl+C to abort).\n> "
read NEW_RES
if [ "${NEW_RES}" != "" ]; then
RESOLUTION=${NEW_RES}
fi
if [ -z "$2" ]; then
echo -n -e "\nEnter new DPI (blank for ${DPI}, Ctrl+C to abort).\n> "
read NEW_DPI
if [ "${NEW_DPI}" != "" ]; then
DPI=${NEW_DPI}
fi
fi
fi

xrandr --fb ${RESOLUTION} --dpi ${DPI} > /dev/null 2>&1

echo -e "\n**New Settings **\n"
xrandr
echo
45 changes: 45 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "Code - OSS",
"build": {
"dockerfile": "Dockerfile",
"args": {
"MAX_VNC_RESOLUTION": "1920x1080x16",
"TARGET_VNC_RESOLUTION": "1280x768",
"TARGET_VNC_PORT": "5901",
"TARGET_NOVNC_PORT": "6080",
"VNC_PASSWORD": "vscode",
"INSTALL_FIREFOX": "true"
}
},
"overrideCommand": false,
"runArgs": [
"--init",
// seccomp=unconfined is required for Chrome sandboxing
"--security-opt", "seccomp=unconfined"
],

"settings": {
// zsh is also available
"terminal.integrated.shell.linux": "/bin/bash",
"resmon.show.battery": false,
"resmon.show.cpufreq": false,
"remote.extensionKind": {
"ms-vscode.js-debug-nightly": "workspace",
"msjsdiag.debugger-for-chrome": "workspace"
},
"debug.chrome.useV3": true
},

// noVNC, VNC ports
"forwardPorts": [6080, 5901],

"extensions": [
"dbaeumer.vscode-eslint",
"EditorConfig.EditorConfig",
"msjsdiag.debugger-for-chrome",
"mutantdino.resourcemonitor",
"GitHub.vscode-pull-request-github"
],

"remoteUser": "node"
}
9 changes: 9 additions & 0 deletions .devcontainer/fluxbox/apps
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[app] (name=code-oss-dev)
[Position] (CENTER) {0 0}
[Maximized] {yes}
[Dimensions] {100% 100%}
[end]
[transient] (role=GtkFileChooserDialog)
[Position] (CENTER) {0 0}
[Dimensions] {70% 70%}
[end]
9 changes: 9 additions & 0 deletions .devcontainer/fluxbox/init
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
session.menuFile: ~/.fluxbox/menu
session.keyFile: ~/.fluxbox/keys
session.styleFile: /usr/share/fluxbox/styles//Squared_for_Debian
session.configVersion: 13
session.screen0.workspaces: 1
session.screen0.workspacewarping: false
session.screen0.toolbar.widthPercent: 100
session.screen0.strftimeFormat: %d %b, %a %02k:%M:%S
session.screen0.toolbar.tools: prevworkspace, workspacename, nextworkspace, clock, prevwindow, nextwindow, iconbar, systemtray
Loading

0 comments on commit 1c4f377

Please sign in to comment.