Add vscode via vendor package.

- Use yarn for vscode vendoring.
- Grab hash from package.
This commit is contained in:
Teffen Ellis 2021-09-08 15:05:49 -04:00 committed by Teffen Ellis
parent 28ba59ab3c
commit f885b29675
32 changed files with 1544 additions and 251 deletions

View File

@ -1,4 +1 @@
name: "code-server CodeQL config"
paths-ignore:
- lib/vscode

View File

@ -124,26 +124,26 @@ jobs:
- name: Build code-server
run: yarn build
# Parse the hash of the latest commit inside lib/vscode
# Parse the hash of the latest commit inside vendor/modules/code-oss-dev
# use this to avoid rebuilding it if nothing changed
# How it works: the `git log` command fetches the hash of the last commit
# that changed a file inside `lib/vscode`. If a commit changes any file in there,
# that changed a file inside `vendor/modules/code-oss-dev`. If a commit changes any file in there,
# the hash returned will change, and we rebuild vscode. If the hash did not change,
# (for example, a change to `src/` or `docs/`), we reuse the same build as last time.
# This saves a lot of time in CI, as compiling VSCode can take anywhere from 5-10 minutes.
- name: Get latest lib/vscode rev
- name: Get latest vendor/modules/code-oss-dev rev
id: vscode-rev
run: echo "::set-output name=rev::$(git log -1 --format='%H' ./lib/vscode)"
run: echo "::set-output name=rev::$(jq -r '.devDependencies["code-oss-dev"]' vendor/package.json | sed -r 's|.*#(.*)$|\1|')"
- name: Attempt to fetch vscode build from cache
id: cache-vscode
uses: actions/cache@v2
with:
path: |
lib/vscode/.build
lib/vscode/out-build
lib/vscode/out-vscode
lib/vscode/out-vscode-min
vendor/modules/code-oss-dev/.build
vendor/modules/code-oss-dev/out-build
vendor/modules/code-oss-dev/out-vscode
vendor/modules/code-oss-dev/out-vscode-min
key: vscode-build-${{ steps.vscode-rev.outputs.rev }}
- name: Build vscode

2
.gitignore vendored
View File

@ -8,7 +8,7 @@ release-packages/
release-gcp/
release-images/
node_modules
/lib/vscode/node_modules.asar
vendor/modules
node-*
/plugins
/lib/coder-cloud-agent

View File

@ -143,9 +143,9 @@
"description": "Static images and the manifest live here in `src/browser/media` (see the explorer)."
},
{
"directory": "lib/vscode",
"directory": "vendor/modules/code-oss-dev",
"line": 1,
"description": "code-server makes use of VS Code's frontend web/remote support. Most of the modifications implement the remote server since that portion of the code is closed source and not released with VS Code.\n\nWe also have a few bug fixes and have added some features (like client-side extensions). See [https://github.com/cdr/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code](https://github.com/cdr/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code) for a list.\n\nWe make an effort to keep the modifications as few as possible."
}
]
}
}

View File

