1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-26 12:15:26 +00:00

Make extension sidebar work

This commit is contained in:
Asher 2019-07-10 16:29:15 -05:00
parent 86e8ba12e7
commit 54ffd1d351
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
7 changed files with 934 additions and 1286 deletions

View File

@ -8,14 +8,14 @@ matrix:
- os: linux - os: linux
dist: trusty dist: trusty
env: env:
- VSCODE_VERSION="1.36.0" MAJOR_VERSION="2" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER" TARGET="centos" - VSCODE_VERSION="1.36.1" MAJOR_VERSION="2" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER" TARGET="centos"
- os: linux - os: linux
dist: trusty dist: trusty
env: env:
- VSCODE_VERSION="1.36.0" MAJOR_VERSION="2" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER" TARGET="alpine" - VSCODE_VERSION="1.36.1" MAJOR_VERSION="2" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER" TARGET="alpine"
- os: osx - os: osx
env: env:
- VSCODE_VERSION="1.36.0" MAJOR_VERSION="2" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER" - VSCODE_VERSION="1.36.1" MAJOR_VERSION="2" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER"
before_install: before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y libxkbfile-dev libsecret-1-dev; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y libxkbfile-dev libsecret-1-dev; fi
- npm install -g yarn@1.12.3 - npm install -g yarn@1.12.3

View File

