Skip to content

Commit be3e823

Browse files
committed
Squashed 'lib/vscode/' content from commit e5a624b
git-subtree-dir: lib/vscode git-subtree-split: e5a624b
0 parents  commit be3e823

File tree

4,649 files changed

+1311795
-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.

4,649 files changed

+1311795
-0
lines changed

.devcontainer/README.md

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Code - OSS Development Container
2+
3+
This repository includes configuration for a development container for working with Code - OSS in an isolated local container or using [GitHub Codespaces](https://github.com/features/codespaces).
4+
5+
> **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.
6+
7+
## Quick start - local
8+
9+
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.)
10+
11+
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**.
12+
13+
> **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.
14+
15+
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.
16+
17+
![Image of Remote - Containers extension](https://microsoft.github.io/vscode-remote-release/images/remote-containers-extn.png)
18+
19+
> 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.
20+
21+
4. Press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> and select **Remote-Containers: Clone Repository in Container Volume...**.
22+
23+
> **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 "clone repository in container" approach instead since it uses "named volume" rather than the local filesystem.
24+
25+
5. Type `https://github.com/microsoft/vscode` (or a branch or PR URL) in the input box and press <kbd>Enter</kbd>.
26+
27+
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.
28+
29+
Anything you start in VS Code or the integrated terminal will appear here.
30+
31+
Next: **[Try it out!](#try-it)**
32+
33+
## Quick start - GitHub Codespaces
34+
35+
> **IMPORTANT:** The current free user beta for GitHub Codespaces uses a "Basic" sized codespace which does not have enough RAM to run a full build of VS Code and will be considerably slower during codespace start and running VS Code. You'll soon be able to use a "Standard" sized codespace (4-core, 8GB) that will be better suited for this purpose (along with even larger sizes should you need it).
36+
37+
1. From the [microsoft/vscode GitHub repository](https://github.com/microsoft/vscode), click on the **Code** dropdown, select **Open with Codespaces**, and the **New codespace**
38+
39+
> Note that you will not see these options if you are not in the beta yet.
40+
41+
2. After the codespace is up and running in your browser, press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> and select **View: Show Remote Explorer**.
42+
43+
3. You should see port `6080` under **Forwarded Ports**. Select the line and click on the globe icon to open it in a browser tab.
44+
45+
> If you do not see port `6080`, press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd>, select **Forward a Port** and enter port `6080`.
46+
47+
4. In the new tab, you should see noVNC. Click **Connect** and enter `vscode` as the password.
48+
49+
Anything you start in VS Code or the integrated terminal will appear here.
50+
51+
Next: **[Try it out!](#try-it)**
52+
53+
### Using VS Code with GitHub Codespaces
54+
55+
You will likely see better performance when accessing the codespace you created from VS Code since you can use a[VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/). Here's how to do it.
56+
57+
1. [Create a codespace](#quick-start---github-codespaces) if you have not already.
58+
59+
2. Set up [VS Code for use with GitHub Codespaces](https://docs.github.com/github/developing-online-with-codespaces/using-codespaces-in-visual-studio-code)
60+
61+
3. After the VS Code is up and running, press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd>, choose **Codespaces: Connect to Codespace**, and select the codespace you created.
62+
63+
4. After you've connected to the codespace, use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to `localhost:5901` and enter `vscode` as the password.
64+
65+
5. Anything you start in VS Code or the integrated terminal will appear here.
66+
67+
Next: **[Try it out!](#try-it)**
68+
69+
## Try it!
70+
71+
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.
72+
73+
Note you can also set the resolution from the command line by typing `set-resolution`.
74+
75+
To start working with Code - OSS, follow these steps:
76+
77+
1. In your local VS Code, open a terminal (<kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>\`</kbd>) and type the following commands:
78+
79+
```bash
80+
yarn install
81+
bash scripts/code.sh
82+
```
83+
84+
Note that a previous run of `yarn install` will already be cached, so this step should simply pick up any recent differences.
85+
86+
2. After the build is complete, open a web browser or a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to the desktop environnement as described in the quick start and enter `vscode` as the password.
87+
88+
3. You should now see Code - OSS!
89+
90+
Next, let's try debugging.
91+
92+
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.
93+
94+
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>).
95+
96+
> **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.
97+
98+
3. After a bit, Code - OSS will appear with the debugger attached!
99+
100+
Enjoy!

.devcontainer/cache/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.manifest

.devcontainer/cache/before-cache.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
# This file establishes a basline for the reposuitory 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+
8+
SCRIPT_PATH="$(cd "$(dirname $0)" && pwd)"
9+
SOURCE_FOLDER="${1:-"."}"
10+
11+
cd "${SOURCE_FOLDER}"
12+
echo "[$(date)] Generating ""before"" manifest..."
13+
find -L . -not -path "*/.git/*" -and -not -path "${SCRIPT_PATH}/*.manifest" -type f > "${SCRIPT_PATH}/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 dockeer build command used to build the image with the
4+
# cached result of the commands from "prepare.sh" and pushes it to the specified
5+
# container image registry.
6+
7+
set -e
8+
9+
SCRIPT_PATH="$(cd "$(dirname $0)" && pwd)"
10+
CONTAINER_IMAGE_REPOSITORY="$1"
11+
BRANCH="${2:-"master"}"
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..."
23+
docker build -t ${CONTAINER_IMAGE_REPOSITORY}:"${TAG}" -f "${SCRIPT_PATH}/cache.Dockerfile" .
24+
echo "[$(date)] Image build complete."
25+
26+
echo "[$(date)] Pushing image..."
27+
docker push ${CONTAINER_IMAGE_REPOSITORY}:"${TAG}"
28+
echo "[$(date)] Done!"

.devcontainer/cache/cache-diff.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/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 is up, this will be restored into its proper location (which is
5+
# quick and happens parallel to other startup activities)
6+
7+
set -e
8+
9+
SCRIPT_PATH="$(cd "$(dirname $0)" && pwd)"
10+
SOURCE_FOLDER="${1:-"."}"
11+
CACHE_FOLDER="${2:-"/usr/local/etc/devcontainer-cache"}"
12+
13+
echo "[$(date)] Starting cache operation..."
14+
cd "${SOURCE_FOLDER}"
15+
echo "[$(date)] Determining diffs..."
16+
find -L . -not -path "*/.git/*" -and -not -path "${SCRIPT_PATH}/*.manifest" -type f > "${SCRIPT_PATH}/after.manifest"
17+
grep -Fxvf "${SCRIPT_PATH}/before.manifest" "${SCRIPT_PATH}/after.manifest" > "${SCRIPT_PATH}/cache.manifest"
18+
echo "[$(date)] Archiving diffs..."
19+
mkdir -p "${CACHE_FOLDER}"
20+
tar -cf "${CACHE_FOLDER}/cache.tar" --totals --files-from "${SCRIPT_PATH}/cache.manifest"
21+
echo "[$(date)] Done! $(du -h "${CACHE_FOLDER}/cache.tar")"

.devcontainer/cache/cache.Dockerfile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This dockerfile is used to build up from a base image to create an image with cached 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+
FROM mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:dev
4+
5+
ARG USERNAME=node
6+
COPY --chown=${USERNAME}:${USERNAME} . /repo-source-tmp/
7+
RUN mkdir /usr/local/etc/devcontainer-cache \
8+
&& chown ${USERNAME} /usr/local/etc/devcontainer-cache /repo-source-tmp \
9+
&& su ${USERNAME} -c "\
10+
cd /repo-source-tmp \
11+
&& .devcontainer/cache/before-cache.sh \
12+
&& .devcontainer/prepare.sh \
13+
&& .devcontainer/cache/cache-diff.sh" \
14+
&& rm -rf /repo-source-tmp

.devcontainer/cache/restore-diff.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# This file restores the results of the "prepare.sh" into their proper locations
4+
# once the container has been created. It runs as a postCreateCommand which
5+
# in GitHub Codespaces occurs parallel to other startup activities and does not
6+
# really add to the overal startup time given how quick the operation ends up being.
7+
8+
set -e
9+
10+
SOURCE_FOLDER="$(cd "${1:-"."}" && pwd)"
11+
CACHE_FOLDER="${2:-"/usr/local/etc/devcontainer-cache"}"
12+
13+
if [ ! -d "${CACHE_FOLDER}" ]; then
14+
echo "No cache folder found."
15+
exit 0
16+
fi
17+
18+
echo "[$(date)] Expanding $(du -h "${CACHE_FOLDER}/cache.tar") file to ${SOURCE_FOLDER}..."
19+
cd "${SOURCE_FOLDER}"
20+
tar -xf "${CACHE_FOLDER}/cache.tar"
21+
rm -f "${CACHE_FOLDER}/cache.tar"
22+
echo "[$(date)] Done!"
23+

.devcontainer/devcontainer.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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-master",
6+
7+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/node/workspace/vscode,type=bind,consistency=cached",
8+
"workspaceFolder": "/home/node/workspace/vscode",
9+
"overrideCommand": false,
10+
"runArgs": [ "--init", "--security-opt", "seccomp=unconfined"],
11+
12+
"settings": {
13+
"terminal.integrated.shell.linux": "/bin/bash",
14+
"resmon.show.battery": false,
15+
"resmon.show.cpufreq": false
16+
},
17+
18+
// noVNC, VNC, debug ports
19+
"forwardPorts": [6080, 5901, 9222],
20+
21+
"extensions": [
22+
"dbaeumer.vscode-eslint",
23+
"mutantdino.resourcemonitor"
24+
],
25+
26+
// Optionally loads a cached yarn install for the repo
27+
"postCreateCommand": ".devcontainer/cache/restore-diff.sh",
28+
29+
"remoteUser": "node"
30+
}

.devcontainer/prepare.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# This file contains the steps that should be run when creating the intermediary image that contains
4+
# contents for that should be in the image by default. It will be used to build up from the base image
5+
# to create an image that speeds up first time use of the dev container by "caching" the results
6+
# of these commands. Developers can still run these commands without an issue once the container is
7+
# up, but only differences will be processed which also speeds up the first time these operations occur.
8+
9+
yarn install
10+
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

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
**/vs/nls.build.js
2+
**/vs/nls.js
3+
**/vs/css.build.js
4+
**/vs/css.js
5+
**/vs/loader.js
6+
**/insane/**
7+
**/marked/**
8+
**/semver/**
9+
**/test/**/*.js
10+
**/node_modules/**
11+
**/vscode-api-tests/testWorkspace/**
12+
**/vscode-api-tests/testWorkspace2/**
13+
**/extensions/**/out/**
14+
**/extensions/**/build/**
15+
**/extensions/markdown-language-features/media/**
16+
**/extensions/typescript-basics/test/colorize-fixtures/**

0 commit comments

Comments
 (0)