@ -12,10 +12,11 @@ KEEP_MODULES="${KEEP_MODULES-0}"
main() {
cd "$(dirname "${0}")/../.."
source ./ci/lib.sh
VSCODE_SRC_PATH="lib/vscode"
VSCODE_OUT_PATH="$RELEASE_PATH/lib/vscode"
VSCODE_SRC_PATH="vendor/modules/code-oss-dev"
VSCODE_OUT_PATH="$RELEASE_PATH/vendor/modules/code-oss-dev"
mkdir -p "$RELEASE_PATH"
@ -24,7 +25,7 @@ main() {
rsync ./docs/README.md "$RELEASE_PATH"
rsync LICENSE.txt "$RELEASE_PATH"
rsync ./lib/vscode/ThirdPartyNotices.txt "$RELEASE_PATH"
rsync ./vendor/modules/code-oss-dev/ThirdPartyNotices.txt "$RELEASE_PATH"
}
bundle_code_server() {

View File

@ -7,6 +7,7 @@ export npm_config_build_from_source=true
main() {
cd "$(dirname "${0}")/../.."
source ./ci/lib.sh
rsync "$RELEASE_PATH/" "$RELEASE_PATH-standalone"
@ -19,6 +20,7 @@ main() {
node_path="$(yarn -s node <<< 'console.info(process.execPath)')"
mkdir -p "$RELEASE_PATH/bin"
mkdir -p "$RELEASE_PATH/lib"
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
rsync "$node_path" "$RELEASE_PATH/lib/node"
@ -32,7 +34,7 @@ main() {
# leaves a few stray symlinks. Clean them up so nfpm does not fail.
# Remove this line when its no longer needed.
rm -fr "$RELEASE_PATH/lib/vscode/extensions/node_modules/.bin"
rm -fr "$RELEASE_PATH/vendor/modules/code-oss-dev/extensions/node_modules/.bin"
}
main "$@"

View File

@ -1,14 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
# Builds vscode into lib/vscode/out-vscode.
# Builds vscode into vendor/modules/code-oss-dev/out-vscode.
# MINIFY controls whether a minified version of vscode is built.
MINIFY=${MINIFY-true}
main() {
cd "$(dirname "${0}")/../.."
cd lib/vscode
cd vendor/modules/code-oss-dev
yarn gulp compile-build compile-extensions-build compile-extension-media
yarn gulp optimize --gulpfile ./coder.js

View File

@ -6,10 +6,6 @@ main() {
source ./ci/lib.sh
git clean -Xffd
pushd lib/vscode
git clean -xffd
popd
}
main "$@"

View File

@ -87,13 +87,15 @@ symlink_asar() {
}
vscode_yarn() {
cd lib/vscode
echo 'Installing vendor dependencies...'
cd vendor/modules/code-oss-dev
yarn --production --frozen-lockfile
symlink_asar
cd extensions
yarn --production --frozen-lockfile
for ext in */; do
ext="${ext%/}"
echo "extensions/$ext: installing dependencies"

View File

@ -19,7 +19,7 @@ main() {
"*.sh"
)
prettier --write --loglevel=warn $(
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v 'helm-chart'
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v "vendor/modules/code-oss-dev" | grep -v 'helm-chart'
)
doctoc --title '# FAQ' docs/FAQ.md > /dev/null
@ -32,6 +32,7 @@ main() {
doctoc --title '# iPad' docs/ipad.md > /dev/null
doctoc --title '# Termux' docs/termux.md > /dev/null
# TODO: replace with a method that generates fewer false positives.
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
echo "Files need generation or are formatted incorrectly:"
git -c color.ui=always status | grep --color=no '\[31m'

View File

@ -4,17 +4,14 @@ set -euo pipefail
main() {
cd "$(dirname "$0")/../.."
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "lib/vscode")
stylelint $(git ls-files "*.css" | grep -v "lib/vscode")
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "vendor/modules/code-oss-dev" | grep -v "lib/vscode")
stylelint $(git ls-files "*.css" | grep -v "vendor/modules/code-oss-dev" | grep -v "lib/vscode")
tsc --noEmit --skipLibCheck
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "lib/vscode")
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "vendor/modules/code-oss-dev" | grep -v "lib/vscode")
if command -v helm && helm kubeval --help > /dev/null; then
helm kubeval ci/helm-chart
fi
cd lib/vscode
# Run this periodically in vanilla VS code to make sure we don't add any more warnings.
yarn -s eslint --max-warnings=3
cd "$OLDPWD"
}

View File

@ -3,17 +3,28 @@ set -euo pipefail
main() {
cd "$(dirname "$0")/../.."
source ./ci/lib.sh
# This installs the dependencies needed for testing
echo 'Installing code-server test dependencies...'
cd test
yarn
yarn install
cd ..
cd lib/vscode
yarn ${CI+--frozen-lockfile}
cd vendor
echo 'Installing vendor dependencies...'
symlink_asar
# * We install in 'modules' instead of 'node_modules' because VS Code's extensions
# use a webpack config which cannot differentiate between its own node_modules
# and itself being in a directory with the same name.
#
# * We ignore scripts because NPM/Yarn's default behavior is to assume that
# devDependencies are not needed, and that even git repo based packages are
# assumed to be compiled. Because the default behavior for VS Code's `postinstall`
# assumes we're also compiled, this needs to be ignored.
yarn install --modules-folder modules --ignore-scripts --frozen-lockfile
# Finally, run the vendor `postinstall`
yarn run postinstall
}
main "$@"

View File

@ -3,6 +3,7 @@ set -euo pipefail
main() {
cd "$(dirname "$0")/../.."
source ./ci/lib.sh
local dir="$PWD"
@ -24,7 +25,7 @@ main() {
exit 1
fi
if [[ ! -d $dir/lib/vscode/out ]]; then
if [[ ! -d $dir/vendor/modules/code-oss-dev/out ]]; then
echo >&2 "No VS Code build detected"
echo >&2 "You can build it with 'yarn build:vscode' or 'yarn watch'"
exit 1

View File

@ -1,133 +0,0 @@
#!/usr/bin/env bash
# Description: This is a script to make the process of updating vscode versions easier
# Run it with `yarn update:vscode` and it will do the following:
# 1. Check that you have a remote called `vscode`
# 2. Ask you which version you want to upgrade to
# 3. Grab the exact version from the package.json i.e. 1.53.2
# 4. Fetch the vscode remote branches to run the subtree update
# 5. Run the subtree update and pull in the vscode update
# 6. Commit the changes (including merge conflicts)
# 7. Open a draft PR
set -euo pipefail
# This function expects two arguments
# 1. the vscode version we're updating to
# 2. the list of merge conflict files
make_pr_body() {
local BODY="This PR updates vscode to $1
## TODOS
- [ ] test editor locally
- [ ] test terminal locally
- [ ] make notes about any significant changes in docs/CONTRIBUTING.md#notes-about-changes
## Files with conflicts (fix these)
$2"
echo "$BODY"
}
main() {
cd "$(dirname "$0")/../.."
# Check if the remote exists
# if it doesn't, we add it
if ! git config remote.vscode.url > /dev/null; then
echo "Could not find 'vscode' as a remote"
echo "Adding with: git remote add vscode https://github.com/microsoft/vscode.git"
git remote add vscode https://github.com/microsoft/vscode.git
fi
# Ask which version we should update to
# In the future, we'll automate this and grab the latest version automatically
read -r -p "What version of VSCode would you like to update to? (i.e. 1.52) " VSCODE_VERSION_TO_UPDATE
# Check that this version exists
if [[ -z $(git ls-remote --heads vscode release/"$VSCODE_VERSION_TO_UPDATE") ]]; then
echo "Oops, that doesn't look like a valid version."
echo "You entered: $VSCODE_VERSION_TO_UPDATE"
echo "Verify that this branches exists here: https://github.com/microsoft/vscode/branches/all?query=release%2F$VSCODE_VERSION_TO_UPDATE"
exit 1
fi
# Check that they have jq installed
if ! command -v jq &> /dev/null; then
echo "jq could not be found."
echo "We use this when looking up the exact version to update to in the package.json in VS Code."
echo -e "See docs here: https://stedolan.github.io/jq/download/"
exit 1
fi
# Note: `git subtree` returns 129 when installed, and prints help;
# but when uninstalled, returns 1.
set +e
git subtree &> /dev/null
if [ $? -ne 129 ]; then
echo "git-subtree could not be found."
echo "We use this to fetch and update the lib/vscode subtree."
echo -e "Please install git subtree."
exit 1
fi
set -e
# Grab the exact version from package.json
VSCODE_EXACT_VERSION=$(curl -s "https://raw.githubusercontent.com/microsoft/vscode/release/$VSCODE_VERSION_TO_UPDATE/package.json" | jq -r ".version")
echo -e "Great! We'll prep a PR for updating to $VSCODE_EXACT_VERSION\n"
# For some reason the subtree update doesn't work
# unless we fetch all the branches
echo -e "Fetching vscode branches..."
echo -e "Note: this might take a while"
git fetch vscode
# Check if GitHub CLI is installed
if ! command -v gh &> /dev/null; then
echo "GitHub CLI could not be found."
echo "If you install it before you run this script next time, we'll open a draft PR for you!"
echo -e "See docs here: https://github.com/cli/cli#installation\n"
exit
fi
# Push branch to remote if not already pushed
# If we don't do this, the opening a draft PR step won't work
# because it will stop and ask where you want to push the branch
CURRENT_BRANCH=$(git branch | grep '\*' | cut -d' ' -f2-)
if [[ -z $(git config "branch.${CURRENT_BRANCH}.remote") ]]; then
echo "Doesn't look like you've pushed this branch to remote"
echo -e "Pushing now using: git push origin $CURRENT_BRANCH\n"
# Note: we need to set upstream as well or the gh pr create step will fail
# See: https://github.com/cli/cli/issues/575
echo "Please set the upstream and re-run the script"
exit 1
fi
echo "Going to try to update vscode for you..."
echo -e "Running: git subtree pull --prefix lib/vscode vscode release/${VSCODE_VERSION_TO_UPDATE} --squash\n"
# Try to run subtree update command
# Note: we add `|| true` because we want the script to keep running even if the squash fails
# We know the squash fails everytime because there will always be merge conflicts
git subtree pull --prefix lib/vscode vscode release/"${VSCODE_VERSION_TO_UPDATE}" --squash || true
# Get the files with conflicts before we commit them
# so we can list them in the PR body as todo items
CONFLICTS=$(git diff --name-only --diff-filter=U | while read -r line; do echo "- [ ] $line"; done)
PR_BODY=$(make_pr_body "$VSCODE_EXACT_VERSION" "$CONFLICTS")
echo -e "\nForcing a commit with conflicts"
echo "Note: this is intentional"
echo "If we don't do this, code review is impossible."
echo -e "For more info, see docs: docs/CONTRIBUTING.md#updating-vs-code\n"
# We need --no-verify to skip the husky pre-commit hook
# which fails because of the merge conflicts
git add . && git commit -am "chore(vscode): update to $VSCODE_EXACT_VERSION" --no-verify
# Note: we can't open a draft PR unless their are changes.
# Hence why we do this after the subtree update.
echo "Opening a draft PR on GitHub"
# To read about these flags, visit the docs: https://cli.github.com/manual/gh_pr_create
gh pr create --base main --title "feat(vscode): update to version $VSCODE_EXACT_VERSION" --body "$PR_BODY" --reviewer @cdr/code-server-reviewers --repo cdr/code-server --draft
}
main "$@"

View File

@ -16,7 +16,7 @@ async function main(): Promise<void> {
class Watcher {
private readonly rootPath = path.resolve(__dirname, "../..")
private readonly vscodeSourcePath = path.join(this.rootPath, "lib/vscode")
private readonly vscodeSourcePath = path.join(this.rootPath, "vendor/modules/code-oss-dev")
private static log(message: string, skipNewline = false): void {
process.stdout.write(message)

View File

@ -14,7 +14,7 @@ pkg_json_version() {
}
vscode_version() {
jq -r .version lib/vscode/package.json
jq -r .version vendor/modules/code-oss-dev/package.json
}
os() {

View File

@ -77,23 +77,24 @@ yarn watch
### Updates to VS Code
Updating VS Code requires `git subtree`. On some RPM-based Linux distros, `git subtree` is not included by default and needs to be installed separately. To
install, run `dnf install git-subtree` or `yum install git-subtree`.
1. Update the package tag listed in `vendor/package.json`:
To update VS Code:
```json
{
"devDependencies": {
"vscode": "cdr/vscode#X.XX.X-code-server"
}
}
```
1. Run `yarn update:vscode`.
2. Enter a version (e.g., `1.53`)
3. This will open a draft pull request for you.
4. There will be merge conflicts. Commit them first, since it will be impossible
for us to review your PR if you don't.
5. Fix the conflicts. Then, test code-server locally to make sure everything
works.
6. Check the Node.js version that's used by Electron (which is shipped with VS
2. From the code-server **project root**, run `yarn install`.
Then, test code-server locally to make sure everything works.
1. Check the Node.js version that's used by Electron (which is shipped with VS
Code. If necessary, update your version of Node.js to match.
1. Open a PR
> Watch for updates to
> `lib/vscode/src/vs/code/browser/workbench/workbench.html`. You may need to
> `vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.html`. You may need to
> make changes to `src/browser/pages/vscode.html`.
### Build
@ -184,7 +185,7 @@ The CLI code is in [src/node](../src/node) and the HTTP routes are implemented
in [src/node/routes](../src/node/routes).
Most of the meaty parts are in the VS Code portion of the codebase under
[lib/vscode](../lib/vscode), which we describe next.
[vendor/modules/code-oss-dev](../vendor/modules/code-oss-dev), which we describe next.
### Modifications to VS Code
@ -197,66 +198,66 @@ Over time, Microsoft added support to VS Code to run it on the web. They have
made the front-end open source, but not the server. As such, code-server v2 (and
later) uses the VS Code front-end and implements the server. We do this by using
a Git subtree to fork and modify VS Code. This code lives under
[lib/vscode](../lib/vscode).
[vendor/modules/code-oss-dev](../vendor/modules/code-oss-dev).
Some noteworthy changes in our version of VS Code include:
- Adding our build file, [`lib/vscode/coder.js`](../lib/vscode/coder.js), which includes build steps specific to code-server
- Node.js version detection changes in [`build/lib/node.ts`](../lib/vscode/build/lib/node.ts) and [`build/lib/util.ts`](../lib/vscode/build/lib/util.ts)
- Adding our build file, [`vendor/modules/code-oss-dev/coder.js`](../vendor/modules/code-oss-dev/coder.js), which includes build steps specific to code-server
- Node.js version detection changes in [`build/lib/node.ts`](../vendor/modules/code-oss-dev/build/lib/node.ts) and [`build/lib/util.ts`](../vendor/modules/code-oss-dev/build/lib/util.ts)
- Allowing extra extension directories
- Added extra arguments to [`src/vs/platform/environment/common/argv.ts`](../lib/vscode/src/vs/platform/environment/common/argv.ts) and to [`src/vs/platform/environment/node/argv.ts`](../lib/vscode/src/vs/platform/environment/node/argv.ts)
- Added extra environment state to [`src/vs/platform/environment/common/environment.ts`](../lib/vscode/src/vs/platform/environment/common/environment.ts);
- Added extra getters to [`src/vs/platform/environment/common/environmentService.ts`](../lib/vscode/src/vs/platform/environment/common/environmentService.ts)
- Added extra scanning paths to [`src/vs/platform/extensionManagement/node/extensionsScanner.ts`](../lib/vscode/src/vs/platform/extensionManagement/node/extensionsScanner.ts)
- Additions/removals from [`package.json`](../lib/vscode/package.json):
- Added extra arguments to [`src/vs/platform/environment/common/argv.ts`](../vendor/modules/code-oss-dev/src/vs/platform/environment/common/argv.ts) and to [`src/vs/platform/environment/node/argv.ts`](../vendor/modules/code-oss-dev/src/vs/platform/environment/node/argv.ts)
- Added extra environment state to [`src/vs/platform/environment/common/environment.ts`](../vendor/modules/code-oss-dev/src/vs/platform/environment/common/environment.ts);
- Added extra getters to [`src/vs/platform/environment/common/environmentService.ts`](../vendor/modules/code-oss-dev/src/vs/platform/environment/common/environmentService.ts)
- Added extra scanning paths to [`src/vs/platform/extensionManagement/node/extensionsScanner.ts`](../vendor/modules/code-oss-dev/src/vs/platform/extensionManagement/node/extensionsScanner.ts)
- Additions/removals from [`package.json`](../vendor/modules/code-oss-dev/package.json):
- Removing `electron`, `keytar` and `native-keymap` to avoid pulling in desktop dependencies during build on Linux
- Removing `gulp-azure-storage` and `gulp-tar` (unsued in our build process, may pull in outdated dependencies)
- Adding `proxy-agent`, `proxy-from-env` (for proxying) and `rimraf` (used during build/install steps)
- Adding our branding/custom URLs/version:
- [`product.json`](../lib/vscode/product.json)
- [`src/vs/base/common/product.ts`](../lib/vscode/src/vs/base/common/product.ts)
- [`src/vs/workbench/browser/parts/dialogs/dialogHandler.ts`](../lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts)
- [`src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts`](../lib/vscode/src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts)
- [`src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts`](../lib/vscode/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts)
- Removing azure/macOS signing related dependencies from [`build/package.json`](../lib/vscode/build/package.json)
- [`product.json`](../vendor/modules/code-oss-dev/product.json)
- [`src/vs/base/common/product.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/product.ts)
- [`src/vs/workbench/browser/parts/dialogs/dialogHandler.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts)
- [`src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts)
- [`src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts)
- Removing azure/macOS signing related dependencies from [`build/package.json`](../vendor/modules/code-oss-dev/build/package.json)
- Modifying `.gitignore` to allow us to add files to `src/vs/server` and modifying `.eslintignore` to ignore lint on the shared files below (we use different formatter settings than VS Code).
- Sharing some files with our codebase via symlinks:
- [`src/vs/base/common/ipc.d.ts`](../lib/vscode/src/vs/base/common/ipc.d.ts) points to [`typings/ipc.d.ts`](../typings/ipc.d.ts)
- [`src/vs/base/common/util.ts`](../lib/vscode/src/vs/base/common/util.ts) points to [`src/common/util.ts`](../src/common/util.ts)
- [`src/vs/base/node/proxy_agent.ts`](../lib/vscode/src/vs/base/node/proxy_agent.ts) points to [`src/node/proxy_agent.ts`](../src/node/proxy_agent.ts)
- Allowing socket changes by adding `setSocket` in [`src/vs/base/parts/ipc/common/ipc.net.ts`](../lib/vscode/src/vs/base/parts/ipc/common/ipc.net.ts)
- [`src/vs/base/common/ipc.d.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/ipc.d.ts) points to [`typings/ipc.d.ts`](../typings/ipc.d.ts)
- [`src/vs/base/common/util.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/util.ts) points to [`src/common/util.ts`](../src/common/util.ts)
- [`src/vs/base/node/proxy_agent.ts`](../vendor/modules/code-oss-dev/src/vs/base/node/proxy_agent.ts) points to [`src/node/proxy_agent.ts`](../src/node/proxy_agent.ts)
- Allowing socket changes by adding `setSocket` in [`src/vs/base/parts/ipc/common/ipc.net.ts`](../vendor/modules/code-oss-dev/src/vs/base/parts/ipc/common/ipc.net.ts)
- We use this for connection persistence in our server-side code.
- Added our server-side Node.JS code to `src/vs/server`.
- This code includes the logic to spawn the various services (extension host, terminal, etc.) and some glue
- Added [`src/vs/workbench/browser/client.ts`](../lib/vscode/src/vs/workbench/browser/client.ts) to hold some server customizations.
- Added [`src/vs/workbench/browser/client.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/browser/client.ts) to hold some server customizations.
- Includes the functionality for the Log Out command and menu item
- Also, imported and called `initialize` from the main web file, [`src/vs/workbench/browser/web.main.ts`](../lib/vscode/src/vs/workbench/browser/web.main.ts)
- Added a (hopefully temporary) hotfix to [`src/vs/workbench/common/resources.ts`](../lib/vscode/src/vs/workbench/common/resources.ts) to get context menu actions working for the Git integration.
- Added connection type to WebSocket query parameters in [`src/vs/platform/remote/common/remoteAgentConnection.ts`](../lib/vscode/src/vs/platform/remote/common/remoteAgentConnection.ts)
- Added `CODE_SERVER*` variables to the sanitization list in [`src/vs/base/common/processes.ts`](../lib/vscode/src/vs/base/common/processes.ts)
- Also, imported and called `initialize` from the main web file, [`src/vs/workbench/browser/web.main.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/browser/web.main.ts)
- Added a (hopefully temporary) hotfix to [`src/vs/workbench/common/resources.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/common/resources.ts) to get context menu actions working for the Git integration.
- Added connection type to WebSocket query parameters in [`src/vs/platform/remote/common/remoteAgentConnection.ts`](../vendor/modules/code-oss-dev/src/vs/platform/remote/common/remoteAgentConnection.ts)
- Added `CODE_SERVER*` variables to the sanitization list in [`src/vs/base/common/processes.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/processes.ts)
- Fix localization support:
- Added file [`src/vs/workbench/services/localizations/browser/localizationsService.ts`](../lib/vscode/src/vs/workbench/services/localizations/browser/localizationsService.ts).
- Modified file [`src/vs/base/common/platform.ts`](../lib/vscode/src/vs/base/common/platform.ts)
- Modified file [`src/vs/base/node/languagePacks.js`](../lib/vscode/src/vs/base/node/languagePacks.js)
- Added code to allow server to inject settings to [`src/vs/platform/product/common/product.ts`](../lib/vscode/src/vs/platform/product/common/product.ts)
- Added file [`src/vs/workbench/services/localizations/browser/localizationsService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/localizations/browser/localizationsService.ts).
- Modified file [`src/vs/base/common/platform.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/platform.ts)
- Modified file [`src/vs/base/node/languagePacks.js`](../vendor/modules/code-oss-dev/src/vs/base/node/languagePacks.js)
- Added code to allow server to inject settings to [`src/vs/platform/product/common/product.ts`](../vendor/modules/code-oss-dev/src/vs/platform/product/common/product.ts)
- Extension fixes:
- Avoid disabling extensions by extensionKind in [`src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts`](../lib/vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts) (Needed for vscode-icons)
- Remove broken symlinks in [`extensions/postinstall.js`](../lib/vscode/extensions/postinstall.js)
- Add tip about extension gallery in [`src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts`](../lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts)
- Use our own server for GitHub authentication in [`extensions/github-authentication/src/githubServer.ts`](../lib/vscode/extensions/github-authentication/src/githubServer.ts)
- Settings persistence on the server in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts)
- Add extension install fallback in [`src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts`](../lib/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts)
- Add proxy-agent monkeypatch and keep extension host indefinitely running in [`src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts`](../lib/vscode/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts)
- Patch build system to avoid removing extension dependencies for `yarn global add` users in [`build/lib/extensions.ts`](../lib/vscode/build/lib/extensions.ts)
- Allow all extensions to use proposed APIs in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts)
- Make storage writes async to allow extensions to wait for them to complete in [`src/vs/platform/storage/common/storage.ts`](../lib/vscode/src/vs/platform/storage/common/storage.ts)
- Specify webview path in [`src/vs/code/browser/workbench/workbench.ts`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts)
- URL readability improvements for folder/workspace in [`src/vs/code/browser/workbench/workbench.ts`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts)
- Avoid disabling extensions by extensionKind in [`src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts) (Needed for vscode-icons)
- Remove broken symlinks in [`extensions/postinstall.js`](../vendor/modules/code-oss-dev/extensions/postinstall.js)
- Add tip about extension gallery in [`src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts)
- Use our own server for GitHub authentication in [`extensions/github-authentication/src/githubServer.ts`](../vendor/modules/code-oss-dev/extensions/github-authentication/src/githubServer.ts)
- Settings persistence on the server in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/environment/browser/environmentService.ts)
- Add extension install fallback in [`src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts)
- Add proxy-agent monkeypatch and keep extension host indefinitely running in [`src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts)
- Patch build system to avoid removing extension dependencies for `yarn global add` users in [`build/lib/extensions.ts`](../vendor/modules/code-oss-dev/build/lib/extensions.ts)
- Allow all extensions to use proposed APIs in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/environment/browser/environmentService.ts)
- Make storage writes async to allow extensions to wait for them to complete in [`src/vs/platform/storage/common/storage.ts`](../vendor/modules/code-oss-dev/src/vs/platform/storage/common/storage.ts)
- Specify webview path in [`src/vs/code/browser/workbench/workbench.ts`](../vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.ts)
- URL readability improvements for folder/workspace in [`src/vs/code/browser/workbench/workbench.ts`](../vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.ts)
- Socket/Authority-related fixes (for remote proxying etc.):
- [`src/vs/code/browser/workbench/workbench.ts`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts)
- [`src/vs/platform/remote/browser/browserSocketFactory.ts`](../lib/vscode/src/vs/platform/remote/browser/browserSocketFactory.ts)
- [`src/vs/base/common/network.ts`](../lib/vscode/src/vs/base/common/network.ts)
- Added code to write out IPC path in [`src/vs/workbench/api/node/extHostCLIServer.ts`](../lib/vscode/src/vs/workbench/api/node/extHostCLIServer.ts)
- [`src/vs/code/browser/workbench/workbench.ts`](../vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.ts)
- [`src/vs/platform/remote/browser/browserSocketFactory.ts`](../vendor/modules/code-oss-dev/src/vs/platform/remote/browser/browserSocketFactory.ts)
- [`src/vs/base/common/network.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/network.ts)
- Added code to write out IPC path in [`src/vs/workbench/api/node/extHostCLIServer.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/api/node/extHostCLIServer.ts)
As the web portion of VS Code matures, we'll be able to shrink and possibly
eliminate our modifications. In the meantime, upgrading the VS Code version requires

View File

@ -45,7 +45,7 @@ There is a known issue with search not working on Android because it's missing
```sh
# run this command inside the code-server directory
ln -s $PREFIX/bin/rg ./lib/vscode/node_modules/vscode-ripgrep/bin/rg
ln -s $PREFIX/bin/rg ./vendor/modules/code-oss-dev/vscode-ripgrep/bin/rg
```
### Backspace doesn't work

View File

@ -23,8 +23,6 @@
"test:scripts": "./ci/dev/test-scripts.sh",
"package": "./ci/build/build-packages.sh",
"postinstall": "./ci/dev/postinstall.sh",
"update:vscode": "./ci/dev/update-vscode.sh",
"_____": "",
"_audit": "./ci/dev/audit.sh",
"fmt": "./ci/dev/fmt.sh",
"lint": "./ci/dev/lint.sh",
@ -130,6 +128,7 @@
"testEnvironment": "node",
"testPathIgnorePatterns": [
"/node_modules/",
"/vendor/",
"/lib/",
"/out/",
"test/e2e"
@ -154,7 +153,6 @@
}
},
"modulePathIgnorePatterns": [
"<rootDir>/lib/vscode",
"<rootDir>/release-packages",
"<rootDir>/release",
"<rootDir>/release-standalone",

View File

@ -6,10 +6,6 @@
"matchUpdateTypes": ["minor", "patch", "digest"],
"automerge": true,
"groupName": "Minor dependency updates"
},
{
"matchPaths": ["lib/vscode/"],
"enabled": false
}
],
"vulnerabilityAlerts": {

View File

@ -27,7 +27,7 @@
<link rel="alternate icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon.ico" />
<link rel="manifest" href="{{CS_STATIC_BASE}}/src/browser/media/manifest.json" crossorigin="use-credentials" />
<!-- PROD_ONLY
<link data-name="vs/workbench/workbench.web.api" rel="stylesheet" href="{{CS_STATIC_BASE}}/lib/vscode/out/vs/workbench/workbench.web.api.css">
<link data-name="vs/workbench/workbench.web.api" rel="stylesheet" href="{{CS_STATIC_BASE}}/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.css">
END_PROD_ONLY -->
<link rel="apple-touch-icon" sizes="192x192" href="{{CS_STATIC_BASE}}/src/browser/media/pwa-icon-192.png" />
<link rel="apple-touch-icon" sizes="512x512" href="{{CS_STATIC_BASE}}/src/browser/media/pwa-icon-512.png" />
@ -40,13 +40,13 @@
<!-- Startup (do not modify order of script tags!) -->
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/out/browser/pages/vscode.browserified.js"></script>
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/loader.js"></script>
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/vendor/modules/code-oss-dev/out/vs/loader.js"></script>
<script>
performance.mark("code/willLoadWorkbenchMain")
</script>
<!-- PROD_ONLY
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/workbench/workbench.web.api.nls.js"></script>
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/workbench/workbench.web.api.js"></script>
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.nls.js"></script>
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js"></script>
END_PROD_ONLY -->
<script>
require(["vs/code/browser/workbench/workbench"], function () {})

View File

@ -140,7 +140,7 @@ export function _createScriptURL(value: string, origin: string): string {
export function getConfigurationForLoader({ nlsConfig, options, _window }: GetLoaderParams) {
const loader: Loader = {
// Without the full URL VS Code will try to load file://.
baseUrl: `${window.location.origin}${options.csStaticBase}/lib/vscode/out`,
baseUrl: `${window.location.origin}${options.csStaticBase}/vendor/modules/code-oss-dev/out`,
recordStats: true,
trustedTypesPolicy: (_window as FixMeLater).trustedTypes?.createPolicy("amdLoader", {
createScriptURL(value: string): string {

View File

@ -49,7 +49,7 @@ async function entry(): Promise<void> {
console.log({
codeServer: version,
commit,
vscode: require("../../lib/vscode/package.json").version,
vscode: require("../../vendor/modules/code-oss-dev/package.json").version,
})
} else {
console.log(version, commit)

View File

@ -13,7 +13,7 @@ import { humanPath, isFile, open } from "./util"
export const runVsCodeCli = (args: DefaultedArgs): void => {
logger.debug("forking vs code cli...")
const vscode = cp.fork(path.resolve(__dirname, "../../lib/vscode/out/vs/server/fork"), [], {
const vscode = cp.fork(path.resolve(__dirname, "../../vendor/modules/code-oss-dev/out/vs/server/fork"), [], {
env: {
...process.env,
CODE_SERVER_PARENT_PID: process.pid.toString(),

View File

@ -166,7 +166,7 @@ router.get("/callback", ensureAuthenticated, async (req, res) => {
callbacks.set(id, callback)
callbackEmitter.emit({ id, callback })
res.sendFile(path.join(rootPath, "lib/vscode/resources/web/callback.html"))
res.sendFile(path.join(rootPath, "vendor/modules/code-oss-dev/resources/web/callback.html"))
})
router.get("/fetch-callback", ensureAuthenticated, async (req, res) => {

View File

@ -17,7 +17,7 @@ export class VscodeProvider {
private readonly socketProvider = new SocketProxyProvider()
public constructor() {
this.vsRootPath = path.resolve(rootPath, "lib/vscode")
this.vsRootPath = path.resolve(rootPath, "vendor/modules/code-oss-dev")
this.serverRootPath = path.join(this.vsRootPath, "out/vs/server")
wrapper.onDispose(() => this.dispose())
}

View File

@ -253,7 +253,7 @@ describe("vscode", () => {
})
expect(loader).toStrictEqual({
baseUrl: "http://localhost//lib/vscode/out",
baseUrl: "http://localhost//vendor/modules/code-oss-dev/out",
paths: {
"iconv-lite-umd": "../node_modules/iconv-lite-umd/lib/iconv-lite-umd.js",
jschardet: "../node_modules/jschardet/dist/jschardet.min.js",

View File

@ -1,12 +1,12 @@
import bodyParser from "body-parser"
import * as express from "express"
import * as nodeFetch from "node-fetch"
import * as http from "http"
import * as nodeFetch from "node-fetch"
import { HttpCode } from "../../../src/common/http"
import { proxy } from "../../../src/node/proxy"
import { getAvailablePort } from "../../utils/helpers"
import * as httpserver from "../../utils/httpserver"
import * as integration from "../../utils/integration"
import { getAvailablePort } from "../../utils/helpers"
describe("proxy", () => {
const nhooyrDevServer = new httpserver.HttpServer()

View File

@ -1,7 +1,7 @@
import { promises as fs } from "fs"
import * as net from "net"
import * as os from "os"
import * as path from "path"
import * as net from "net"
/**
* Return a mock of @coder/logger.

12
vendor/package.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
"name": "vendor",
"version": "1.0.0",
"license": "MIT",
"private": true,
"scripts": {
"postinstall": "./postinstall.sh"
},
"devDependencies": {
"code-oss-dev": "cdr/vscode#96a09a7846538c3bbedb6a2aeca729537bb8202b"
}
}

10
vendor/postinstall.sh vendored Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
main() {
echo 'Installing VS Code dependencies...'
cd modules/code-oss-dev
yarn install --frozen-lockfile
}
main "$@"

1400
vendor/yarn.lock vendored Normal file

File diff suppressed because it is too large Load Diff