Archived
1
0

Merge commit 'be3e8236086165e5e45a5a10783823874b3f3ebd' as 'lib/vscode'

This commit is contained in:
Joe Previte
2020-12-15 15:52:33 -07:00
4649 changed files with 1311795 additions and 0 deletions

View File

@ -0,0 +1,61 @@
_@@APPNAME@@()
{
local cur prev words cword split
_init_completion -s || return
_expand || return
case $prev in
-d|--diff)
_filedir
return
;;
-a|--add|--user-data-dir|--extensions-dir)
_filedir -d
return
;;
-g|--goto)
compopt -o nospace
_filedir
return
;;
--locale)
COMPREPLY=( $( compgen -W 'de en en-US es fr it ja ko ru zh-CN zh-TW bg hu pt-br tr' ) )
return
;;
--install-extension|--uninstall-extension)
_filedir vsix
return
;;
--log)
COMPREPLY=( $( compgen -W 'critical error warn info debug trace off' ) )
return
;;
--folder-uri|--disable-extension|--max-memory)
# argument required but no completions available
return 0
;;
--enable-proposed-api)
# argument optional but no completions available
;;
esac
$split && return
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-d --diff --folder-uri -a --add -g
--goto -n --new-window -r --reuse-window -w --wait --locale=
--user-data-dir -v --version -h --help --extensions-dir
--list-extensions --show-versions --install-extension
--uninstall-extension --enable-proposed-api --verbose --log -s
--status -p --performance --prof-startup --disable-extensions
--disable-extension --inspect-extensions
--inspect-brk-extensions --disable-gpu
--max-memory=' -- "$cur") )
[[ $COMPREPLY == *= ]] && compopt -o nospace
return
fi
_filedir
} &&
complete -F _@@APPNAME@@ @@APPNAME@@

View File

@ -0,0 +1,39 @@
#compdef @@APPNAME@@
local arguments
arguments=(
'(-d --diff)'{-d,--diff}'[compare two files with each other]:file to compare:_files:file to compare with:_files'
\*'--folder-uri[open a window with given folder uri(s)]:folder uri: '
\*{-a,--add}'[add folder(s) to the last active window]:directory:_directories'
'(-g --goto)'{-g,--goto}'[open a file at the path on the specified line and column position]:file\:line[\:column]:_files -r \:'
'(-n --new-window -r --reuse-window)'{-n,--new-window}'[force to open a new window]'
'(-n --new-window -r --reuse-window)'{-r,--reuse-window}'[force to open a file or folder in an already opened window]'
'(-w --wait)'{-w,--wait}'[wait for the files to be closed before returning]'
'--locale=[the locale to use (e.g. en-US or zh-TW)]:locale (e.g. en-US or zh-TW):(de en en-US es fr it ja ko ru zh-CN zh-TW bg hu pt-br tr)'
'--user-data-dir[specify the directory that user data is kept in]:directory:_directories'
'(- *)'{-v,--version}'[print version]'
'(- *)'{-h,--help}'[print usage]'
'--telemetry[show all telemetry events which VS code collects]'
'--extensions-dir[set the root path for extensions]:root path:_directories'
'--list-extensions[list the installed extensions]'
'--category[filters installed extension list by category, when using --list-extension]'
'--show-versions[show versions of installed extensions, when using --list-extension]'
'--install-extension[install an extension]:id or path:_files -g "*.vsix(-.)"'
'--uninstall-extension[uninstall an extension]:id or path:_files -g "*.vsix(-.)"'
'--enable-proposed-api[enables proposed API features for extensions]::extension id: '
'--verbose[print verbose output (implies --wait)]'
'--log[log level to use]:level [info]:(critical error warn info debug trace off)'
'(-s --status)'{-s,--status}'[print process usage and diagnostics information]'
'(-p --performance)'{-p,--performance}'[start with the "Developer: Startup Performance" command enabled]'
'--prof-startup[run CPU profiler during startup]'
'(--disable-extension --disable-extensions)--disable-extensions[disable all installed extensions]'
\*'--disable-extension[disable an extension]:extension id: '
'--inspect-extensions[allow debugging and profiling of extensions]'
'--inspect-brk-extensions[allow debugging and profiling of extensions with the extension host being paused after start]'
'--disable-gpu[disable GPU hardware acceleration]'
'--max-memory=[max memory size for a window (in Mbytes)]:size (Mbytes)'
'*:file or directory:_files'
)
_arguments -s -S $arguments

Binary file not shown.

View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
function realpath() { python -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$0"; }
CONTENTS="$(dirname "$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")")"
ELECTRON="$CONTENTS/MacOS/Electron"
CLI="$CONTENTS/Resources/app/out/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
exit $?

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,54 @@
#!/usr/bin/env sh
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# test that VSCode wasn't installed inside WSL
if grep -qi Microsoft /proc/version && [ -z "$DONT_PROMPT_WSL_INSTALL" ]; then
echo "To use @@PRODNAME@@ with the Windows Subsystem for Linux, please install @@PRODNAME@@ in Windows and uninstall the Linux version in WSL. You can then use the \`@@NAME@@\` command in a WSL terminal just as you would in a normal command prompt." 1>&2
printf "Do you want to continue anyway? [y/N] " 1>&2
read -r YN
YN=$(printf '%s' "$YN" | tr '[:upper:]' '[:lower:]')
case "$YN" in
y | yes )
;;
* )
exit 1
;;
esac
echo "To no longer see this prompt, start @@PRODNAME@@ with the environment variable DONT_PROMPT_WSL_INSTALL defined." 1>&2
fi
# If root, ensure that --user-data-dir or --file-write is specified
if [ "$(id -u)" = "0" ]; then
for i in "$@"
do
case "$i" in
--user-data-dir | --user-data-dir=* | --file-write )
CAN_LAUNCH_AS_ROOT=1
;;
esac
done
if [ -z $CAN_LAUNCH_AS_ROOT ]; then
echo "You are trying to start @@PRODNAME@@ as a super user which isn't recommended. If this was intended, please specify an alternate user data directory using the \`--user-data-dir\` argument." 1>&2
exit 1
fi
fi
if [ ! -L "$0" ]; then
# if path is not a symlink, find relatively
VSCODE_PATH="$(dirname "$0")/.."
else
if command -v readlink >/dev/null; then
# if readlink exists, follow the symlink and find relatively
VSCODE_PATH="$(dirname "$(readlink -f "$0")")/.."
else
# else use the standard install location
VSCODE_PATH="/usr/share/@@NAME@@"
fi
fi
ELECTRON="$VSCODE_PATH/@@NAME@@"
CLI="$VSCODE_PATH/resources/app/out/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
exit $?

View File

@ -0,0 +1,12 @@
[Desktop Entry]
Name=@@NAME_LONG@@ - URL Handler
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=@@EXEC@@ --no-sandbox --open-url %U
Icon=@@ICON@@
Type=Application
NoDisplay=true
StartupNotify=true
Categories=Utility;TextEditor;Development;IDE;
MimeType=x-scheme-handler/@@URLPROTOCOL@@;
Keywords=vscode;

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-@@NAME@@-workspace">
<comment>@@NAME_LONG@@ Workspace</comment>
<glob pattern="*.code-workspace"/>
</mime-type>
</mime-info>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>@@NAME@@.desktop</id>
<metadata_license>@@LICENSE@@</metadata_license>
<project_license>@@LICENSE@@</project_license>
<name>@@NAME_LONG@@</name>
<url type="homepage">https://code.visualstudio.com</url>
<summary>Visual Studio Code. Code editing. Redefined.</summary>
<description>
<p>Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. See https://code.visualstudio.com/docs/setup/linux for installation instructions and FAQ.</p>
</description>
<screenshots>
<screenshot type="default">
<image>https://code.visualstudio.com/home/home-screenshot-linux-lg.png</image>
<caption>Editing TypeScript and searching for extensions</caption>
</screenshot>
</screenshots>
</component>

