diff --git a/.gitignore b/.gitignore index 6a9804cd23..468c60a2b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +.cache npm-debug.log Thumbs.db node_modules/ @@ -14,6 +15,9 @@ out-editor-min/ out-monaco-editor-core/ out-vscode/ out-vscode-min/ +out-vscode-reh/ +out-vscode-reh-min/ +out-vscode-reh-pkg/ build/node_modules coverage/ test_data/ diff --git a/azure-pipelines-linux-mac.yml b/azure-pipelines-linux-mac.yml index c343479bc3..5e0d8f3e9f 100644 --- a/azure-pipelines-linux-mac.yml +++ b/azure-pipelines-linux-mac.yml @@ -1,13 +1,10 @@ steps: - task: NodeTool@0 inputs: - versionSpec: '8.x' + versionSpec: '10.15.1' displayName: 'Install Node.js' - script: | - git submodule update --init --recursive - nvm install 10.15.1 - nvm use 10.15.1 npm i -g yarn displayName: 'preinstall' diff --git a/build/azure-pipelines/common/installDistro.ts b/build/azure-pipelines/common/installDistro.ts index 9c369174b0..ca3795285b 100644 --- a/build/azure-pipelines/common/installDistro.ts +++ b/build/azure-pipelines/common/installDistro.ts @@ -3,10 +3,12 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as cp from 'child_process'; +import * as cp from 'child_process'; +import * as path from 'path'; function yarnInstall(packageName: string): void { cp.execSync(`yarn add --no-lockfile ${packageName}`); + cp.execSync(`yarn add --no-lockfile ${packageName}`, { cwd: path.join( process.cwd(), 'remote') }); } const product = require('../../../product.json'); diff --git a/build/azure-pipelines/darwin/build.sh b/build/azure-pipelines/darwin/build.sh index af558b8c14..a47546249f 100755 --- a/build/azure-pipelines/darwin/build.sh +++ b/build/azure-pipelines/darwin/build.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash set -e yarn gulp vscode-darwin-min +yarn gulp vscode-reh-darwin-min yarn gulp upload-vscode-sourcemaps \ No newline at end of file diff --git a/build/azure-pipelines/darwin/publish.sh b/build/azure-pipelines/darwin/publish.sh index 96d5967ea4..6bc80ce04e 100755 --- a/build/azure-pipelines/darwin/publish.sh +++ b/build/azure-pipelines/darwin/publish.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e # remove pkg from archive zip -d ../VSCode-darwin.zip "*.pkg" @@ -15,6 +16,19 @@ node build/azure-pipelines/common/publish.js \ true \ ../VSCode-darwin.zip +# package Remote Extension Host +pushd .. && mv vscode-reh-darwin vscode-server-darwin && zip -Xry vscode-server-darwin.zip vscode-server-darwin && popd + +# publish Remote Extension Host +node build/azure-pipelines/common/publish.js \ + "$VSCODE_QUALITY" \ + server-darwin \ + archive-unsigned \ + "vscode-server-darwin.zip" \ + $VERSION \ + true \ + ../vscode-server-darwin.zip + # publish hockeyapp symbols node build/azure-pipelines/common/symbols.js "$VSCODE_MIXIN_PASSWORD" "$VSCODE_HOCKEYAPP_TOKEN" "$VSCODE_ARCH" "$VSCODE_HOCKEYAPP_ID_MACOS" diff --git a/build/azure-pipelines/linux/build.sh b/build/azure-pipelines/linux/build.sh index bd251ebc78..1c79d76486 100755 --- a/build/azure-pipelines/linux/build.sh +++ b/build/azure-pipelines/linux/build.sh @@ -1,3 +1,7 @@ #!/usr/bin/env bash set -e -yarn gulp "vscode-linux-$VSCODE_ARCH-min" \ No newline at end of file +yarn gulp "vscode-linux-$VSCODE_ARCH-min" + +if [[ "$VSCODE_ARCH" != "ia32" ]]; then + yarn gulp vscode-reh-linux-$VSCODE_ARCH-min +fi \ No newline at end of file diff --git a/build/azure-pipelines/linux/publish.sh b/build/azure-pipelines/linux/publish.sh index ca338a6fc5..0f864600bd 100755 --- a/build/azure-pipelines/linux/publish.sh +++ b/build/azure-pipelines/linux/publish.sh @@ -20,6 +20,19 @@ rm -rf $ROOT/code-*.tar.* node build/azure-pipelines/common/publish.js "$VSCODE_QUALITY" "$PLATFORM_LINUX" archive-unsigned "$TARBALL_FILENAME" "$VERSION" true "$TARBALL_PATH" +# Publish Remote Extension Host +if [[ "$VSCODE_ARCH" != "ia32" ]]; then + LEGACY_SERVER_BUILD_NAME="vscode-reh-$PLATFORM_LINUX" + SERVER_BUILD_NAME="vscode-server-$PLATFORM_LINUX" + SERVER_TARBALL_FILENAME="vscode-server-$PLATFORM_LINUX.tar.gz" + SERVER_TARBALL_PATH="$ROOT/$SERVER_TARBALL_FILENAME" + + rm -rf $ROOT/vscode-server-*.tar.* + (cd $ROOT && mv $LEGACY_SERVER_BUILD_NAME $SERVER_BUILD_NAME && tar -czf $SERVER_TARBALL_PATH $SERVER_BUILD_NAME) + + node build/azure-pipelines/common/publish.js "$VSCODE_QUALITY" "server-$PLATFORM_LINUX" archive-unsigned "$SERVER_TARBALL_FILENAME" "$VERSION" true "$SERVER_TARBALL_PATH" +fi + # Publish hockeyapp symbols node build/azure-pipelines/common/symbols.js "$VSCODE_MIXIN_PASSWORD" "$VSCODE_HOCKEYAPP_TOKEN" "$VSCODE_ARCH" "$VSCODE_HOCKEYAPP_ID_LINUX64" diff --git a/build/azure-pipelines/publish-types/.gitignore b/build/azure-pipelines/publish-types/.gitignore new file mode 100644 index 0000000000..e94ecda764 --- /dev/null +++ b/build/azure-pipelines/publish-types/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +*.js \ No newline at end of file diff --git a/build/azure-pipelines/publish-types/check-version.js b/build/azure-pipelines/publish-types/check-version.js new file mode 100644 index 0000000000..134499e959 --- /dev/null +++ b/build/azure-pipelines/publish-types/check-version.js @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; +Object.defineProperty(exports, "__esModule", { value: true }); +const cp = require("child_process"); +let tag = ''; +try { + tag = cp + .execSync('git describe --tags `git rev-list --tags --max-count=1`') + .toString() + .trim(); + if (!isValidTag(tag)) { + throw Error(`Invalid tag ${tag}`); + } +} +catch (err) { + console.error(err); + console.error('Failed to update types'); + process.exit(1); +} +function isValidTag(t) { + if (t.split('.').length !== 3) { + return false; + } + const [major, minor, bug] = t.split('.'); + // Only release for tags like 1.34.0 + if (bug !== '0') { + return false; + } + if (parseInt(major, 10) === NaN || parseInt(minor, 10) === NaN) { + return false; + } + return true; +} diff --git a/build/azure-pipelines/publish-types/check-version.ts b/build/azure-pipelines/publish-types/check-version.ts new file mode 100644 index 0000000000..3562261a80 --- /dev/null +++ b/build/azure-pipelines/publish-types/check-version.ts @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import * as cp from 'child_process'; + +let tag = ''; +try { + tag = cp + .execSync('git describe --tags `git rev-list --tags --max-count=1`') + .toString() + .trim(); + + if (!isValidTag(tag)) { + throw Error(`Invalid tag ${tag}`); + } +} catch (err) { + console.error(err); + console.error('Failed to update types'); + process.exit(1); +} + +function isValidTag(t: string) { + if (t.split('.').length !== 3) { + return false; + } + + const [major, minor, bug] = t.split('.'); + + // Only release for tags like 1.34.0 + if (bug !== '0') { + return false; + } + + if (parseInt(major, 10) === NaN || parseInt(minor, 10) === NaN) { + return false; + } + + return true; +} \ No newline at end of file diff --git a/build/azure-pipelines/publish-types/publish-types.yml b/build/azure-pipelines/publish-types/publish-types.yml new file mode 100644 index 0000000000..ff03cecedb --- /dev/null +++ b/build/azure-pipelines/publish-types/publish-types.yml @@ -0,0 +1,67 @@ +# Publish @types/vscode for each release + +trigger: + branches: + include: ['refs/tags/*'] + +pr: none + +steps: +- task: NodeTool@0 + inputs: + versionSpec: "10.15.1" + +- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 + inputs: + versionSpec: "1.10.1" + +- bash: | + # Install build dependencies + (cd build && yarn) + node build/azure-pipelines/publish-types/check-version.js + displayName: Check version + +- bash: | + git config --global user.email "vscode@microsoft.com" + git config --global user.name "VSCode" + + git clone https://$(GITHUB_TOKEN)@github.com/DefinitelyTyped/DefinitelyTyped.git --depth=1 + node build/azure-pipelines/publish-types/update-types.js + + TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`) + + cd DefinitelyTyped + + git diff --color | cat + git add -A + git status + git checkout -b "vscode-types-$TAG_VERSION" + git commit -m "VS Code $TAG_VERSION Extension API" + git push origin "vscode-types-$TAG_VERSION" + + displayName: Push update to DefinitelyTyped + +- bash: | + TAG_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`) + CHANNEL="G1C14HJ2F" + + MESSAGE="DefinitelyTyped/DefinitelyTyped#vscode-types-$TAG_VERSION created. Endgame master, please open this link, examine changes and create a PR:" + LINK="https://github.com/DefinitelyTyped/DefinitelyTyped/compare/vscode-types-$TAG_VERSION?quick_pull=1&body=Updating%20VS%20Code%20Extension%20API.%20See%20https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode%2Fissues%2F70175%20for%20details." + MESSAGE2="[@octref, @jrieken, @kmaetzel, @egamma]. Please review and merge PR to publish @types/vscode." + + curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \ + -H 'Content-type: application/json; charset=utf-8' \ + --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE"'"}' \ + https://slack.com/api/chat.postMessage + + curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \ + -H 'Content-type: application/json; charset=utf-8' \ + --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$LINK"'"}' \ + https://slack.com/api/chat.postMessage + + curl -X POST -H "Authorization: Bearer $(SLACK_TOKEN)" \ + -H 'Content-type: application/json; charset=utf-8' \ + --data '{"channel":"'"$CHANNEL"'", "link_names": true, "text":"'"$MESSAGE2"'"}' \ + https://slack.com/api/chat.postMessage + + displayName: Send message on Slack diff --git a/build/azure-pipelines/publish-types/update-types.js b/build/azure-pipelines/publish-types/update-types.js new file mode 100644 index 0000000000..1873069b72 --- /dev/null +++ b/build/azure-pipelines/publish-types/update-types.js @@ -0,0 +1,62 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; +Object.defineProperty(exports, "__esModule", { value: true }); +const fs = require("fs"); +const cp = require("child_process"); +const path = require("path"); +let tag = ''; +try { + tag = cp + .execSync('git describe --tags `git rev-list --tags --max-count=1`') + .toString() + .trim(); + const dtsUri = `https://raw.githubusercontent.com/microsoft/vscode/${tag}/src/vs/vscode.d.ts`; + const outPath = path.resolve(process.cwd(), 'DefinitelyTyped/types/vscode/index.d.ts'); + cp.execSync(`curl ${dtsUri} --output ${outPath}`); + updateDTSFile(outPath, tag); + console.log(`Done updating vscode.d.ts at ${outPath}`); +} +catch (err) { + console.error(err); + console.error('Failed to update types'); + process.exit(1); +} +function updateDTSFile(outPath, tag) { + const oldContent = fs.readFileSync(outPath, 'utf-8'); + const newContent = getNewFileContent(oldContent, tag); + fs.writeFileSync(outPath, newContent); +} +function getNewFileContent(content, tag) { + const oldheader = [ + `/*---------------------------------------------------------------------------------------------`, + ` * Copyright (c) Microsoft Corporation. All rights reserved.`, + ` * Licensed under the Source EULA. See License.txt in the project root for license information.`, + ` *--------------------------------------------------------------------------------------------*/` + ].join('\n'); + return getNewFileHeader(tag) + content.slice(oldheader.length); +} +function getNewFileHeader(tag) { + const [major, minor] = tag.split('.'); + const shorttag = `${major}.${minor}`; + const header = [ + `// Type definitions for Visual Studio Code ${shorttag}`, + `// Project: https://github.com/microsoft/vscode`, + `// Definitions by: Visual Studio Code Team, Microsoft `, + `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`, + ``, + `/*---------------------------------------------------------------------------------------------`, + ` * Copyright (c) Microsoft Corporation. All rights reserved.`, + ` * Licensed under the Source EULA.`, + ` * See https://github.com/Microsoft/vscode/blob/master/LICENSE.txt for license information.`, + ` *--------------------------------------------------------------------------------------------*/`, + ``, + `/**`, + ` * Type Definition for Visual Studio Code ${shorttag} Extension API`, + ` * See https://code.visualstudio.com/api for more information`, + ` */` + ].join('\n'); + return header; +} diff --git a/build/azure-pipelines/publish-types/update-types.ts b/build/azure-pipelines/publish-types/update-types.ts new file mode 100644 index 0000000000..7c0ca80ecc --- /dev/null +++ b/build/azure-pipelines/publish-types/update-types.ts @@ -0,0 +1,73 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import * as fs from 'fs'; +import * as cp from 'child_process'; +import * as path from 'path'; + +let tag = ''; +try { + tag = cp + .execSync('git describe --tags `git rev-list --tags --max-count=1`') + .toString() + .trim(); + + const dtsUri = `https://raw.githubusercontent.com/microsoft/vscode/${tag}/src/vs/vscode.d.ts`; + const outPath = path.resolve(process.cwd(), 'DefinitelyTyped/types/vscode/index.d.ts'); + cp.execSync(`curl ${dtsUri} --output ${outPath}`); + + updateDTSFile(outPath, tag); + + console.log(`Done updating vscode.d.ts at ${outPath}`); +} catch (err) { + console.error(err); + console.error('Failed to update types'); + process.exit(1); +} + +function updateDTSFile(outPath: string, tag: string) { + const oldContent = fs.readFileSync(outPath, 'utf-8'); + const newContent = getNewFileContent(oldContent, tag); + + fs.writeFileSync(outPath, newContent); +} + +function getNewFileContent(content: string, tag: string) { + const oldheader = [ + `/*---------------------------------------------------------------------------------------------`, + ` * Copyright (c) Microsoft Corporation. All rights reserved.`, + ` * Licensed under the Source EULA. See License.txt in the project root for license information.`, + ` *--------------------------------------------------------------------------------------------*/` + ].join('\n'); + + return getNewFileHeader(tag) + content.slice(oldheader.length); +} + +function getNewFileHeader(tag: string) { + const [major, minor] = tag.split('.'); + const shorttag = `${major}.${minor}`; + + const header = [ + `// Type definitions for Visual Studio Code ${shorttag}`, + `// Project: https://github.com/microsoft/vscode`, + `// Definitions by: Visual Studio Code Team, Microsoft `, + `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`, + ``, + `/*---------------------------------------------------------------------------------------------`, + ` * Copyright (c) Microsoft Corporation. All rights reserved.`, + ` * Licensed under the Source EULA.`, + ` * See https://github.com/Microsoft/vscode/blob/master/LICENSE.txt for license information.`, + ` *--------------------------------------------------------------------------------------------*/`, + ``, + `/**`, + ` * Type Definition for Visual Studio Code ${shorttag} Extension API`, + ` * See https://code.visualstudio.com/api for more information`, + ` */` + ].join('\n'); + + return header; +} diff --git a/build/azure-pipelines/win32/build.ps1 b/build/azure-pipelines/win32/build.ps1 index 60325ba54c..8334a87e02 100644 --- a/build/azure-pipelines/win32/build.ps1 +++ b/build/azure-pipelines/win32/build.ps1 @@ -1,4 +1,5 @@ . build/azure-pipelines/win32/exec.ps1 $ErrorActionPreference = "Stop" exec { yarn gulp "vscode-win32-$env:VSCODE_ARCH-min" } +exec { yarn gulp "vscode-reh-win32-$env:VSCODE_ARCH-min" } exec { yarn gulp "vscode-win32-$env:VSCODE_ARCH-inno-updater" } \ No newline at end of file diff --git a/build/azure-pipelines/win32/publish.ps1 b/build/azure-pipelines/win32/publish.ps1 index 8e6fa988ad..86da6df4e0 100644 --- a/build/azure-pipelines/win32/publish.ps1 +++ b/build/azure-pipelines/win32/publish.ps1 @@ -10,8 +10,16 @@ $Root = "$Repo\.." $SystemExe = "$Repo\.build\win32-$Arch\system-setup\VSCodeSetup.exe" $UserExe = "$Repo\.build\win32-$Arch\user-setup\VSCodeSetup.exe" $Zip = "$Repo\.build\win32-$Arch\archive\VSCode-win32-$Arch.zip" +$LegacyServer = "$Root\vscode-reh-win32-$Arch" +$ServerName = "vscode-server-win32-$Arch" +$Server = "$Root\$ServerName" +$ServerZip = "$Repo\.build\vscode-server-win32-$Arch.zip" $Build = "$Root\VSCode-win32-$Arch" +# Create server archive +exec { Rename-Item -Path $LegacyServer -NewName $ServerName } +exec { .\node_modules\7zip\7zip-lite\7z.exe a -tzip $ServerZip $Server -r } + # get version $PackageJson = Get-Content -Raw -Path "$Build\resources\app\package.json" | ConvertFrom-Json $Version = $PackageJson.version @@ -22,6 +30,7 @@ $AssetPlatform = if ("$Arch" -eq "ia32") { "win32" } else { "win32-x64" } exec { node build/azure-pipelines/common/publish.js $Quality "$AssetPlatform-archive" archive "VSCode-win32-$Arch-$Version.zip" $Version true $Zip } exec { node build/azure-pipelines/common/publish.js $Quality "$AssetPlatform" setup "VSCodeSetup-$Arch-$Version.exe" $Version true $SystemExe } exec { node build/azure-pipelines/common/publish.js $Quality "$AssetPlatform-user" setup "VSCodeUserSetup-$Arch-$Version.exe" $Version true $UserExe } +exec { node build/azure-pipelines/common/publish.js $Quality "server-$AssetPlatform" archive "vscode-server-win32-$Arch.zip" $Version true $ServerZip } # publish hockeyapp symbols $hockeyAppId = if ("$Arch" -eq "ia32") { "$env:VSCODE_HOCKEYAPP_ID_WIN32" } else { "$env:VSCODE_HOCKEYAPP_ID_WIN64" } diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js new file mode 100644 index 0000000000..fe5cbcfc56 --- /dev/null +++ b/build/gulpfile.reh.js @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +const gulp = require('gulp'); + +const noop = () => { return Promise.resolve(); }; + +gulp.task('vscode-reh-win32-ia32-min', noop); +gulp.task('vscode-reh-win32-x64-min', noop); +gulp.task('vscode-reh-darwin-min', noop); +gulp.task('vscode-reh-linux-x64-min', noop); +gulp.task('vscode-reh-linux-arm-min', noop); diff --git a/build/lib/i18n.resources.json b/build/lib/i18n.resources.json index ac557db625..22d3d165c3 100644 --- a/build/lib/i18n.resources.json +++ b/build/lib/i18n.resources.json @@ -110,6 +110,10 @@ "name": "vs/workbench/contrib/quickopen", "project": "vscode-workbench" }, + { + "name": "vs/workbench/contrib/remote", + "project": "vscode-workbench" + }, { "name": "vs/workbench/contrib/relauncher", "project": "vscode-workbench" diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js index f11f29dad4..0374586a6d 100644 --- a/build/npm/postinstall.js +++ b/build/npm/postinstall.js @@ -36,6 +36,8 @@ function yarnInstall(location, opts) { yarnInstall('extensions'); // node modules shared by all extensions +yarnInstall('remote'); // node modules used by vscode server + const allExtensionFolders = fs.readdirSync('extensions'); const extensions = allExtensionFolders.filter(e => { try { diff --git a/extensions/configuration-editing/package.json b/extensions/configuration-editing/package.json index bb9690a07d..e9f9e255f3 100644 --- a/extensions/configuration-editing/package.json +++ b/extensions/configuration-editing/package.json @@ -96,6 +96,14 @@ { "fileMatch": "/.vscode/extensions.json", "url": "vscode://schemas/extensions" + }, + { + "fileMatch": "/.devcontainer/devcontainer.json", + "url": "./schemas/devContainer.schema.json" + }, + { + "fileMatch": "/.devcontainer.json", + "url": "./schemas/devContainer.schema.json" } ] }, diff --git a/extensions/configuration-editing/schemas/devContainer.schema.json b/extensions/configuration-editing/schemas/devContainer.schema.json new file mode 100644 index 0000000000..38b3c640c5 --- /dev/null +++ b/extensions/configuration-editing/schemas/devContainer.schema.json @@ -0,0 +1,149 @@ +{ + "$schema": "http://json-schema.org/schema#", + "description": "Defines a dev container", + "allowComments": true, + "type": "object", + "definitions": { + "devContainerCommon": { + "properties": { + "name": { + "type": "string", + "description": "A name to show for the workspace folder." + }, + "extensions": { + "type": "array", + "description": "An array of extensions that should be installed into the container.", + "items": { + "type": "string" + } + }, + "settings": { + "type": "object", + "description": "Machine specific settings that should be copied into the container." + }, + "postCreateCommand": { + "type": ["string", "array"], + "description": "A command to run after creating the container. If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell.", + "items": { + "type": "string" + } + }, + "devPort": { + "type": "integer", + "description": "The port VS Code can use to connect to its backend." + } + } + }, + "nonComposeBase": { + "properties": { + "appPort": { + "type": ["integer", "string", "array"], + "description": "Application ports that are exposed by the container. This can be a single port or an array of ports. Each port can be a number or a string. A number is mapped to the same port on the host. A string is passed to Docker unchanged and can be used to map ports differently, e.g. \"8000:8010\".", + "items": { + "type": ["integer", "string"] + } + }, + "runArgs": { + "type": "array", + "description": "The arguments required when starting in the container.", + "items": { + "type": "string" + } + }, + "shutdownAction": { + "type": "string", + "enum": ["none", "stopContainer"], + "description": "Action to take when VS Code is shutting down. The default is to stop the container." + }, + "overrideCommand": { + "type": "boolean", + "description": "Whether to overwrite the command specified in the image. The default is true." + }, + "workspaceFolder": { + "type": "string", + "description": "The path of the workspace folder inside the container." + }, + "workspaceMount": { + "type": "string", + "description": "The --mount parameter for docker run. The default is to mount the project folder at /workspaces/$project." + } + } + }, + "dockerFileContainer": { + "properties": { + "dockerFile": { + "type": "string", + "description": "The location of the Dockerfile that defines the contents of the container. The path is relative to the folder containing the `devcontainer.json` file." + }, + "context": { + "type": "string", + "description": "The location of the context folder for building the Docker image. The path is relative to the folder containing the `devcontainer.json` file." + } + }, + "required": ["dockerFile"] + }, + "imageContainer": { + "properties": { + "image": { + "type": "string", + "description": "The docker image that will be used to create the container." + } + }, + "required": ["image"] + }, + "composeContainer": { + "properties": { + "dockerComposeFile": { + "type": ["string", "array"], + "description": "The name of the docker-compose file(s) used to start the services.", + "items": { + "type": "string" + } + }, + "service": { + "type": "string", + "description": "The service you want to work on." + }, + "workspaceFolder": { + "type": "string", + "description": "The path of the workspace folder inside the container." + }, + "shutdownAction": { + "type": "string", + "enum": ["none", "stopCompose"], + "description": "Action to take when VS Code is shutting down. The default is to stop the containers." + } + }, + "required": ["dockerComposeFile", "service", "workspaceFolder"] + } + }, + "allOf": [ + { + "oneOf": [ + { + "allOf": [ + { + "oneOf": [ + { + "$ref": "#/definitions/dockerFileContainer" + }, + { + "$ref": "#/definitions/imageContainer" + } + ] + }, + { + "$ref": "#/definitions/nonComposeBase" + } + ] + }, + { + "$ref": "#/definitions/composeContainer" + } + ] + }, + { + "$ref": "#/definitions/devContainerCommon" + } + ] +} \ No newline at end of file diff --git a/extensions/markdown-language-features/media/markdown.css b/extensions/markdown-language-features/media/markdown.css index da0640b244..1be3a3fa03 100644 --- a/extensions/markdown-language-features/media/markdown.css +++ b/extensions/markdown-language-features/media/markdown.css @@ -3,7 +3,7 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -body { +html, body { font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "Ubuntu", "Droid Sans", sans-serif; font-size: 14px; padding: 0 26px; @@ -32,7 +32,6 @@ body { box-shadow: 2px 2px 2px rgba(0,0,0,.25); } - body.scrollBeyondLastLine { margin-bottom: calc(100vh - 22px); } @@ -169,19 +168,14 @@ blockquote { code { font-family: Menlo, Monaco, Consolas, "Droid Sans Mono", "Courier New", monospace, "Droid Sans Fallback"; - font-size: 14px; - line-height: 19px; + font-size: 1rem; + line-height: 1.357rem; } body.wordWrap pre { white-space: pre-wrap; } -.mac code { - font-size: 12px; - line-height: 18px; -} - pre:not(.hljs), pre.hljs code > div { padding: 16px; diff --git a/extensions/markdown-language-features/src/commands/showPreviewSecuritySelector.ts b/extensions/markdown-language-features/src/commands/showPreviewSecuritySelector.ts index 5b83706696..22442b7d74 100644 --- a/extensions/markdown-language-features/src/commands/showPreviewSecuritySelector.ts +++ b/extensions/markdown-language-features/src/commands/showPreviewSecuritySelector.ts @@ -19,12 +19,12 @@ export class ShowPreviewSecuritySelectorCommand implements Command { public execute(resource: string | undefined) { if (this.previewManager.activePreviewResource) { - this.previewSecuritySelector.showSecutitySelectorForResource(this.previewManager.activePreviewResource); + this.previewSecuritySelector.showSecuritySelectorForResource(this.previewManager.activePreviewResource); } else if (resource) { const source = vscode.Uri.parse(resource); - this.previewSecuritySelector.showSecutitySelectorForResource(source.query ? vscode.Uri.parse(source.query) : source); + this.previewSecuritySelector.showSecuritySelectorForResource(source.query ? vscode.Uri.parse(source.query) : source); } else if (vscode.window.activeTextEditor && isMarkdownFile(vscode.window.activeTextEditor.document)) { - this.previewSecuritySelector.showSecutitySelectorForResource(vscode.window.activeTextEditor.document.uri); + this.previewSecuritySelector.showSecuritySelectorForResource(vscode.window.activeTextEditor.document.uri); } } } \ No newline at end of file diff --git a/extensions/markdown-language-features/src/features/previewContentProvider.ts b/extensions/markdown-language-features/src/features/previewContentProvider.ts index f2ad4a54e4..85bbba5a2e 100644 --- a/extensions/markdown-language-features/src/features/previewContentProvider.ts +++ b/extensions/markdown-language-features/src/features/previewContentProvider.ts @@ -35,6 +35,10 @@ const previewStrings = { 'Content Disabled Security Warning') }; +function escapeAttribute(value: string): string { + return value.replace(/"/g, '"'); +} + export class MarkdownContentProvider { constructor( private readonly engine: MarkdownEngine, @@ -75,9 +79,9 @@ export class MarkdownContentProvider { ${csp} + data-settings="${escapeAttribute(JSON.stringify(initialData))}" + data-strings="${escapeAttribute(JSON.stringify(previewStrings))}" + data-state="${escapeAttribute(JSON.stringify(state || {}))}"> ${this.getStyles(sourceUri, nonce, config, state)} @@ -142,7 +146,7 @@ export class MarkdownContentProvider { private computeCustomStyleSheetIncludes(resource: vscode.Uri, config: MarkdownPreviewConfiguration): string { if (Array.isArray(config.styles)) { return config.styles.map(style => { - return ``; + return ``; }).join('\n'); } return ''; @@ -150,7 +154,7 @@ export class MarkdownContentProvider { private getSettingsOverrideStyles(nonce: string, config: MarkdownPreviewConfiguration): string { return `