Skip to content

Commit c080c66

Browse files
Import VSCode History as of 2022-05-24
1 parent afb5abe commit c080c66

File tree

5,866 files changed

+1657266
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,866 files changed

+1657266
-0
lines changed

.devcontainer/README.md

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Code - OSS Development Container
2+
3+
[![Open in Remote - Containers](https://img.shields.io/static/v1?label=Remote%20-%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode)
4+
5+
This repository includes configuration for a development container for working with Code - OSS in a local container or using [GitHub Codespaces](https://github.com/features/codespaces).
6+
7+
> **Tip:** The default VNC password is `vscode`. The VNC server runs on port `5901` and a web client is available on port `6080`.
8+
9+
## Quick start - local
10+
11+
If you already have VS Code and Docker installed, you can click the badge above or [here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode) to get started. Clicking these links will cause VS Code to automatically install the Remote - Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
12+
13+
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.)
14+
15+
2. **Important**: Docker needs at least **4 Cores and 8 GB of RAM** to run a full build. If you are on macOS, or are using the old Hyper-V engine for Windows, update these values for Docker Desktop by right-clicking on the Docker status bar item and going to **Preferences/Settings > Resources > Advanced**.
16+
17+
> **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.
18+
19+
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.
20+
21+
![Image of Remote - Containers extension](https://microsoft.github.io/vscode-remote-release/images/remote-containers-extn.png)
22+
23+
> **Note:** 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.
24+
25+
4. Press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd> and select **Remote-Containers: Clone Repository in Container Volume...**.
26+
27+
> **Tip:** While you can use your local source tree instead, operations like `yarn install` can be slow on macOS or when using the Hyper-V engine on Windows. We recommend the "clone repository in container" approach instead since it uses "named volume" rather than the local filesystem.
28+
29+
5. Type `https://github.com/microsoft/vscode` (or a branch or PR URL) in the input box and press <kbd>Enter</kbd>.
30+
31+
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.
32+
33+
Anything you start in VS Code, or the integrated terminal, will appear here.
34+
35+
Next: **[Try it out!](#try-it)**
36+
37+
## Quick start - GitHub Codespaces
38+
39+
1. From the [microsoft/vscode GitHub repository](https://github.com/microsoft/vscode), click on the **Code** dropdown, select **Open with Codespaces**, and then click on **New codespace**. If prompted, select the **Standard** machine size (which is also the default).
40+
41+
> **Note:** You will not see these options within GitHub if you are not in the Codespaces beta.
42+
43+
2. After the codespace is up and running in your browser, press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd> and select **Ports: Focus on Ports View**.
44+
45+
3. You should see **VNC web client (6080)** under in the list of ports. Select the line and click on the globe icon to open it in a browser tab.
46+
47+
> **Tip:** If you do not see the port, <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd>, select **Forward a Port** and enter port `6080`.
48+
49+
4. In the new tab, you should see noVNC. Click **Connect** and enter `vscode` as the password.
50+
51+
Anything you start in VS Code, or the integrated terminal, will appear here.
52+
53+
Next: **[Try it out!](#try-it)**
54+
55+
### Using VS Code with GitHub Codespaces
56+
57+
You may see improved VNC responsiveness when accessing a codespace from VS Code client since you can use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/). Here's how to do it.
58+
59+
1. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the the [GitHub Codespaces extension](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces).
60+
61+
> **Note:** The GitHub Codespaces extension requires the Visual Studio Code distribution of Code - OSS.
62+
63+
2. After the VS Code is up and running, press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd>, choose **Codespaces: Create New Codespace**, and use the following settings:
64+
- `microsoft/vscode` for the repository.
65+
- Select any branch (e.g. **main**) - you can select a different one later.
66+
- Choose **Standard** (4-core, 8GB) as the size.
67+
68+
4. After you have connected to the codespace, you can use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to `localhost:5901` and enter `vscode` as the password.
69+
70+
> **Tip:** You may also need change your VNC client's **Picture Quality** setting to **High** to get a full color desktop.
71+
72+
5. Anything you start in VS Code, or the integrated terminal, will appear here.
73+
74+
Next: **[Try it out!](#try-it)**
75+
76+
## Try it!
77+
78+
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.
79+
80+
> **Note:** You can also set the resolution from the command line by typing `set-resolution`.
81+
82+
To start working with Code - OSS, follow these steps:
83+
84+
1. In your local VS Code client, open a terminal (<kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>\`</kbd>) and type the following commands:
85+
86+
```bash
87+
yarn install
88+
bash scripts/code.sh
89+
```
90+
91+
2. After the build is complete, open a web browser or a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to the desktop environment as described in the quick start and enter `vscode` as the password.
92+
93+
3. You should now see Code - OSS!
94+
95+
Next, let's try debugging.
96+
97+
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.
98+
99+
2. Go to your local VS Code client, and use the **Run / Debug** view to launch the **VS Code** configuration. (Typically the default, so you can likely just press <kbd>F5</kbd>).
100+
101+
> **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.
102+
103+
3. After a bit, Code - OSS will appear with the debugger attached!
104+
105+
Enjoy!

.devcontainer/cache/before-cache.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
# This file establishes a basline for the repository before any steps in the "prepare.sh"
4+
# are run. Its just a find command that filters out a few things we don't need to watch.
5+
6+
set -e
7+
SOURCE_FOLDER="${1:-"."}"
8+
CACHE_FOLDER="${2:-"$HOME/.devcontainer-cache"}"
9+
10+
cd "${SOURCE_FOLDER}"
11+
echo "[$(date)] Generating ""before"" manifest..."
12+
mkdir -p "${CACHE_FOLDER}"
13+
find -L . -not -path "*/.git/*" -and -not -path "${CACHE_FOLDER}/*.manifest" -type f > "${CACHE_FOLDER}/before.manifest"
14+
echo "[$(date)] Done!"
15+
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# This file simply wraps the docker build command to build an image that includes
4+
# a cache.tar file with the result of "prepare.sh" inside of it. See cache.Dockerfile
5+
# for the steps that are actually taken to do this.
6+
7+
set -e
8+
9+
SCRIPT_PATH="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"
10+
CONTAINER_IMAGE_REPOSITORY="$1"
11+
BRANCH="${2:-"main"}"
12+
13+
if [ "${CONTAINER_IMAGE_REPOSITORY}" = "" ]; then
14+
echo "Container repository not specified!"
15+
exit 1
16+
fi
17+
18+
TAG="branch-${BRANCH//\//-}"
19+
echo "[$(date)] ${BRANCH} => ${TAG}"
20+
cd "${SCRIPT_PATH}/../.."
21+
22+
echo "[$(date)] Starting image build and push..."
23+
export DOCKER_BUILDKIT=1
24+
docker buildx create --use --name vscode-dev-containers
25+
docker run --privileged --rm tonistiigi/binfmt --install all
26+
docker buildx build --push --platform linux/amd64,linux/arm64 -t ${CONTAINER_IMAGE_REPOSITORY}:"${TAG}" -f "${SCRIPT_PATH}/cache.Dockerfile" .
27+
28+
echo "[$(date)] Done!"

.devcontainer/cache/cache-diff.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# This file is used to archive off a copy of any differences in the source tree into another location
4+
# in the image. Once the codespace / container is up, this will be restored into its proper location.
5+
6+
set -e
7+
8+
SOURCE_FOLDER="${1:-"."}"
9+
CACHE_FOLDER="${2:-"$HOME/.devcontainer-cache"}"
10+
11+
if [ ! -d "${CACHE_FOLDER}" ]; then
12+
echo "No cache folder found. Be sure to run before-cache.sh to set one up."
13+
exit 1
14+
fi
15+
16+
echo "[$(date)] Starting cache operation..."
17+
cd "${SOURCE_FOLDER}"
18+
echo "[$(date)] Determining diffs..."
19+
find -L . -not -path "*/.git/*" -and -not -path "${CACHE_FOLDER}/*.manifest" -type f > "${CACHE_FOLDER}/after.manifest"
20+
grep -Fxvf "${CACHE_FOLDER}/before.manifest" "${CACHE_FOLDER}/after.manifest" > "${CACHE_FOLDER}/cache.manifest"
21+
echo "[$(date)] Archiving diffs..."
22+
tar -cf "${CACHE_FOLDER}/cache.tar" --totals --files-from "${CACHE_FOLDER}/cache.manifest"
23+
echo "[$(date)] Done! $(du -h "${CACHE_FOLDER}/cache.tar")"

.devcontainer/cache/cache.Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This dockerfile is used to build up from a base image to create an image a cache.tar file containing the results of running "prepare.sh".
2+
# Other image contents: https://github.com/microsoft/vscode-dev-containers/blob/master/repository-containers/images/github.com/microsoft/vscode/.devcontainer/base.Dockerfile
3+
4+
# This first stage generates cache.tar
5+
FROM mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:dev as cache
6+
ARG USERNAME=node
7+
ARG CACHE_FOLDER="/home/${USERNAME}/.devcontainer-cache"
8+
COPY --chown=${USERNAME}:${USERNAME} . /repo-source-tmp/
9+
RUN mkdir -p ${CACHE_FOLDER} && chown ${USERNAME} ${CACHE_FOLDER} /repo-source-tmp \
10+
&& su ${USERNAME} -c "\
11+
cd /repo-source-tmp \
12+
&& .devcontainer/cache/before-cache.sh . ${CACHE_FOLDER} \
13+
&& .devcontainer/prepare.sh . ${CACHE_FOLDER} \
14+
&& .devcontainer/cache/cache-diff.sh . ${CACHE_FOLDER}"
15+
16+
# This second stage starts fresh and just copies in cache.tar from the previous stage. The related
17+
# devcontainer.json file is then setup to have postCreateCommand fire restore-diff.sh to expand it.
18+
FROM mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:dev as dev-container
19+
ARG USERNAME=node
20+
ARG CACHE_FOLDER="/home/${USERNAME}/.devcontainer-cache"
21+
RUN mkdir -p "${CACHE_FOLDER}" \
22+
&& chown "${USERNAME}:${USERNAME}" "${CACHE_FOLDER}" \
23+
&& su ${USERNAME} -c "git config --global codespaces-theme.hide-status 1"
24+
COPY --from=cache ${CACHE_FOLDER}/cache.tar ${CACHE_FOLDER}/

.devcontainer/cache/restore-diff.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
# This file expands the cache.tar file in the image that contains the results of "prepare.sh"
4+
# on top of the source tree. It runs as a postCreateCommand which runs after the container/codespace
5+
# is already up where you would typically run a command like "yarn install".
6+
7+
set -e
8+
SOURCE_FOLDER="$(cd "${1:-"."}" && pwd)"
9+
CACHE_FOLDER="${2:-"$HOME/.devcontainer-cache"}"
10+
11+
if [ ! -d "${CACHE_FOLDER}" ]; then
12+
echo "No cache folder found."
13+
exit 0
14+
fi
15+
16+
echo "[$(date)] Expanding $(du -h "${CACHE_FOLDER}/cache.tar") file to ${SOURCE_FOLDER}..."
17+
cd "${SOURCE_FOLDER}"
18+
# Ensure user/group is correct if the UID/GID was changed for some reason
19+
echo "+1000 +$(id -u)" > "${CACHE_FOLDER}/cache-owner-map"
20+
echo "+1000 +$(id -g)" > "${CACHE_FOLDER}/cache-group-map"
21+
# Untar to workspace folder, preserving permissions and order, but mapping GID/UID if required
22+
tar --owner-map="${CACHE_FOLDER}/cache-owner-map" --group-map="${CACHE_FOLDER}/cache-group-map" -xpsf "${CACHE_FOLDER}/cache.tar"
23+
rm -rf "${CACHE_FOLDER}"
24+
echo "[$(date)] Done!"
25+
26+
# Change ownership of chrome-sandbox
27+
sudo chown root .build/electron/chrome-sandbox
28+
sudo chmod 4755 .build/electron/chrome-sandbox
29+

.devcontainer/devcontainer.json

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "Code - OSS",
3+
4+
// Image contents: https://github.com/microsoft/vscode-dev-containers/blob/master/repository-containers/images/github.com/microsoft/vscode/.devcontainer/base.Dockerfile
5+
"image": "mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:branch-main",
6+
"overrideCommand": false,
7+
"runArgs": [ "--init", "--security-opt", "seccomp=unconfined", "--shm-size=1g"],
8+
9+
"settings": {
10+
"resmon.show.battery": false,
11+
"resmon.show.cpufreq": false
12+
},
13+
14+
// noVNC, VNC
15+
"forwardPorts": [6080, 5901],
16+
"portsAttributes": {
17+
"6080": {
18+
"label": "VNC web client (noVNC)",
19+
"onAutoForward": "silent"
20+
},
21+
"5901": {
22+
"label": "VNC TCP port",
23+
"onAutoForward": "silent"
24+
}
25+
},
26+
27+
"extensions": [
28+
"dbaeumer.vscode-eslint",
29+
"mutantdino.resourcemonitor"
30+
],
31+
32+
// Optionally loads a cached yarn install for the repo
33+
"postCreateCommand": ".devcontainer/cache/restore-diff.sh",
34+
35+
"remoteUser": "node",
36+
37+
"hostRequirements": {
38+
"memory": "8gb"
39+
}
40+
}

.devcontainer/prepare.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
# This file contains the steps that should be run when building a "cache" image with contents that should be
4+
# layered directly **on top of the source tree** once a dev container is created. This avoids having to run long
5+
# running commands like "yarn install" from the ground up. Developers (and should) still run these commands
6+
# after the actual dev container is created, but only differences will be processed.
7+
8+
yarn install
9+
yarn electron

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Tab indentation
7+
[*]
8+
indent_style = tab
9+
trim_trailing_whitespace = true
10+
11+
# The indent size used in the `package.json` file cannot be changed
12+
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
13+
[{*.yml,*.yaml,package.json}]
14+
indent_style = space
15+
indent_size = 2

.eslintignore

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
**/build/*/**/*.js
2+
**/dist/**/*.js
3+
**/extensions/**/*.d.ts
4+
**/extensions/**/build/**
5+
**/extensions/**/colorize-fixtures/**
6+
**/extensions/css-language-features/server/test/pathCompletionFixtures/**
7+
**/extensions/html-language-features/server/lib/jquery.d.ts
8+
**/extensions/html-language-features/server/src/test/pathCompletionFixtures/**
9+
**/extensions/markdown-language-features/media/**
10+
**/extensions/markdown-language-features/notebook-out/**
11+
**/extensions/markdown-math/notebook-out/**
12+
**/extensions/notebook-renderers/renderer-out/index.js
13+
**/extensions/simple-browser/media/index.js
14+
**/extensions/typescript-language-features/test-workspace/**
15+
**/extensions/vscode-api-tests/testWorkspace/**
16+
**/extensions/vscode-api-tests/testWorkspace2/**
17+
**/fixtures/**
18+
**/node_modules/**
19+
**/out-*/**/*.js
20+
**/out-editor-*/**
21+
**/out/**/*.js
22+
**/src/**/dompurify.js
23+
**/src/**/marked.js
24+
**/src/**/semver.js
25+
**/src/typings/**/*.d.ts
26+
**/src/vs/*/**/*.d.ts
27+
**/src/vs/base/test/common/filters.perf.data.js
28+
**/src/vs/css.build.js
29+
**/src/vs/css.js
30+
**/src/vs/loader.js
31+
**/src/vs/nls.build.js
32+
**/src/vs/nls.js
33+
**/test/unit/assert.js
34+
**/typings/**

0 commit comments

Comments
 (0)