View File

@ -0,0 +1,18 @@
[Desktop Entry]
Name=@@NAME_LONG@@
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=@@EXEC@@ --no-sandbox --unity-launch %F
Icon=@@ICON@@
Type=Application
StartupNotify=false
StartupWMClass=@@NAME_SHORT@@
Categories=Utility;TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;application/x-@@NAME@@-workspace;
Actions=new-empty-window;
Keywords=vscode;
[Desktop Action new-empty-window]
Name=New Empty Window
Exec=@@EXEC@@ --no-sandbox --new-window %F
Icon=@@ICON@@

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,14 @@
Package: @@NAME@@
Version: @@VERSION@@
Section: devel
Depends: libnss3 (>= 2:3.26), gnupg, apt, libxkbfile1, libsecret-1-0, libgtk-3-0 (>= 3.10.0), libxss1, libgbm1
Priority: optional
Architecture: @@ARCHITECTURE@@
Maintainer: Microsoft Corporation <vscode-linux@microsoft.com>
Homepage: https://code.visualstudio.com/
Installed-Size: @@INSTALLEDSIZE@@
Provides: visual-studio-@@NAME@@
Conflicts: visual-studio-@@NAME@@
Replaces: visual-studio-@@NAME@@
Description: Code editing. Redefined.
Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. See https://code.visualstudio.com/docs/setup/linux for installation instructions and FAQ.

View File

@ -0,0 +1,78 @@
#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Symlink bin command to /usr/bin
rm -f /usr/bin/@@NAME@@
ln -s /usr/share/@@NAME@@/bin/@@NAME@@ /usr/bin/@@NAME@@
# Register code in the alternatives system
# Priority of 0 should never make code the default editor in auto mode as most
# developers would prefer a terminal editor as the default.
update-alternatives --install /usr/bin/editor editor /usr/bin/@@NAME@@ 0
# Install the desktop entry
if hash desktop-file-install 2>/dev/null; then
desktop-file-install /usr/share/applications/@@NAME@@.desktop
desktop-file-install /usr/share/applications/@@NAME@@-url-handler.desktop
fi
# Update mimetype database to pickup workspace mimetype
if hash update-mime-database 2>/dev/null; then
update-mime-database /usr/share/mime
fi
if [ "@@NAME@@" != "code-oss" ]; then
# Remove the legacy bin command if this is the stable build
if [ "@@NAME@@" = "code" ]; then
rm -f /usr/local/bin/code
fi
# Register apt repository
eval $(apt-config shell APT_SOURCE_PARTS Dir::Etc::sourceparts/d)
CODE_SOURCE_PART=${APT_SOURCE_PARTS}vscode.list
eval $(apt-config shell APT_TRUSTED_PARTS Dir::Etc::trustedparts/d)
CODE_TRUSTED_PART=${APT_TRUSTED_PARTS}microsoft.gpg
# Sourced from https://packages.microsoft.com/keys/microsoft.asc
if [ ! -f $CODE_TRUSTED_PART ]; then
echo "-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.7 (GNU/Linux)
mQENBFYxWIwBCADAKoZhZlJxGNGWzqV+1OG1xiQeoowKhssGAKvd+buXCGISZJwT
LXZqIcIiLP7pqdcZWtE9bSc7yBY2MalDp9Liu0KekywQ6VVX1T72NPf5Ev6x6DLV
7aVWsCzUAF+eb7DC9fPuFLEdxmOEYoPjzrQ7cCnSV4JQxAqhU4T6OjbvRazGl3ag
OeizPXmRljMtUUttHQZnRhtlzkmwIrUivbfFPD+fEoHJ1+uIdfOzZX8/oKHKLe2j
H632kvsNzJFlROVvGLYAk2WRcLu+RjjggixhwiB+Mu/A8Tf4V6b+YppS44q8EvVr
M+QvY7LNSOffSO6Slsy9oisGTdfE39nC7pVRABEBAAG0N01pY3Jvc29mdCAoUmVs
ZWFzZSBzaWduaW5nKSA8Z3Bnc2VjdXJpdHlAbWljcm9zb2Z0LmNvbT6JATUEEwEC
AB8FAlYxWIwCGwMGCwkIBwMCBBUCCAMDFgIBAh4BAheAAAoJEOs+lK2+EinPGpsH
/32vKy29Hg51H9dfFJMx0/a/F+5vKeCeVqimvyTM04C+XENNuSbYZ3eRPHGHFLqe
MNGxsfb7C7ZxEeW7J/vSzRgHxm7ZvESisUYRFq2sgkJ+HFERNrqfci45bdhmrUsy
7SWw9ybxdFOkuQoyKD3tBmiGfONQMlBaOMWdAsic965rvJsd5zYaZZFI1UwTkFXV
KJt3bp3Ngn1vEYXwijGTa+FXz6GLHueJwF0I7ug34DgUkAFvAs8Hacr2DRYxL5RJ
XdNgj4Jd2/g6T9InmWT0hASljur+dJnzNiNCkbn9KbX7J/qK1IbR8y560yRmFsU+
NdCFTW7wY0Fb1fWJ+/KTsC4=
=J6gs
-----END PGP PUBLIC KEY BLOCK-----
" | gpg --dearmor > microsoft.gpg
mv microsoft.gpg $CODE_TRUSTED_PART
fi
# Install repository source list
WRITE_SOURCE=0
if [ ! -f $CODE_SOURCE_PART ]; then
# Write source list if it does not exist
WRITE_SOURCE=1
elif grep -q "# disabled on upgrade to" /etc/apt/sources.list.d/vscode.list; then
# Write source list if it was disabled by OS upgrade
WRITE_SOURCE=1
fi
if [ "$WRITE_SOURCE" -eq "1" ]; then
echo "### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main" > $CODE_SOURCE_PART
fi
fi

View File

@ -0,0 +1,11 @@
#!/bin/bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
rm -f /usr/bin/@@NAME@@
# Update mimetype database for removed workspace mimetype
if hash update-mime-database 2>/dev/null; then
update-mime-database /usr/share/mime
fi

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Deregister code from the alternatives system
update-alternatives --remove editor /usr/bin/@@NAME@@

View File