@ -61,15 +61,18 @@ How to [secure your setup](/doc/security/ssl.md).
## Development ## Development
- Clone VS Code. ```fish
- Run `yarn` in the VS Code root directory. git clone https://github.com/microsoft/vscode
- Run `yarn compile` in the VS Code root directory. cd vscode
- Clone this repository to `src/vs/server` in the VS Code source. git clone https://github.com/cdr/code-server src/vs/server
- Run `yarn` in this directory. cd src/vs/server
- Run `yarn watch` in this directory. yarn patch:apply
- Wait for the initial compilation to complete. yarn
- Run `yarn start` in this directory. yarn watch
- Visit `http://localhost:8443`. # Wait for the initial compilation to complete (it will say "Finished compilation").
yarn start
# Visit http://localhost:8443
```
### Known Issues ### Known Issues

View File

@ -1,13 +1,16 @@
{ {
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"postinstall": "rm -r node_modules/@types/node # I keep getting type conflicts", "preinstall": "cd ../../../ && yarn",
"postinstall": "rm -rf node_modules/@types/node # I keep getting type conflicts",
"start": "nodemon ../../../out/vs/server/main.js --watch ../../../out --verbose", "start": "nodemon ../../../out/vs/server/main.js --watch ../../../out --verbose",
"watch": "cd ../../../ && yarn watch-client", "watch": "cd ../../../ && yarn watch",
"build": "bash ./scripts/tasks.bash build", "build": "bash ./scripts/tasks.bash build",
"package": "bash ./scripts/tasks.bash package", "package": "bash ./scripts/tasks.bash package",
"vstar": "bash ./scripts/tasks.bash vstar", "vstar": "bash ./scripts/tasks.bash vstar",
"binary": "bash ./scripts/tasks.bash binary" "binary": "bash ./scripts/tasks.bash binary",
"patch:generate": "cd ../../../ && git diff --staged > ./src/vs/server/scripts/vscode.patch",
"patch:apply": "cd ../../../ && git apply ./src/vs/server/scripts/vscode.patch"
}, },
"devDependencies": { "devDependencies": {
"@types/tar-stream": "^1.6.1", "@types/tar-stream": "^1.6.1",

View File

@ -36,7 +36,9 @@ function copy-server() {
else else
log "Installing dependencies" log "Installing dependencies"
cd "${serverPath}" cd "${serverPath}"
yarn # Ignore scripts to avoid also installing VS Code dependencies which has
# already been done.
yarn --ignore-scripts
rm -r node_modules/@types/node # I keep getting type conflicts rm -r node_modules/@types/node # I keep getting type conflicts
fi fi
} }
@ -62,6 +64,9 @@ function build-code-server() {
# the same type of build you get with the vscode-linux-x64-min task). # the same type of build you get with the vscode-linux-x64-min task).
# Something like: yarn gulp "vscode-server-${target}-${arch}-min" # Something like: yarn gulp "vscode-server-${target}-${arch}-min"
cd "${vscodeSourcePath}" cd "${vscodeSourcePath}"
git reset --hard
git clean -fd
git apply "${rootPath}/scripts/vscode.patch"
yarn gulp compile-client yarn gulp compile-client
rm -rf "${codeServerBuildPath}" rm -rf "${codeServerBuildPath}"
@ -105,7 +110,6 @@ function build-vscode() {
npm rebuild || true npm rebuild || true
# Keep just what we need to keep the pre-built archive smaller. # Keep just what we need to keep the pre-built archive smaller.
rm -rf "${vscodeSourcePath}/.git"
rm -rf "${vscodeSourcePath}/test" rm -rf "${vscodeSourcePath}/test"
else else
log "${vscodeSourceName}/node_modules already exists, skipping install" log "${vscodeSourceName}/node_modules already exists, skipping install"
@ -192,7 +196,7 @@ function package-task() {
rm -rf "${archivePath}" rm -rf "${archivePath}"
mkdir -p "${archivePath}" mkdir -p "${archivePath}"
cp "${buildPath}/code-server" "${archivePath}" cp "${buildPath}/${binaryName}" "${archivePath}/code-server"
cp "${rootPath}/README.md" "${archivePath}" cp "${rootPath}/README.md" "${archivePath}"
cp "${vscodeSourcePath}/LICENSE.txt" "${archivePath}" cp "${vscodeSourcePath}/LICENSE.txt" "${archivePath}"
cp "${vscodeSourcePath}/ThirdPartyNotices.txt" "${archivePath}" cp "${vscodeSourcePath}/ThirdPartyNotices.txt" "${archivePath}"
@ -216,8 +220,8 @@ function binary-task() {
npm link @coder/nbin npm link @coder/nbin
node "${rootPath}/scripts/nbin.js" "${target}" "${arch}" "${codeServerBuildPath}" node "${rootPath}/scripts/nbin.js" "${target}" "${arch}" "${codeServerBuildPath}"
rm node_modules/@coder/nbin rm node_modules/@coder/nbin
mv "${codeServerBuildPath}/code-server" "${buildPath}" mv "${codeServerBuildPath}/code-server" "${buildPath}/${binaryName}"
log "Binary at ${buildPath}/code-server" log "Binary at ${buildPath}/${binaryName}"
} }
function main() { function main() {
@ -237,6 +241,19 @@ function main() {
# will compile everything in the build directory as well. # will compile everything in the build directory as well.
local outPath="${OUT:-${rootPath}}" local outPath="${OUT:-${rootPath}}"
# If we're inside a vscode directory, assume we want to develop. In that case
# we should set an OUT directory and not build in this directory.
if [[ "${outPath}" == "${rootPath}" ]] ; then
local maybeVscode
local dirName
maybeVscode="$(realpath "${outPath}/../../..")"
dirName="$(basename "${maybeVscode}")"
if [[ "${dirName}" == "vscode" ]] ; then
log "Set the OUT environment variable to something outside ${maybeVscode}" "error"
exit 1
fi
fi
local releasePath="${outPath}/release" local releasePath="${outPath}/release"
local buildPath="${outPath}/build" local buildPath="${outPath}/build"
@ -245,8 +262,9 @@ function main() {
local vscodeSourcePath="${buildPath}/${vscodeSourceName}" local vscodeSourcePath="${buildPath}/${vscodeSourceName}"
local vscodeBuildPath="${buildPath}/${vscodeBuildName}" local vscodeBuildPath="${buildPath}/${vscodeBuildName}"
local codeServerBuildName="code-server-${target}-${arch}-built" local codeServerBuildName="code-server-${vscodeVersion}-${target}-${arch}-built"
local codeServerBuildPath="${buildPath}/${codeServerBuildName}" local codeServerBuildPath="${buildPath}/${codeServerBuildName}"
local binaryName="code-server-${vscodeVersion}-${target}-${arch}"
log "Running ${task} task" log "Running ${task} task"
log " rootPath: ${rootPath}" log " rootPath: ${rootPath}"

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,11 @@
// This file is included via a regular Node require. I'm not sure how (or if) // This file is included via a regular Node require. I'm not sure how (or if)
// we can write this in Typescript and have it compile to non-AMD syntax. // we can write this in Typescript and have it compile to non-AMD syntax.
module.exports = (remoteAuthority) => { module.exports = (remoteAuthority, https) => {
return { return {
transformIncoming: (uri) => { transformIncoming: (uri) => {
switch (uri.scheme) { switch (uri.scheme) {
case "vscode-remote": return { scheme: "file", path: uri.path }; case "https": return { scheme: "file", path: uri.path };
case "http": return { scheme: "file", path: uri.path };
case "file": return { scheme: "vscode-local", path: uri.path }; case "file": return { scheme: "vscode-local", path: uri.path };
default: return uri; default: return uri;
} }
@ -12,14 +13,14 @@ module.exports = (remoteAuthority) => {
transformOutgoing: (uri) => { transformOutgoing: (uri) => {
switch (uri.scheme) { switch (uri.scheme) {
case "vscode-local": return { scheme: "file", path: uri.path }; case "vscode-local": return { scheme: "file", path: uri.path };
case "file": return { scheme: "vscode-remote", authority: remoteAuthority, path: uri.path }; case "file": return { scheme: https ? "https" : "http", authority: remoteAuthority, path: uri.path };
default: return uri; default: return uri;
} }
}, },
transformOutgoingScheme: (scheme) => { transformOutgoingScheme: (scheme) => {
switch (scheme) { switch (scheme) {
case "vscode-local": return "file"; case "vscode-local": return "file";
case "file": return "vscode-remote"; case "file": return https ? "https" : "http";
default: return scheme; default: return scheme;
} }
}, },

3
uriTransformerHttps.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = (remoteAuthority) => {
return require("./uriTransformer")(remoteAuthority, true);
};