@ -0,0 +1,71 @@
Name: @@NAME@@
Version: @@VERSION@@
Release: @@RELEASE@@.el7
Summary: Code editing. Redefined.
Group: Development/Tools
Vendor: Microsoft Corporation
Packager: Visual Studio Code Team <vscode-linux@microsoft.com>
License: @@LICENSE@@
URL: https://code.visualstudio.com/
Icon: @@NAME@@.xpm
Requires: @@DEPENDENCIES@@
AutoReq: 0
%description
Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. See https://code.visualstudio.com/docs/setup/linux for installation instructions and FAQ.
%install
mkdir -p %{buildroot}/usr/share/@@NAME@@
mkdir -p %{buildroot}/usr/share/applications
mkdir -p %{buildroot}/usr/share/pixmaps
mkdir -p %{buildroot}/usr/share/bash-completion/completions
mkdir -p %{buildroot}/usr/share/zsh/site-functions
mkdir -p %{buildroot}/usr/share/mime/packages
cp -r usr/share/@@NAME@@/* %{buildroot}/usr/share/@@NAME@@
cp -r usr/share/applications/@@NAME@@.desktop %{buildroot}/usr/share/applications
cp -r usr/share/applications/@@NAME@@-url-handler.desktop %{buildroot}/usr/share/applications
cp -r usr/share/mime/packages/@@NAME@@-workspace.xml %{buildroot}/usr/share/mime/packages/@@NAME@@-workspace.xml
cp -r usr/share/pixmaps/@@ICON@@.png %{buildroot}/usr/share/pixmaps
cp usr/share/bash-completion/completions/@@NAME@@ %{buildroot}/usr/share/bash-completion/completions/@@NAME@@
cp usr/share/zsh/site-functions/_@@NAME@@ %{buildroot}/usr/share/zsh/site-functions/_@@NAME@@
%post
# Remove the legacy bin command if this is the stable build
if [ "@@NAME@@" = "code" ]; then
rm -f /usr/local/bin/code
fi
# Symlink bin command to /usr/bin
ln -sf /usr/share/@@NAME@@/bin/@@NAME@@ %{_bindir}/@@NAME@@
# Register yum repository
# TODO: #229: Enable once the yum repository is signed
#if [ "@@NAME@@" != "code-oss" ]; then
# if [ -d "/etc/yum.repos.d" ]; then
# REPO_FILE=/etc/yum.repos.d/@@NAME@@.repo
# rm -f $REPO_FILE
# echo -e "[@@NAME@@]\nname=@@NAME_LONG@@\nbaseurl=@@UPDATEURL@@/api/rpm/@@QUALITY@@/@@ARCHITECTURE@@/rpm" > $REPO_FILE
# fi
#fi
# Update mimetype database to pickup workspace mimetype
update-mime-database /usr/share/mime &> /dev/null || :
%postun
if [ $1 = 0 ]; then
rm -f /usr/bin/@@NAME@@
fi
# Update mimetype database for removed workspace mimetype
update-mime-database /usr/share/mime &> /dev/null || :
%files
%defattr(-,root,root)
/usr/share/@@NAME@@/
/usr/share/applications/@@NAME@@.desktop
/usr/share/applications/@@NAME@@-url-handler.desktop
/usr/share/mime/packages/@@NAME@@-workspace.xml
/usr/share/pixmaps/@@ICON@@.png
/usr/share/bash-completion/completions/@@NAME@@
/usr/share/zsh/site-functions/_@@NAME@@

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,198 @@
{
"x86_64": [
"libpthread.so.0()(64bit)",
"libpthread.so.0(GLIBC_2.2.5)(64bit)",
"libpthread.so.0(GLIBC_2.3.2)(64bit)",
"libpthread.so.0(GLIBC_2.3.3)(64bit)",
"libgtk-3.so.0()(64bit)",
"libgdk-x11-2.0.so.0()(64bit)",
"libatk-1.0.so.0()(64bit)",
"libgio-2.0.so.0()(64bit)",
"libpangocairo-1.0.so.0()(64bit)",
"libgdk_pixbuf-2.0.so.0()(64bit)",
"libcairo.so.2()(64bit)",
"libpango-1.0.so.0()(64bit)",
"libfreetype.so.6()(64bit)",
"libfontconfig.so.1()(64bit)",
"libgobject-2.0.so.0()(64bit)",
"libdbus-1.so.3()(64bit)",
"libXi.so.6()(64bit)",
"libXcursor.so.1()(64bit)",
"libXdamage.so.1()(64bit)",
"libXrandr.so.2()(64bit)",
"libXcomposite.so.1()(64bit)",
"libXext.so.6()(64bit)",
"libXfixes.so.3()(64bit)",
"libXrender.so.1()(64bit)",
"libX11.so.6()(64bit)",
"libXss.so.1()(64bit)",
"libXtst.so.6()(64bit)",
"libgmodule-2.0.so.0()(64bit)",
"librt.so.1()(64bit)",
"libglib-2.0.so.0()(64bit)",
"libnss3.so()(64bit)",
"libnssutil3.so()(64bit)",
"libsmime3.so()(64bit)",
"libnspr4.so()(64bit)",
"libasound.so.2()(64bit)",
"libcups.so.2()(64bit)",
"libdl.so.2()(64bit)",
"libexpat.so.1()(64bit)",
"libstdc++.so.6()(64bit)",
"libstdc++.so.6(GLIBCXX_3.4)(64bit)",
"libstdc++.so.6(GLIBCXX_3.4.10)(64bit)",
"libstdc++.so.6(GLIBCXX_3.4.11)(64bit)",
"libstdc++.so.6(GLIBCXX_3.4.14)(64bit)",
"libstdc++.so.6(GLIBCXX_3.4.15)(64bit)",
"libstdc++.so.6(GLIBCXX_3.4.9)(64bit)",
"libm.so.6()(64bit)",
"libm.so.6(GLIBC_2.2.5)(64bit)",
"libgcc_s.so.1()(64bit)",
"libgcc_s.so.1(GCC_3.0)(64bit)",
"libgcc_s.so.1(GCC_4.0.0)(64bit)",
"libc.so.6()(64bit)",
"libc.so.6(GLIBC_2.11)(64bit)",
"libc.so.6(GLIBC_2.2.5)(64bit)",
"libc.so.6(GLIBC_2.3)(64bit)",
"libc.so.6(GLIBC_2.3.2)(64bit)",
"libc.so.6(GLIBC_2.3.4)(64bit)",
"libc.so.6(GLIBC_2.4)(64bit)",
"libc.so.6(GLIBC_2.6)(64bit)",
"libc.so.6(GLIBC_2.7)(64bit)",
"libc.so.6(GLIBC_2.9)(64bit)",
"libxcb.so.1()(64bit)",
"libxkbfile.so.1()(64bit)",
"libsecret-1.so.0()(64bit)",
"libgbm.so.1()(64bit)"
],
"aarch64": [
"libpthread.so.0()(aarch64)",
"libpthread.so.0(GLIBC_2.2.5)(aarch64)",
"libpthread.so.0(GLIBC_2.3.2)(aarch64)",
"libpthread.so.0(GLIBC_2.3.3)(aarch64)",
"libgtk-3.so.0()(aarch64)",
"libgdk-x11-2.0.so.0()(aarch64)",
"libatk-1.0.so.0()(aarch64)",
"libgio-2.0.so.0()(aarch64)",
"libpangocairo-1.0.so.0()(aarch64)",
"libgdk_pixbuf-2.0.so.0()(aarch64)",
"libcairo.so.2()(aarch64)",
"libpango-1.0.so.0()(aarch64)",
"libfreetype.so.6()(aarch64)",
"libfontconfig.so.1()(aarch64)",
"libgobject-2.0.so.0()(aarch64)",
"libdbus-1.so.3()(aarch64)",
"libXi.so.6()(aarch64)",
"libXcursor.so.1()(aarch64)",
"libXdamage.so.1()(aarch64)",
"libXrandr.so.2()(aarch64)",
"libXcomposite.so.1()(aarch64)",
"libXext.so.6()(aarch64)",
"libXfixes.so.3()(aarch64)",
"libXrender.so.1()(aarch64)",
"libX11.so.6()(aarch64)",
"libXss.so.1()(aarch64)",
"libXtst.so.6()(aarch64)",
"libgmodule-2.0.so.0()(aarch64)",
"librt.so.1()(aarch64)",
"libglib-2.0.so.0()(aarch64)",
"libnss3.so()(aarch64)",
"libnssutil3.so()(aarch64)",
"libsmime3.so()(aarch64)",
"libnspr4.so()(aarch64)",
"libasound.so.2()(aarch64)",
"libcups.so.2()(aarch64)",
"libdl.so.2()(aarch64)",
"libexpat.so.1()(aarch64)",
"libstdc++.so.6()(aarch64)",
"libstdc++.so.6(GLIBCXX_3.4)(aarch64)",
"libstdc++.so.6(GLIBCXX_3.4.10)(aarch64)",
"libstdc++.so.6(GLIBCXX_3.4.11)(aarch64)",
"libstdc++.so.6(GLIBCXX_3.4.14)(aarch64)",
"libstdc++.so.6(GLIBCXX_3.4.15)(aarch64)",
"libstdc++.so.6(GLIBCXX_3.4.9)(aarch64)",
"libm.so.6()(aarch64)",
"libm.so.6(GLIBC_2.2.5)(aarch64)",
"libgcc_s.so.1()(aarch64)",
"libgcc_s.so.1(GCC_3.0)(aarch64)",
"libgcc_s.so.1(GCC_4.0.0)(aarch64)",
"libc.so.6()(aarch64)",
"libc.so.6(GLIBC_2.11)(aarch64)",
"libc.so.6(GLIBC_2.2.5)(aarch64)",
"libc.so.6(GLIBC_2.3)(aarch64)",
"libc.so.6(GLIBC_2.3.2)(aarch64)",
"libc.so.6(GLIBC_2.3.4)(aarch64)",
"libc.so.6(GLIBC_2.4)(aarch64)",
"libc.so.6(GLIBC_2.6)(aarch64)",
"libc.so.6(GLIBC_2.7)(aarch64)",
"libc.so.6(GLIBC_2.9)(aarch64)",
"libxcb.so.1()(aarch64)",
"libxkbfile.so.1()(aarch64)",
"libsecret-1.so.0()(aarch64)"
],
"armv7hl": [
"libpthread.so.0()(armv7hl)",
"libpthread.so.0(GLIBC_2.2.5)(armv7hl)",
"libpthread.so.0(GLIBC_2.3.2)(armv7hl)",
"libpthread.so.0(GLIBC_2.3.3)(armv7hl)",
"libgtk-3.so.0()(armv7hl)",
"libgdk-x11-2.0.so.0()(armv7hl)",
"libatk-1.0.so.0()(armv7hl)",
"libgio-2.0.so.0()(armv7hl)",
"libpangocairo-1.0.so.0()(armv7hl)",
"libgdk_pixbuf-2.0.so.0()(armv7hl)",
"libcairo.so.2()(armv7hl)",
"libpango-1.0.so.0()(armv7hl)",
"libfreetype.so.6()(armv7hl)",
"libfontconfig.so.1()(armv7hl)",
"libgobject-2.0.so.0()(armv7hl)",
"libdbus-1.so.3()(armv7hl)",
"libXi.so.6()(armv7hl)",
"libXcursor.so.1()(armv7hl)",
"libXdamage.so.1()(armv7hl)",
"libXrandr.so.2()(armv7hl)",
"libXcomposite.so.1()(armv7hl)",
"libXext.so.6()(armv7hl)",
"libXfixes.so.3()(armv7hl)",
"libXrender.so.1()(armv7hl)",
"libX11.so.6()(armv7hl)",
"libXss.so.1()(armv7hl)",
"libXtst.so.6()(armv7hl)",
"libgmodule-2.0.so.0()(armv7hl)",
"librt.so.1()(armv7hl)",
"libglib-2.0.so.0()(armv7hl)",
"libnss3.so()(armv7hl)",
"libnssutil3.so()(armv7hl)",
"libsmime3.so()(armv7hl)",
"libnspr4.so()(armv7hl)",
"libasound.so.2()(armv7hl)",
"libcups.so.2()(armv7hl)",
"libdl.so.2()(armv7hl)",
"libexpat.so.1()(armv7hl)",
"libstdc++.so.6()(armv7hl)",
"libstdc++.so.6(GLIBCXX_3.4)(armv7hl)",
"libstdc++.so.6(GLIBCXX_3.4.10)(armv7hl)",
"libstdc++.so.6(GLIBCXX_3.4.11)(armv7hl)",
"libstdc++.so.6(GLIBCXX_3.4.14)(armv7hl)",
"libstdc++.so.6(GLIBCXX_3.4.15)(armv7hl)",
"libstdc++.so.6(GLIBCXX_3.4.9)(armv7hl)",
"libm.so.6()(armv7hl)",
"libm.so.6(GLIBC_2.2.5)(armv7hl)",
"libgcc_s.so.1()(armv7hl)",
"libgcc_s.so.1(GCC_3.0)(armv7hl)",
"libgcc_s.so.1(GCC_4.0.0)(armv7hl)",
"libc.so.6()(armv7hl)",
"libc.so.6(GLIBC_2.11)(armv7hl)",
"libc.so.6(GLIBC_2.2.5)(armv7hl)",
"libc.so.6(GLIBC_2.3)(armv7hl)",
"libc.so.6(GLIBC_2.3.2)(armv7hl)",
"libc.so.6(GLIBC_2.3.4)(armv7hl)",
"libc.so.6(GLIBC_2.4)(armv7hl)",
"libc.so.6(GLIBC_2.6)(armv7hl)",
"libc.so.6(GLIBC_2.7)(armv7hl)",
"libc.so.6(GLIBC_2.9)(armv7hl)",
"libxcb.so.1()(armv7hl)",
"libxkbfile.so.1()(armv7hl)",
"libsecret-1.so.0()(armv7hl)"
]
}

View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# On Fedora $SNAP is under /var and there is some magic to map it to /snap.
# We need to handle that case and reset $SNAP
SNAP=$(echo "$SNAP" | sed -e "s|/var/lib/snapd||g")
if [ "$SNAP_ARCH" == "amd64" ]; then
ARCH="x86_64-linux-gnu"
elif [ "$SNAP_ARCH" == "armhf" ]; then
ARCH="arm-linux-gnueabihf"
elif [ "$SNAP_ARCH" == "arm64" ]; then
ARCH="aarch64-linux-gnu"
else
ARCH="$SNAP_ARCH-linux-gnu"
fi
GDK_CACHE_DIR="$SNAP_USER_COMMON/.cache"
if [[ -d "$SNAP_USER_DATA/.cache" && ! -e "$GDK_CACHE_DIR" ]]; then
# the .cache directory used to be stored under $SNAP_USER_DATA, migrate it
mv "$SNAP_USER_DATA/.cache" "$SNAP_USER_COMMON/"
fi
[ ! -d "$GDK_CACHE_DIR" ] && mkdir -p "$GDK_CACHE_DIR"
# Gdk-pixbuf loaders
export GDK_PIXBUF_MODULE_FILE="$GDK_CACHE_DIR/gdk-pixbuf-loaders.cache"
export GDK_PIXBUF_MODULEDIR="$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders"
if [ -f "$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders" ]; then
"$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders" > "$GDK_PIXBUF_MODULE_FILE"
fi
# Create $XDG_RUNTIME_DIR if not exists (to be removed when https://pad.lv/1656340 is fixed)
[ -n "$XDG_RUNTIME_DIR" ] && mkdir -p "$XDG_RUNTIME_DIR" -m 700
exec "$@"

View File

@ -0,0 +1,64 @@
name: @@NAME@@
version: @@VERSION@@
summary: Code editing. Redefined.
description: |
Visual Studio Code is a new choice of tool that combines the
simplicity of a code editor with what developers need for the core
edit-build-debug cycle.
grade: stable
confinement: classic
parts:
gnome:
plugin: nil
build-packages:
- software-properties-common
override-pull: |
add-apt-repository -y ppa:ubuntu-desktop/gnome-3-26
apt -y update
code:
after:
- gnome
plugin: dump
source: .
stage-packages:
- ibus-gtk3
- fcitx-frontend-gtk3
- gvfs-libs
- libasound2
- libgconf-2-4
- libglib2.0-bin
- libgnome-keyring0
- libgbm1
- libgtk-3-0
- libnotify4
- libnspr4
- libnss3
- libpcre3
- libpulse0
- libsecret-1-0
- libxss1
- libxtst6
- zlib1g
prime:
- -usr/share/doc
- -usr/share/fonts
- -usr/share/icons
- -usr/share/lintian
- -usr/share/man
apps:
@@NAME@@:
command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@
common-id: @@NAME@@.desktop
environment:
DISABLE_WAYLAND: 1
GSETTINGS_SCHEMA_DIR: $SNAP/usr/share/glib-2.0/schemas
url-handler:
command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@ --open-url
environment:
DISABLE_WAYLAND: 1
GSETTINGS_SCHEMA_DIR: $SNAP/usr/share/glib-2.0/schemas

View File

@ -0,0 +1,81 @@
<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<!-- Disable pinch zooming -->
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<!-- Content Security Policy -->
<meta http-equiv="Content-Security-Policy" content="
default-src 'self';
img-src 'self' https: data: blob:;
media-src 'none';
script-src 'self';
style-src 'self' 'unsafe-inline';
font-src 'self' blob:;
">
<title>Visual Studio Code</title>
<!-- Styling -->
<style type="text/css">
html {
height: 100%;
}
body {
box-sizing: border-box;
min-height: 100%;
margin: 0;
padding: 15px 30px;
display: flex;
flex-direction: column;
color: white;
font-family: "Segoe UI", "Helvetica Neue", "Helvetica", Arial, sans-serif;
background-color: #373277;
}
.branding {
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGRlZnM+PHN0eWxlPi5pY29uLWNhbnZhcy10cmFuc3BhcmVudHtmaWxsOiNmNmY2ZjY7b3BhY2l0eTowO30uaWNvbi13aGl0ZXtmaWxsOiNmZmY7fTwvc3R5bGU+PC9kZWZzPjx0aXRsZT5CcmFuZFZpc3VhbFN0dWRpb0NvZGUyMDE3UlRXXzI0eF93aGl0ZV8yNHg8L3RpdGxlPjxwYXRoIGNsYXNzPSJpY29uLWNhbnZhcy10cmFuc3BhcmVudCIgZD0iTTI0LDBWMjRIMFYwWiIvPjxwYXRoIGNsYXNzPSJpY29uLXdoaXRlIiBkPSJNMjQsMi41VjIxLjVMMTgsMjQsMCwxOC41di0uNTYxbDE4LDEuNTQ1VjBaTTEsMTMuMTExLDQuMzg1LDEwLDEsNi44ODlsMS40MTgtLjgyN0w1Ljg1Myw4LjY1LDEyLDNsMywxLjQ1NlYxNS41NDRMMTIsMTcsNS44NTMsMTEuMzUsMi40MTksMTMuOTM5Wk03LjY0NCwxMCwxMiwxMy4yODNWNi43MTdaIi8+PC9zdmc+");
background-size: 24px;
background-repeat: no-repeat;
background-position: left 50%;
padding-left: 36px;
font-size: 20px;
letter-spacing: -0.04rem;
font-weight: 400;
color: white;
text-decoration: none;
}
.message-container {
flex-grow: 1;
display: flex;
align-items: center;
justify-content: center;
margin: 0 30px;
}
.message {
font-weight: 300;
font-size: 1.3rem;
}
</style>
</head>
<body>
<span class="branding">
Visual Studio Code
</span>
<div class="message-container">
<div class="message">
You can close this page now.
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,613 @@
#!/usr/bin/env node
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// @ts-check
const http = require('http');
const url = require('url');
const fs = require('fs');
const path = require('path');
const util = require('util');
const opn = require('opn');
const minimist = require('minimist');
const fancyLog = require('fancy-log');
const ansiColors = require('ansi-colors');
const remote = require('gulp-remote-retry-src');
const vfs = require('vinyl-fs');
const uuid = require('uuid');
const extensions = require('../../build/lib/extensions');
const APP_ROOT = path.join(__dirname, '..', '..');
const BUILTIN_EXTENSIONS_ROOT = path.join(APP_ROOT, 'extensions');
const BUILTIN_MARKETPLACE_EXTENSIONS_ROOT = path.join(APP_ROOT, '.build', 'builtInExtensions');
const WEB_DEV_EXTENSIONS_ROOT = path.join(APP_ROOT, '.build', 'builtInWebDevExtensions');
const WEB_MAIN = path.join(APP_ROOT, 'src', 'vs', 'code', 'browser', 'workbench', 'workbench-dev.html');
const WEB_PLAYGROUND_VERSION = '0.0.10';
const args = minimist(process.argv, {
boolean: [
'no-launch',
'help',
'verbose',
'wrap-iframe',
'enable-sync',
'trusted-types'
],
string: [
'scheme',
'host',
'port',
'local_port',
'extension',
'github-auth'
],
});
if (args.help) {
console.log(
'yarn web [options]\n' +
' --no-launch Do not open VSCode web in the browser\n' +
' --wrap-iframe Wrap the Web Worker Extension Host in an iframe\n' +
' --trusted-types Enable trusted types (report only)\n' +
' --enable-sync Enable sync by default\n' +
' --scheme Protocol (https or http)\n' +
' --host Remote host\n' +
' --port Remote/Local port\n' +
' --local_port Local port override\n' +
' --secondary-port Secondary port\n' +
' --extension Path of an extension to include\n' +
' --github-auth Github authentication token\n' +
' --verbose Print out more information\n' +
' --help\n' +
'[Example]\n' +
' yarn web --scheme https --host example.com --port 8080 --local_port 30000'
);
process.exit(0);
}
const PORT = args.port || process.env.PORT || 8080;
const LOCAL_PORT = args.local_port || process.env.LOCAL_PORT || PORT;
const SECONDARY_PORT = args['secondary-port'] || (parseInt(PORT, 10) + 1);
const SCHEME = args.scheme || process.env.VSCODE_SCHEME || 'http';
const HOST = args.host || 'localhost';
const AUTHORITY = process.env.VSCODE_AUTHORITY || `${HOST}:${PORT}`;
const exists = (path) => util.promisify(fs.exists)(path);
const readFile = (path) => util.promisify(fs.readFile)(path);
async function getBuiltInExtensionInfos() {
const allExtensions = [];
/** @type {Object.<string, string>} */
const locations = {};
const [localExtensions, marketplaceExtensions, webDevExtensions] = await Promise.all([
extensions.scanBuiltinExtensions(BUILTIN_EXTENSIONS_ROOT),
extensions.scanBuiltinExtensions(BUILTIN_MARKETPLACE_EXTENSIONS_ROOT),
ensureWebDevExtensions().then(() => extensions.scanBuiltinExtensions(WEB_DEV_EXTENSIONS_ROOT))
]);
for (const ext of localExtensions) {
allExtensions.push(ext);
locations[ext.extensionPath] = path.join(BUILTIN_EXTENSIONS_ROOT, ext.extensionPath);
}
for (const ext of marketplaceExtensions) {
allExtensions.push(ext);
locations[ext.extensionPath] = path.join(BUILTIN_MARKETPLACE_EXTENSIONS_ROOT, ext.extensionPath);
}
for (const ext of webDevExtensions) {
allExtensions.push(ext);
locations[ext.extensionPath] = path.join(WEB_DEV_EXTENSIONS_ROOT, ext.extensionPath);
}
for (const ext of allExtensions) {
if (ext.packageJSON.browser) {
let mainFilePath = path.join(locations[ext.extensionPath], ext.packageJSON.browser);
if (path.extname(mainFilePath) !== '.js') {
mainFilePath += '.js';
}
if (!await exists(mainFilePath)) {
fancyLog(`${ansiColors.red('Error')}: Could not find ${mainFilePath}. Use ${ansiColors.cyan('yarn watch-web')} to build the built-in extensions.`);
}
}
}
return { extensions: allExtensions, locations };
}
async function ensureWebDevExtensions() {
// Playground (https://github.com/microsoft/vscode-web-playground)
const webDevPlaygroundRoot = path.join(WEB_DEV_EXTENSIONS_ROOT, 'vscode-web-playground');
const webDevPlaygroundExists = await exists(webDevPlaygroundRoot);
let downloadPlayground = false;
if (webDevPlaygroundExists) {
try {
const webDevPlaygroundPackageJson = JSON.parse(((await readFile(path.join(webDevPlaygroundRoot, 'package.json'))).toString()));
if (webDevPlaygroundPackageJson.version !== WEB_PLAYGROUND_VERSION) {
downloadPlayground = true;
}
} catch (error) {
downloadPlayground = true;
}
} else {
downloadPlayground = true;
}
if (downloadPlayground) {
if (args.verbose) {
fancyLog(`${ansiColors.magenta('Web Development extensions')}: Downloading vscode-web-playground to ${webDevPlaygroundRoot}`);
}
await new Promise((resolve, reject) => {
remote(['package.json', 'dist/extension.js', 'dist/extension.js.map'], {
base: 'https://raw.githubusercontent.com/microsoft/vscode-web-playground/main/'
}).pipe(vfs.dest(webDevPlaygroundRoot)).on('end', resolve).on('error', reject);
});
} else {
if (args.verbose) {
fancyLog(`${ansiColors.magenta('Web Development extensions')}: Using existing vscode-web-playground in ${webDevPlaygroundRoot}`);
}
}
}
async function getCommandlineProvidedExtensionInfos() {
const extensions = [];
/** @type {Object.<string, string>} */
const locations = {};
let extensionArg = args['extension'];
if (!extensionArg) {
return { extensions, locations };
}
const extensionPaths = Array.isArray(extensionArg) ? extensionArg : [extensionArg];
await Promise.all(extensionPaths.map(async extensionPath => {
extensionPath = path.resolve(process.cwd(), extensionPath);
const packageJSON = await getExtensionPackageJSON(extensionPath);
if (packageJSON) {
const extensionId = `${packageJSON.publisher}.${packageJSON.name}`;
extensions.push({
packageJSON,
extensionLocation: { scheme: SCHEME, authority: AUTHORITY, path: `/extension/${extensionId}` }
});
locations[extensionId] = extensionPath;
}
}));
return { extensions, locations };
}
async function getExtensionPackageJSON(extensionPath) {
const packageJSONPath = path.join(extensionPath, 'package.json');
if (await exists(packageJSONPath)) {
try {
let packageJSON = JSON.parse((await readFile(packageJSONPath)).toString());
if (packageJSON.main && !packageJSON.browser) {
return; // unsupported
}
const packageNLSPath = path.join(extensionPath, 'package.nls.json');
const packageNLSExists = await exists(packageNLSPath);
if (packageNLSExists) {
packageJSON = extensions.translatePackageJSON(packageJSON, packageNLSPath); // temporary, until fixed in core
}
return packageJSON;
} catch (e) {
console.log(e);
}
}
return undefined;
}
const builtInExtensionsPromise = getBuiltInExtensionInfos();
const commandlineProvidedExtensionsPromise = getCommandlineProvidedExtensionInfos();
const mapCallbackUriToRequestId = new Map();
/**
* @param req {http.IncomingMessage}
* @param res {http.ServerResponse}
*/
const requestHandler = (req, res) => {
const parsedUrl = url.parse(req.url, true);
const pathname = parsedUrl.pathname;
try {
if (pathname === '/favicon.ico') {
// favicon
return serveFile(req, res, path.join(APP_ROOT, 'resources', 'win32', 'code.ico'));
}
if (pathname === '/manifest.json') {
// manifest
res.writeHead(200, { 'Content-Type': 'application/json' });
return res.end(JSON.stringify({
'name': 'Code Web - OSS',
'short_name': 'Code Web - OSS',
'start_url': '/',
'lang': 'en-US',
'display': 'standalone'
}));
}
if (/^\/static\//.test(pathname)) {
// static requests
return handleStatic(req, res, parsedUrl);
}
if (/^\/extension\//.test(pathname)) {
// default extension requests
return handleExtension(req, res, parsedUrl);
}
if (pathname === '/') {
// main web
return handleRoot(req, res);
} else if (pathname === '/callback') {
// callback support
return handleCallback(req, res, parsedUrl);
} else if (pathname === '/fetch-callback') {
// callback fetch support
return handleFetchCallback(req, res, parsedUrl);
}
return serveError(req, res, 404, 'Not found.');
} catch (error) {
console.error(error.toString());
return serveError(req, res, 500, 'Internal Server Error.');
}
};
const server = http.createServer(requestHandler);
server.listen(LOCAL_PORT, () => {
if (LOCAL_PORT !== PORT) {
console.log(`Operating location at http://0.0.0.0:${LOCAL_PORT}`);
}
console.log(`Web UI available at ${SCHEME}://${AUTHORITY}`);
});
server.on('error', err => {
console.error(`Error occurred in server:`);
console.error(err);
});
const secondaryServer = http.createServer(requestHandler);
secondaryServer.listen(SECONDARY_PORT, () => {
console.log(`Secondary server available at ${SCHEME}://${HOST}:${SECONDARY_PORT}`);
});
secondaryServer.on('error', err => {
console.error(`Error occurred in server:`);
console.error(err);
});
/**
* @param {import('http').IncomingMessage} req
* @param {import('http').ServerResponse} res
* @param {import('url').UrlWithParsedQuery} parsedUrl
*/
async function handleStatic(req, res, parsedUrl) {
if (/^\/static\/extensions\//.test(parsedUrl.pathname)) {
const relativePath = decodeURIComponent(parsedUrl.pathname.substr('/static/extensions/'.length));
const filePath = getExtensionFilePath(relativePath, (await builtInExtensionsPromise).locations);
const responseHeaders = {
'Access-Control-Allow-Origin': '*'
};
if (!filePath) {
return serveError(req, res, 400, `Bad request.`, responseHeaders);
}
return serveFile(req, res, filePath, responseHeaders);
}
// Strip `/static/` from the path
const relativeFilePath = path.normalize(decodeURIComponent(parsedUrl.pathname.substr('/static/'.length)));
return serveFile(req, res, path.join(APP_ROOT, relativeFilePath));
}
/**
* @param {import('http').IncomingMessage} req
* @param {import('http').ServerResponse} res
* @param {import('url').UrlWithParsedQuery} parsedUrl
*/
async function handleExtension(req, res, parsedUrl) {
// Strip `/extension/` from the path
const relativePath = decodeURIComponent(parsedUrl.pathname.substr('/extension/'.length));
const filePath = getExtensionFilePath(relativePath, (await commandlineProvidedExtensionsPromise).locations);
const responseHeaders = {
'Access-Control-Allow-Origin': '*'
};
if (!filePath) {
return serveError(req, res, 400, `Bad request.`, responseHeaders);
}
return serveFile(req, res, filePath, responseHeaders);
}
/**
* @param {import('http').IncomingMessage} req
* @param {import('http').ServerResponse} res
*/
async function handleRoot(req, res) {
let folderUri = { scheme: 'memfs', path: `/sample-folder` };
const match = req.url && req.url.match(/\?([^#]+)/);
if (match) {
const qs = new URLSearchParams(match[1]);
let gh = qs.get('gh');
if (gh) {
if (gh.startsWith('/')) {
gh = gh.substr(1);
}
const [owner, repo, ...branch] = gh.split('/', 3);
const ref = branch.join('/');
folderUri = { scheme: 'github', authority: `${owner}+${repo}${ref ? `+${ref}` : ''}`, path: '/' };
} else {
let cs = qs.get('cs');
if (cs) {
if (cs.startsWith('/')) {
cs = cs.substr(1);
}
const [owner, repo, ...branch] = cs.split('/');
const ref = branch.join('/');
folderUri = { scheme: 'codespace', authority: `${owner}+${repo}${ref ? `+${ref}` : ''}`, path: '/' };
}
}
}
const { extensions: builtInExtensions } = await builtInExtensionsPromise;
const { extensions: staticExtensions, locations: staticLocations } = await commandlineProvidedExtensionsPromise;
const dedupedBuiltInExtensions = [];
for (const builtInExtension of builtInExtensions) {
const extensionId = `${builtInExtension.packageJSON.publisher}.${builtInExtension.packageJSON.name}`;
if (staticLocations[extensionId]) {
fancyLog(`${ansiColors.magenta('BuiltIn extensions')}: Ignoring built-in ${extensionId} because it was overridden via --extension argument`);
continue;
}
dedupedBuiltInExtensions.push(builtInExtension);
}
if (args.verbose) {
fancyLog(`${ansiColors.magenta('BuiltIn extensions')}: ${dedupedBuiltInExtensions.map(e => path.basename(e.extensionPath)).join(', ')}`);
fancyLog(`${ansiColors.magenta('Additional extensions')}: ${staticExtensions.map(e => path.basename(e.extensionLocation.path)).join(', ') || 'None'}`);
}
const webConfigJSON = {
folderUri: folderUri,
staticExtensions,
enableSyncByDefault: args['enable-sync'],
webWorkerExtensionHostIframeSrc: `${SCHEME}://${HOST}:${SECONDARY_PORT}/static/out/vs/workbench/services/extensions/worker/httpWebWorkerExtensionHostIframe.html`
};
if (args['wrap-iframe']) {
webConfigJSON._wrapWebWorkerExtHostInIframe = true;
}
const authSessionInfo = args['github-auth'] ? {
id: uuid.v4(),
providerId: 'github',
accessToken: args['github-auth'],
scopes: [['user:email'], ['repo']]
} : undefined;
const data = (await readFile(WEB_MAIN)).toString()
.replace('{{WORKBENCH_WEB_CONFIGURATION}}', () => escapeAttribute(JSON.stringify(webConfigJSON))) // use a replace function to avoid that regexp replace patterns ($&, $0, ...) are applied
.replace('{{WORKBENCH_BUILTIN_EXTENSIONS}}', () => escapeAttribute(JSON.stringify(dedupedBuiltInExtensions)))
.replace('{{WORKBENCH_AUTH_SESSION}}', () => authSessionInfo ? escapeAttribute(JSON.stringify(authSessionInfo)) : '')
.replace('{{WEBVIEW_ENDPOINT}}', '');
const headers = { 'Content-Type': 'text/html' };
if (args['trusted-types']) {
headers['Content-Security-Policy-Report-Only'] = 'require-trusted-types-for \'script\';';
}
res.writeHead(200, headers);
return res.end(data);
}
/**
* Handle HTTP requests for /callback
* @param {import('http').IncomingMessage} req
* @param {import('http').ServerResponse} res
* @param {import('url').UrlWithParsedQuery} parsedUrl
*/
async function handleCallback(req, res, parsedUrl) {
const wellKnownKeys = ['vscode-requestId', 'vscode-scheme', 'vscode-authority', 'vscode-path', 'vscode-query', 'vscode-fragment'];
const [requestId, vscodeScheme, vscodeAuthority, vscodePath, vscodeQuery, vscodeFragment] = wellKnownKeys.map(key => {
const value = getFirstQueryValue(parsedUrl, key);
if (value) {
return decodeURIComponent(value);
}
return value;
});
if (!requestId) {
res.writeHead(400, { 'Content-Type': 'text/plain' });
return res.end(`Bad request.`);
}
// merge over additional query values that we got
let query = vscodeQuery;
let index = 0;
getFirstQueryValues(parsedUrl, wellKnownKeys).forEach((value, key) => {
if (!query) {
query = '';
}
const prefix = (index++ === 0) ? '' : '&';
query += `${prefix}${key}=${value}`;
});
// add to map of known callbacks
mapCallbackUriToRequestId.set(requestId, JSON.stringify({ scheme: vscodeScheme || 'code-oss', authority: vscodeAuthority, path: vscodePath, query, fragment: vscodeFragment }));
return serveFile(req, res, path.join(APP_ROOT, 'resources', 'web', 'callback.html'), { 'Content-Type': 'text/html' });
}
/**
* Handle HTTP requests for /fetch-callback
* @param {import('http').IncomingMessage} req
* @param {import('http').ServerResponse} res
* @param {import('url').UrlWithParsedQuery} parsedUrl
*/
async function handleFetchCallback(req, res, parsedUrl) {
const requestId = getFirstQueryValue(parsedUrl, 'vscode-requestId');
if (!requestId) {
res.writeHead(400, { 'Content-Type': 'text/plain' });
return res.end(`Bad request.`);
}
const knownCallbackUri = mapCallbackUriToRequestId.get(requestId);
if (knownCallbackUri) {
mapCallbackUriToRequestId.delete(requestId);
}
res.writeHead(200, { 'Content-Type': 'text/json' });
return res.end(knownCallbackUri);
}
/**
* @param {import('url').UrlWithParsedQuery} parsedUrl
* @param {string} key
* @returns {string | undefined}
*/
function getFirstQueryValue(parsedUrl, key) {
const result = parsedUrl.query[key];
return Array.isArray(result) ? result[0] : result;
}
/**
* @param {import('url').UrlWithParsedQuery} parsedUrl
* @param {string[] | undefined} ignoreKeys
* @returns {Map<string, string>}
*/
function getFirstQueryValues(parsedUrl, ignoreKeys) {
const queryValues = new Map();
for (const key in parsedUrl.query) {
if (ignoreKeys && ignoreKeys.indexOf(key) >= 0) {
continue;
}
const value = getFirstQueryValue(parsedUrl, key);
if (typeof value === 'string') {
queryValues.set(key, value);
}
}
return queryValues;
}
/**
* @param {string} value
*/
function escapeAttribute(value) {
return value.replace(/"/g, '&quot;');
}
/**
* @param {string} relativePath
* @param {Object.<string, string>} locations
* @returns {string | undefined}
*/
function getExtensionFilePath(relativePath, locations) {
const firstSlash = relativePath.indexOf('/');
if (firstSlash === -1) {
return undefined;
}
const extensionId = relativePath.substr(0, firstSlash);
const extensionPath = locations[extensionId];
if (!extensionPath) {
return undefined;
}
return path.join(extensionPath, relativePath.substr(firstSlash + 1));
}
/**
* @param {import('http').IncomingMessage} req
* @param {import('http').ServerResponse} res
* @param {string} errorMessage
*/
function serveError(req, res, errorCode, errorMessage, responseHeaders = Object.create(null)) {
responseHeaders['Content-Type'] = 'text/plain';
res.writeHead(errorCode, responseHeaders);
res.end(errorMessage);
}
const textMimeType = {
'.html': 'text/html',
'.js': 'text/javascript',
'.json': 'application/json',
'.css': 'text/css',
'.svg': 'image/svg+xml',
};
const mapExtToMediaMimes = {
'.bmp': 'image/bmp',
'.gif': 'image/gif',
'.ico': 'image/x-icon',
'.jpe': 'image/jpg',
'.jpeg': 'image/jpg',
'.jpg': 'image/jpg',
'.png': 'image/png',
'.tga': 'image/x-tga',
'.tif': 'image/tiff',
'.tiff': 'image/tiff',
'.woff': 'application/font-woff'
};
/**
* @param {string} forPath
*/
function getMediaMime(forPath) {
const ext = path.extname(forPath);
return mapExtToMediaMimes[ext.toLowerCase()];
}
/**
* @param {import('http').IncomingMessage} req
* @param {import('http').ServerResponse} res
* @param {string} filePath
*/
async function serveFile(req, res, filePath, responseHeaders = Object.create(null)) {
try {
// Sanity checks
filePath = path.normalize(filePath); // ensure no "." and ".."
const stat = await util.promisify(fs.stat)(filePath);
// Check if file modified since
const etag = `W/"${[stat.ino, stat.size, stat.mtime.getTime()].join('-')}"`; // weak validator (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag)
if (req.headers['if-none-match'] === etag) {
res.writeHead(304);
return res.end();
}
// Headers
responseHeaders['Content-Type'] = textMimeType[path.extname(filePath)] || getMediaMime(filePath) || 'text/plain';
responseHeaders['Etag'] = etag;
res.writeHead(200, responseHeaders);
// Data
fs.createReadStream(filePath).pipe(res);
} catch (error) {
console.error(error.toString());
responseHeaders['Content-Type'] = 'text/plain';
res.writeHead(404, responseHeaders);
return res.end('Not found');
}
}
if (args.launch !== false) {
opn(`${SCHEME}://${HOST}:${PORT}`);
}

View File

@ -0,0 +1,8 @@
<Application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<VisualElements
BackgroundColor="#2D2D30"
ShowNameOnSquare150x150Logo="on"
Square150x150Logo="resources\app\resources\win32\code_150x150.png"
Square70x70Logo="resources\app\resources\win32\code_70x70.png"
ForegroundText="light" />
</Application>

View File

@ -0,0 +1,6 @@
@echo off
setlocal
set VSCODE_DEV=
set ELECTRON_RUN_AS_NODE=1
"%~dp0..\@@NAME@@.exe" "%~dp0..\resources\app\out\cli.js" %*
endlocal

View File

@ -0,0 +1,62 @@
#!/usr/bin/env sh
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
if [ "$VSCODE_WSL_DEBUG_INFO" = true ]; then
set -x
fi
COMMIT="@@COMMIT@@"
APP_NAME="@@APPNAME@@"
QUALITY="@@QUALITY@@"
NAME="@@NAME@@"
DATAFOLDER="@@DATAFOLDER@@"
VSCODE_PATH="$(dirname "$(dirname "$(realpath "$0")")")"
ELECTRON="$VSCODE_PATH/$NAME.exe"
IN_WSL=false
if [ -n "$WSL_DISTRO_NAME" ]; then
# $WSL_DISTRO_NAME is available since WSL builds 18362, also for WSL2
IN_WSL=true
else
WSL_BUILD=$(uname -r | sed -E 's/^[0-9.]+-([0-9]+)-Microsoft.*|.*/\1/')
if [ -n "$WSL_BUILD" ]; then
if [ "$WSL_BUILD" -ge 17063 ]; then
# WSLPATH is available since WSL build 17046
# WSLENV is available since WSL build 17063
IN_WSL=true
else
# If running under older WSL, don't pass cli.js to Electron as
# environment vars cannot be transferred from WSL to Windows
# See: https://github.com/microsoft/BashOnWindows/issues/1363
# https://github.com/microsoft/BashOnWindows/issues/1494
"$ELECTRON" "$@"
exit $?
fi
fi
fi
if [ $IN_WSL = true ]; then
export WSLENV="ELECTRON_RUN_AS_NODE/w:$WSLENV"
CLI=$(wslpath -m "$VSCODE_PATH/resources/app/out/cli.js")
# use the Remote WSL extension if installed
WSL_EXT_ID="ms-vscode-remote.remote-wsl"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" --locate-extension $WSL_EXT_ID >/tmp/remote-wsl-loc.txt 2>/dev/null </dev/null
WSL_EXT_WLOC=$(cat /tmp/remote-wsl-loc.txt)
if [ -n "$WSL_EXT_WLOC" ]; then
# replace \r\n with \n in WSL_EXT_WLOC
WSL_CODE=$(wslpath -u "${WSL_EXT_WLOC%%[[:cntrl:]]}")/scripts/wslCode.sh
"$WSL_CODE" "$COMMIT" "$QUALITY" "$ELECTRON" "$APP_NAME" "$DATAFOLDER" "$@"
exit $?
fi
elif [ -x "$(command -v cygpath)" ]; then
CLI=$(cygpath -m "$VSCODE_PATH/resources/app/out/cli.js")
else
CLI="$VSCODE_PATH/resources/app/out/cli.js"
fi
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
exit $?

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB